Toggle navigation
Documentation
Big picture
The finite element method
The data structure
Not-so-quick guide
Optimisation
Order of action functions
Example codes and tutorials
List of example codes and tutorials
Meshing
Solvers
MPI parallel processing
Post-processing/visualisation
Other
Change log
Creating documentation
Coding conventions
Index
FAQ
About
People
Contact/Get involved
Publications
Acknowledgements
Copyright
Picture show
Go
src
meshes
horizontal_single_layer_spine_mesh.template.cc
Go to the documentation of this file.
1
// LIC// ====================================================================
2
// LIC// This file forms part of oomph-lib, the object-oriented,
3
// LIC// multi-physics finite-element library, available
4
// LIC// at http://www.oomph-lib.org.
5
// LIC//
6
// LIC// Copyright (C) 2006-2026 Matthias Heil and Andrew Hazel
7
// LIC//
8
// LIC// This library is free software; you can redistribute it and/or
9
// LIC// modify it under the terms of the GNU Lesser General Public
10
// LIC// License as published by the Free Software Foundation; either
11
// LIC// version 2.1 of the License, or (at your option) any later version.
12
// LIC//
13
// LIC// This library is distributed in the hope that it will be useful,
14
// LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
// LIC// Lesser General Public License for more details.
17
// LIC//
18
// LIC// You should have received a copy of the GNU Lesser General Public
19
// LIC// License along with this library; if not, write to the Free Software
20
// LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
// LIC// 02110-1301 USA.
22
// LIC//
23
// LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24
// LIC//
25
// LIC//====================================================================
26
#ifndef OOMPH_HORIZONTAL_SINGLE_LAYER_SPINE_MESH_TEMPLATE_HEADER
27
#define OOMPH_HORIZONTAL_SINGLE_LAYER_SPINE_MESH_TEMPLATE_HEADER
28
29
#ifndef OOMPH_HORIZONTAL_SINGLE_LAYER_SPINE_MESH_HEADER
30
#error __FILE__ should only be included from horizontal_single_layer_spine_mesh.h.
31
#endif
// OOMPH_HORIZONTAL_SINGLE_LAYER_SPINE_MESH_HEADER
32
33
#include "
rectangular_quadmesh.h
"
34
35
namespace
oomph
36
{
37
//===========================================================================
38
/// Constructor for spine 2D mesh: Pass number of elements in x-direction,
39
/// number of elements in y-direction, axial length and height of layer,
40
/// and pointer to timestepper (defaults to Static timestepper).
41
///
42
/// The mesh contains a layer of spinified fluid elements (of type ELEMENT;
43
/// e.g SpineElement<QCrouzeixRaviartElement<2>)
44
/// and information about how the internal nodes positions are affected
45
/// by changes in spine length. Additional equations that determine the
46
/// spine heights must be specified in order to use this mesh.
47
//===========================================================================
48
template
<
class
ELEMENT>
49
HorizontalSingleLayerSpineMesh<ELEMENT>::HorizontalSingleLayerSpineMesh
(
50
const
unsigned
& nx,
51
const
unsigned
& ny,
52
const
double
&
lx
,
53
const
double
&
h
,
54
TimeStepper
*
time_stepper_pt
)
55
:
RectangularQuadMesh
<
ELEMENT
>(
56
nx, ny, 0.0,
lx
, 0.0,
h
,
false
,
false
,
time_stepper_pt
)
57
{
58
// Mesh can only be built with 2D Qelements.
59
MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
60
61
// Mesh can only be built with spine elements
62
MeshChecker::assert_geometric_element<SpineFiniteElement, ELEMENT>(2);
63
64
// We've called the "generic" constructor for the RectangularQuadMesh
65
// which doesn't do much...
66
67
// Now build the mesh:
68
build_horizontal_single_layer_mesh
(
time_stepper_pt
);
69
}
70
71
//===========================================================================
72
/// Helper function that actually builds the single-layer spine mesh
73
/// based on the parameters set in the various constructors
74
//===========================================================================
75
template
<
class
ELEMENT>
76
void
HorizontalSingleLayerSpineMesh
<
77
ELEMENT
>::build_horizontal_single_layer_mesh(
TimeStepper
*
time_stepper_pt
)
78
{
79
// Build the underlying quad mesh:
80
RectangularQuadMesh<ELEMENT>::build_mesh
(
time_stepper_pt
);
81
82
// Read out the number of elements in the x-direction
83
unsigned
n_x
= this->Nx;
84
unsigned
n_y
= this->Ny;
85
86
// Allocate memory for the spines and fractions along spines
87
//---------------------------------------------------------
88
89
// Read out number of linear points in the element
90
unsigned
n_p
=
dynamic_cast<
ELEMENT
*
>
(
finite_element_pt
(0))->
nnode_1d
();
91
Spine_pt
.reserve((
n_p
- 1) *
n_y
+ 1);
92
93
// FIRST SPINE
94
// -----------
95
96
// Element 0
97
// Node 0
98
// Assign the new spine with unit length
99
Spine
*
new_spine_pt
=
new
Spine
(1.0);
100
Spine_pt
.push_back(
new_spine_pt
);
101
102
// Get pointer to node
103
SpineNode
*
nod_pt
=
element_node_pt
(0, 0);
104
// Set the pointer to the spine
105
nod_pt
->spine_pt() =
new_spine_pt
;
106
// Set the fraction
107
nod_pt
->fraction() = 0.0;
108
// Pointer to the mesh that implements the update fct
109
nod_pt
->spine_mesh_pt() =
this
;
110
111
// Loop HORIZONTAL along the spine
112
// Loop over the elements
113
for
(
unsigned
long
i
= 0;
i
<
n_x
;
i
++)
114
{
115
// Loop over the HORIZONTAL nodes, apart from the first
116
for
(
unsigned
l1
= 1;
l1
<
n_p
;
l1
++)
117
{
118
// Get pointer to node
119
// SpineNode* nod_pt=element_node_pt(i*n_y,l1*n_p);
120
121
// Get pointer to node(without reoder)
122
SpineNode
*
nod_pt
=
element_node_pt
(
i
,
l1
);
123
// Set the pointer to the spine
124
nod_pt
->spine_pt() =
new_spine_pt
;
125
// Set the fraction
126
nod_pt
->fraction() =
127
(
double
(
i
) +
double
(
l1
) /
double
(
n_p
- 1)) /
double
(
n_x
);
128
// Pointer to the mesh that implements the update fct
129
nod_pt
->spine_mesh_pt() =
this
;
130
}
131
}
132
133
// LOOP OVER OTHER SPINES
134
// ----------------------
135
136
// Now loop over the elements VERTICALLY
137
for
(
unsigned
long
j
= 0;
j
<
n_y
;
j
++)
138
{
139
// Loop over the nodes in the elements horizontally, ignoring
140
// the first row
141
142
// Last spine needs special treatment in x-periodic meshes:
143
unsigned
n_pmax
=
n_p
;
144
145
for
(
unsigned
l2
= 1;
l2
<
n_pmax
;
l2
++)
146
{
147
// Assign the new spine with unit height
148
new_spine_pt
=
new
Spine
(1.0);
149
Spine_pt
.push_back(
new_spine_pt
);
150
151
// Get the node
152
// SpineNode* nod_pt=element_node_pt(j,l2);
153
154
// Get the node (without reorder)
155
SpineNode
*
nod_pt
=
element_node_pt
(
j
*
n_x
,
l2
*
n_p
);
156
// Set the pointer to spine
157
nod_pt
->spine_pt() =
new_spine_pt
;
158
// Set the fraction
159
nod_pt
->fraction() = 0.0;
160
// Pointer to the mesh that implements the update fct
161
nod_pt
->spine_mesh_pt() =
this
;
162
163
// Loop HORIZONTALLY along the spine
164
// Loop over the elements
165
for
(
unsigned
long
i
= 0;
i
<
n_x
;
i
++)
166
{
167
// Loop over the HORIZONTAL nodes, apart from the first
168
for
(
unsigned
l1
= 1;
l1
<
n_p
;
l1
++)
169
{
170
// Get the node
171
// SpineNode* nod_pt=element_node_pt(i*n_y+j,l1*n_p+l2);
172
173
// Get the node (without reorder)
174
SpineNode
*
nod_pt
=
element_node_pt
(
j
*
n_x
+
i
,
l2
*
n_p
+
l1
);
175
// Set the pointer to the spine
176
nod_pt
->spine_pt() =
new_spine_pt
;
177
// Set the fraction
178
nod_pt
->fraction() =
179
(
double
(
i
) +
double
(
l1
) /
double
(
n_p
- 1)) /
double
(
n_x
);
180
// Pointer to the mesh that implements the update fct
181
nod_pt
->spine_mesh_pt() =
this
;
182
}
183
}
184
}
185
}
186
}
187
188
}
// namespace oomph
189
#endif
oomph::HorizontalSingleLayerSpineMesh
Horizontal Single-layer spine mesh class derived from standard 2D mesh. The mesh contains a layer of ...
Definition
horizontal_single_layer_spine_mesh.h:47
oomph::HorizontalSingleLayerSpineMesh::HorizontalSingleLayerSpineMesh
HorizontalSingleLayerSpineMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &h, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in x-direction, number of elements in y-direction,...
Definition
horizontal_single_layer_spine_mesh.template.cc:49
oomph::HorizontalSingleLayerSpineMesh::build_horizontal_single_layer_mesh
virtual void build_horizontal_single_layer_mesh(TimeStepper *time_stepper_pt)
Helper function to actually build the single-layer spine mesh (called from various constructors)
Definition
horizontal_single_layer_spine_mesh.template.cc:77
oomph::RectangularQuadMesh
RectangularQuadMesh is a two-dimensional mesh of Quad elements with Nx elements in the "x" (horizonal...
Definition
rectangular_quadmesh.h:59
oomph::RectangularQuadMesh::build_mesh
void build_mesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Generic mesh construction function: contains all the hard work.
Definition
rectangular_quadmesh.template.cc:44
oomph::SimpleRectangularQuadMesh
Simple rectangular 2D Quad mesh class. Nx : number of elements in the x direction.
Definition
simple_rectangular_quadmesh.h:58
oomph
Definition
annular_domain.h:35
rectangular_quadmesh.h