quarter_pipe_mesh.template.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-2023 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"
33 #include "../generic/refineable_brick_mesh.h"
36 #include "quarter_pipe_domain.h"
37 
38 #include "../generic/macro_element.h"
39 #include "../generic/domain.h"
40 
41 
42 namespace oomph
43 {
44  //================================================================
45  /// Non refineable quarter pipe mesh class
46  /// Deform a simple cubic mesh into a quarter pipe
47  /// r: radial direction
48  /// theta: azimuthal direction
49  /// z: axis direction
50  //================================================================
51  template<class ELEMENT>
52  class QuarterPipeMesh : public virtual SimpleCubicMesh<ELEMENT>
53  {
54  public:
55  /// Constructor: Pass number of elements in various directions,
56  /// the inner and outer radius and the length of the tube
57  QuarterPipeMesh(const unsigned& ntheta,
58  const unsigned& nr,
59  const unsigned& nz,
60  const double& rmin,
61  const double& rmax,
62  const double& length,
63  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
64 
65 
66  /// Empty Destructor
67  virtual ~QuarterPipeMesh()
68  {
69  delete Domain_pt;
70  }
71 
72  /// Access function to domain
74  {
75  return Domain_pt;
76  }
77 
78  /// Access function to underlying domain
80  {
81  return Domain_pt;
82  }
83 
84  protected:
85  /// Number of elements azimuthal direction
86  unsigned Ntheta;
87 
88  /// Number of elements radial direction
89  unsigned Nr;
90 
91  /// Number of elements axial direction
92  unsigned Nz;
93 
94  /// Inner radius
95  double Rmin;
96 
97  /// Outer radius
98  double Rmax;
99 
100  /// Length
101  double Length;
102 
103  /// Pointer to domain
105 
106  }; // endofclass
107 
108 
109  /// ///////////////////////////////////////////////////////////////////////
110  /// ///////////////////////////////////////////////////////////////////////
111  /// ///////////////////////////////////////////////////////////////////////
112 
113 
114  //================================================================
115  /// Refineable quarter pipe mesh class
116  //================================================================
117  template<class ELEMENT>
118  class RefineableQuarterPipeMesh : public virtual QuarterPipeMesh<ELEMENT>,
119  public RefineableBrickMesh<ELEMENT>
120  {
121  public:
122  /// Constructor: Pass number of elements in various directions,
123  /// the inner and outer radius and the length of the tube
125  const unsigned& ntheta,
126  const unsigned& nr,
127  const unsigned& nz,
128  const double& rmin,
129  const double& rmax,
130  const double& length,
131  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
132  : SimpleCubicMesh<ELEMENT>(
133  ntheta, nr, nz, 1.0, 1.0, 1.0, time_stepper_pt),
134  QuarterPipeMesh<ELEMENT>(
135  ntheta, nr, nz, rmin, rmax, length, time_stepper_pt)
136  {
137  // Setup Octree forest: Turn elements into individual octrees
138  // and plant in forest
139  Vector<TreeRoot*> trees_pt;
140  for (unsigned iel = 0; iel < (nr * ntheta * nz); iel++)
141  {
143  ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(el_pt);
144  OcTreeRoot* octree_root_pt = new OcTreeRoot(ref_el_pt);
145  trees_pt.push_back(octree_root_pt);
146  }
147 
148  this->Forest_pt = new OcTreeForest(trees_pt);
149  }
150 
151 
152  /// Destructor -- delete forest
154  {
155  delete this->Forest_pt;
156  }
157 
158  }; // endofclass
159 
160 
161  /// ///////////////////////////////////////////////////////////////////////
162  /// ///////////////////////////////////////////////////////////////////////
163  /// ///////////////////////////////////////////////////////////////////////
164 
165 
166  //================================================================
167  /// Non refineable elastic quarter pipe mesh class
168  /// setup lagrangian coordinates for solid mechanics problems
169  //================================================================
170  template<class ELEMENT>
171  class ElasticQuarterPipeMesh : public virtual QuarterPipeMesh<ELEMENT>,
172  public virtual SolidMesh
173  {
174  public:
175  /// Constructor: Pass number of elements in various directions,
176  /// the inner and outer radius and the length of the tube.
177  /// Builds mesh and copies Eulerian coords to Lagrangian
178  /// ones so that the initial configuration is the stress-free one.
180  const unsigned& ntheta,
181  const unsigned& nr,
182  const unsigned& nz,
183  const double& rmin,
184  const double& rmax,
185  const double& length,
186  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
187  : SimpleCubicMesh<ELEMENT>(
188  ntheta, nr, nz, 1.0, 1.0, 1.0, time_stepper_pt),
189  QuarterPipeMesh<ELEMENT>(
190  ntheta, nr, nz, rmin, rmax, length, time_stepper_pt)
191  {
192  /// Make the current configuration the undeformed one by
193  /// setting the nodal Lagrangian coordinates to their current
194  /// Eulerian ones
196  }
197  };
198 
199 
200  /// ///////////////////////////////////////////////////////////////////////
201  /// ///////////////////////////////////////////////////////////////////////
202  /// ///////////////////////////////////////////////////////////////////////
203 
204 
205  //================================================================
206  /// Refineable elastic quarter pipe mesh class
207  //================================================================
208  template<class ELEMENT>
210  : public virtual ElasticQuarterPipeMesh<ELEMENT>,
211  public RefineableBrickMesh<ELEMENT>
212  {
213  public:
214  /// Constructor: Pass number of elements in various directions,
215  /// the inner and outer radius and the length of the tube.
216  /// Builds mesh and copies Eulerian coords to Lagrangian
217  /// ones so that the initial configuration is the stress-free one.
219  const unsigned& ntheta,
220  const unsigned& nr,
221  const unsigned& nz,
222  const double& rmin,
223  const double& rmax,
224  const double& length,
225  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
226  : SimpleCubicMesh<ELEMENT>(
227  ntheta, nr, nz, 1.0, 1.0, 1.0, time_stepper_pt),
228  QuarterPipeMesh<ELEMENT>(
229  ntheta, nr, nz, rmin, rmax, length, time_stepper_pt),
230  ElasticQuarterPipeMesh<ELEMENT>(
231  ntheta, nr, nz, rmin, rmax, length, time_stepper_pt)
232  {
233  // Setup Octree forest: Turn elements into individual octrees
234  // and plant in forest
235  Vector<TreeRoot*> trees_pt;
236  for (unsigned iel = 0; iel < (nr * ntheta * nz); iel++)
237  {
239  ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(el_pt);
240  OcTreeRoot* octree_root_pt = new OcTreeRoot(ref_el_pt);
241  trees_pt.push_back(octree_root_pt);
242  }
243  this->Forest_pt = new OcTreeForest(trees_pt);
244 
245  // Loop over all elements and set the undeformed macro element pointer
246  unsigned n_element = this->nelement();
247  for (unsigned e = 0; e < n_element; e++)
248  {
249  // Get pointer to full element type
250  ELEMENT* el_pt = dynamic_cast<ELEMENT*>(this->element_pt(e));
251 
252  // Set pointer to macro element so the curvlinear boundaries
253  // of the undeformed mesh/domain get picked up during adaptive
254  // mesh refinement
255  el_pt->set_undeformed_macro_elem_pt(
256  this->Domain_pt->macro_element_pt(e));
257 
258  // Use MacroElement representation for
259  // Lagrangian coordinates of newly created
260  // nodes
261  el_pt
262  ->enable_use_of_undeformed_macro_element_for_new_lagrangian_coords();
263  }
264  }
265  };
266 
267 
268 } // namespace oomph
269 
270 
271 #endif
e
Definition: cfortran.h:571
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:116
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
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...
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
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:1313
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:473
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:460
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
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
Pointer to domain.
unsigned Nz
Number of elements axial direction.
QuarterPipeMesh(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 ~QuarterPipeMesh()
Empty Destructor.
unsigned Nr
Number of elements radial direction.
QuarterPipeDomain * domain_pt()
Access function to domain.
unsigned Ntheta
Number of elements azimuthal direction.
QuarterPipeDomain * domain_pt() const
Access function to underlying domain.
Intermediate mesh class that implements the mesh adaptation functions specified in the TreeBasedRefin...
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
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:2562
void set_lagrangian_nodal_coordinates()
Make the current configuration the undeformed one by setting the nodal Lagrangian coordinates to thei...
Definition: mesh.cc:9564
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Definition: timesteppers.h:231
TreeForest * Forest_pt
Forest representation of the mesh.
A slight extension to the standard template vector class so that we can include "graceful" array rang...
Definition: Vector.h:58
//////////////////////////////////////////////////////////////////// ////////////////////////////////...