quarter_pipe_mesh.h
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-2025 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// Include guards
27#ifndef OOMPH_QUARTER_PIPE_MESH_TEMPLATE_HEADER
28#define OOMPH_QUARTER_PIPE_MESH_TEMPLATE_HEADER
29
30// Generic oomph-lib includes
31#include "generic/mesh.h"
32#include "generic/brick_mesh.h"
34#include "simple_cubic_mesh.h"
35#include "quarter_pipe_domain.h"
36
38#include "generic/domain.h"
39
40namespace oomph
41{
42 //================================================================
43 /// Non refineable quarter pipe mesh class
44 /// Deform a simple cubic mesh into a quarter pipe
45 /// r: radial direction
46 /// theta: azimuthal direction
47 /// z: axis direction
48 //================================================================
49 template<class ELEMENT>
50 class QuarterPipeMesh : public virtual SimpleCubicMesh<ELEMENT>
51 {
52 public:
53 /// Constructor: Pass number of elements in various directions,
54 /// the inner and outer radius and the length of the tube
55 QuarterPipeMesh(const unsigned& ntheta,
56 const unsigned& nr,
57 const unsigned& nz,
58 const double& rmin,
59 const double& rmax,
60 const double& length,
61 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
62
63 /// Empty Destructor
65 {
66 delete Domain_pt;
67 }
68
69 /// Access function to domain
71 {
72 return Domain_pt;
73 }
74
75 /// Access function to underlying domain
77 {
78 return Domain_pt;
79 }
80
81 protected:
82 /// Number of elements azimuthal direction
83 unsigned Ntheta;
84
85 /// Number of elements radial direction
86 unsigned Nr;
87
88 /// Number of elements axial direction
89 unsigned Nz;
90
91 /// Inner radius
92 double Rmin;
93
94 /// Outer radius
95 double Rmax;
96
97 /// Length
98 double Length;
99
100 /// Pointer to domain
102
103 }; // endofclass
104
105
106 //////////////////////////////////////////////////////////////////////////
107 //////////////////////////////////////////////////////////////////////////
108 //////////////////////////////////////////////////////////////////////////
109
110 //================================================================
111 /// Refineable quarter pipe mesh class
112 //================================================================
113 template<class ELEMENT>
114 class RefineableQuarterPipeMesh : public virtual QuarterPipeMesh<ELEMENT>,
115 public RefineableBrickMesh<ELEMENT>
116 {
117 public:
118 /// Constructor: Pass number of elements in various directions,
119 /// the inner and outer radius and the length of the tube
121 const unsigned& ntheta,
122 const unsigned& nr,
123 const unsigned& nz,
124 const double& rmin,
125 const double& rmax,
126 const double& length,
127 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
128 : SimpleCubicMesh<ELEMENT>(
129 ntheta, nr, nz, 1.0, 1.0, 1.0, time_stepper_pt),
130 QuarterPipeMesh<ELEMENT>(
131 ntheta, nr, nz, rmin, rmax, length, time_stepper_pt)
132 {
133 // Setup Octree forest: Turn elements into individual octrees
134 // and plant in forest
136 for (unsigned iel = 0; iel < (nr * ntheta * nz); iel++)
137 {
139 ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(el_pt);
141 trees_pt.push_back(octree_root_pt);
142 }
143
144 this->Forest_pt = new OcTreeForest(trees_pt);
145 }
146
147 /// Destructor -- delete forest
149 {
150 delete this->Forest_pt;
151 }
152
153 }; // endofclass
154
155
156 //////////////////////////////////////////////////////////////////////////
157 //////////////////////////////////////////////////////////////////////////
158 //////////////////////////////////////////////////////////////////////////
159
160 //================================================================
161 /// Non refineable elastic quarter pipe mesh class
162 /// setup lagrangian coordinates for solid mechanics problems
163 //================================================================
164 template<class ELEMENT>
165 class ElasticQuarterPipeMesh : public virtual QuarterPipeMesh<ELEMENT>,
166 public virtual SolidMesh
167 {
168 public:
169 /// Constructor: Pass number of elements in various directions,
170 /// the inner and outer radius and the length of the tube.
171 /// Builds mesh and copies Eulerian coords to Lagrangian
172 /// ones so that the initial configuration is the stress-free one.
174 const unsigned& ntheta,
175 const unsigned& nr,
176 const unsigned& nz,
177 const double& rmin,
178 const double& rmax,
179 const double& length,
180 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
181 : SimpleCubicMesh<ELEMENT>(
182 ntheta, nr, nz, 1.0, 1.0, 1.0, time_stepper_pt),
183 QuarterPipeMesh<ELEMENT>(
184 ntheta, nr, nz, rmin, rmax, length, time_stepper_pt)
185 {
186 /// Make the current configuration the undeformed one by
187 /// setting the nodal Lagrangian coordinates to their current
188 /// Eulerian ones
190 }
191 };
192
193
194 //////////////////////////////////////////////////////////////////////////
195 //////////////////////////////////////////////////////////////////////////
196 //////////////////////////////////////////////////////////////////////////
197
198 //================================================================
199 /// Refineable elastic quarter pipe mesh class
200 //================================================================
201 template<class ELEMENT>
203 : public virtual ElasticQuarterPipeMesh<ELEMENT>,
204 public RefineableBrickMesh<ELEMENT>
205 {
206 public:
207 /// Constructor: Pass number of elements in various directions,
208 /// the inner and outer radius and the length of the tube.
209 /// Builds mesh and copies Eulerian coords to Lagrangian
210 /// ones so that the initial configuration is the stress-free one.
212 const unsigned& ntheta,
213 const unsigned& nr,
214 const unsigned& nz,
215 const double& rmin,
216 const double& rmax,
217 const double& length,
218 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
219 : SimpleCubicMesh<ELEMENT>(
220 ntheta, nr, nz, 1.0, 1.0, 1.0, time_stepper_pt),
221 QuarterPipeMesh<ELEMENT>(
222 ntheta, nr, nz, rmin, rmax, length, time_stepper_pt),
223 ElasticQuarterPipeMesh<ELEMENT>(
224 ntheta, nr, nz, rmin, rmax, length, time_stepper_pt)
225 {
226 // Setup Octree forest: Turn elements into individual octrees
227 // and plant in forest
229 for (unsigned iel = 0; iel < (nr * ntheta * nz); iel++)
230 {
232 ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(el_pt);
234 trees_pt.push_back(octree_root_pt);
235 }
236 this->Forest_pt = new OcTreeForest(trees_pt);
237
238 // Loop over all elements and set the undeformed macro element pointer
239 unsigned n_element = this->nelement();
240 for (unsigned e = 0; e < n_element; e++)
241 {
242 // Get pointer to full element type
243 ELEMENT* el_pt = dynamic_cast<ELEMENT*>(this->element_pt(e));
244
245 // Set pointer to macro element so the curvlinear boundaries
246 // of the undeformed mesh/domain get picked up during adaptive
247 // mesh refinement
248 el_pt->set_undeformed_macro_elem_pt(
250
251 // Use MacroElement representation for
252 // Lagrangian coordinates of newly created
253 // nodes
254 el_pt
255 ->enable_use_of_undeformed_macro_element_for_new_lagrangian_coords();
256 }
257 }
258 };
259
260} // namespace oomph
261
263#endif
e
Definition cfortran.h:571
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition domain.h:116
Non refineable elastic quarter pipe mesh class setup lagrangian coordinates for solid mechanics probl...
ElasticQuarterPipeMesh(const unsigned &ntheta, const unsigned &nr, const unsigned &nz, const double &rmin, const double &rmax, const double &length, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in various directions, the inner and outer radius and the length...
Refineable elastic quarter pipe mesh class.
ElasticRefineableQuarterPipeMesh(const unsigned &ntheta, const unsigned &nr, const unsigned &nz, const double &rmin, const double &rmax, const double &length, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in various directions, the inner and outer radius and the length...
A general Finite Element class.
Definition elements.h:1317
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
Definition mesh.h:75
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
Definition mesh.h:477
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition mesh.h:464
unsigned long nelement() const
Return number of elements in the mesh.
Definition mesh.h:598
An OcTreeForest consists of a collection of OcTreeRoots. Each member tree can have neighbours to its ...
Definition octree.h:928
OcTreeRoot is a OcTree that forms the root of a (recursive) octree. The "root node" is special as it ...
Definition octree.h:611
Domain representing a quarter pipe.
Non refineable quarter pipe mesh class Deform a simple cubic mesh into a quarter pipe r: radial direc...
QuarterPipeDomain * domain_pt()
Access function to domain.
QuarterPipeDomain * Domain_pt
Pointer to domain.
unsigned Nz
Number of elements axial direction.
virtual ~QuarterPipeMesh()
Empty Destructor.
QuarterPipeDomain * domain_pt() const
Access function to underlying domain.
unsigned Nr
Number of elements radial direction.
double Rmin
Inner radius.
unsigned Ntheta
Number of elements azimuthal direction.
double Rmax
Outer radius.
Intermediate mesh class that implements the mesh adaptation functions specified in the TreeBasedRefin...
Refineable quarter pipe mesh class.
RefineableQuarterPipeMesh(const unsigned &ntheta, const unsigned &nr, const unsigned &nz, const double &rmin, const double &rmax, const double &length, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in various directions, the inner and outer radius and the length...
virtual ~RefineableQuarterPipeMesh()
Destructor – delete forest.
Simple cubic 3D Brick mesh class.
const unsigned & nz() const
Access function for number of elements in y directions.
General SolidMesh class.
Definition mesh.h:2570
void set_lagrangian_nodal_coordinates()
Make the current configuration the undeformed one by setting the nodal Lagrangian coordinates to thei...
Definition mesh.cc:9564
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
TreeForest * Forest_pt
Forest representation of the mesh.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).