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// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 //Include guards
31 #ifndef OOMPH_QUARTER_PIPE_MESH_TEMPLATE_HEADER
32 #define OOMPH_QUARTER_PIPE_MESH_TEMPLATE_HEADER
33 
34 // Generic oomph-lib includes
35 #include "../generic/mesh.h"
36 #include "../generic/brick_mesh.h"
37 #include "../generic/refineable_brick_mesh.h"
40 #include "quarter_pipe_domain.h"
41 
42 #include "../generic/macro_element.h"
43 #include "../generic/domain.h"
44 
45 
46 namespace oomph
47 {
48 
49 
50 
51 //================================================================
52 /// Non refineable quarter pipe mesh class
53 /// Deform a simple cubic mesh into a quarter pipe
54 /// r: radial direction
55 /// theta: azimuthal direction
56 /// z: axis direction
57 //================================================================
58 template <class ELEMENT>
59 class QuarterPipeMesh : public virtual SimpleCubicMesh<ELEMENT>
60 {
61 
62 public :
63 
64  /// \short Constructor: Pass number of elements in various directions,
65  /// the inner and outer radius and the length of the tube
67  const unsigned &ntheta, const unsigned &nr, const unsigned &nz,
68  const double &rmin, const double &rmax,
69  const double &length,
70  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper);
71 
72 
73  /// Empty Destructor
74  virtual ~QuarterPipeMesh()
75  {
76  delete Domain_pt;
77  }
78 
79  /// Access function to domain
81 
82  /// Access function to underlying domain
84 
85 protected:
86 
87  /// Number of elements azimuthal direction
88  unsigned Ntheta;
89 
90  /// Number of elements radial direction
91  unsigned Nr;
92 
93  /// Number of elements axial direction
94  unsigned Nz;
95 
96  /// Inner radius
97  double Rmin;
98 
99  /// Outer radius
100  double Rmax;
101 
102  /// Length
103  double Length;
104 
105  /// Pointer to domain
107 
108 }; //endofclass
109 
110 
111 
112 //////////////////////////////////////////////////////////////////////////
113 //////////////////////////////////////////////////////////////////////////
114 //////////////////////////////////////////////////////////////////////////
115 
116 
117 
118 //================================================================
119 /// Refineable quarter pipe mesh class
120 //================================================================
121  template <class ELEMENT>
123 public virtual QuarterPipeMesh<ELEMENT>,
124  public RefineableBrickMesh<ELEMENT>
125  {
126 
127  public :
128 
129  /// \short Constructor: Pass number of elements in various directions,
130  /// the inner and outer radius and the length of the tube
132  const unsigned &ntheta, const unsigned &nr, const unsigned &nz,
133  const double &rmin, const double &rmax, const double &length,
134  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
135  SimpleCubicMesh<ELEMENT>(ntheta,nr,nz,1.0,1.0,1.0,time_stepper_pt),
136  QuarterPipeMesh<ELEMENT>(ntheta,nr,nz,rmin,rmax,length,time_stepper_pt)
137  {
138 
139  // Setup Octree forest: Turn elements into individual octrees
140  // and plant in forest
141  Vector<TreeRoot*> trees_pt;
142  for (unsigned iel=0;iel<(nr*ntheta*nz);iel++)
143  {
144  FiniteElement* el_pt=QuarterPipeMesh<ELEMENT>::finite_element_pt(iel);
145  ELEMENT* ref_el_pt=dynamic_cast<ELEMENT*>(el_pt);
146  OcTreeRoot* octree_root_pt=new OcTreeRoot(ref_el_pt);
147  trees_pt.push_back(octree_root_pt);
148  }
149 
150  this->Forest_pt = new OcTreeForest(trees_pt);
151  }
152 
153 
154  /// Destructor -- delete forest
156  {
157  delete this->Forest_pt;
158  }
159 
160  }; //endofclass
161 
162 
163 
164 //////////////////////////////////////////////////////////////////////////
165 //////////////////////////////////////////////////////////////////////////
166 //////////////////////////////////////////////////////////////////////////
167 
168 
169 
170 //================================================================
171 /// Non refineable elastic quarter pipe mesh class
172 /// setup lagrangian coordinates for solid mechanics problems
173 //================================================================
174 template <class ELEMENT>
176 public virtual QuarterPipeMesh<ELEMENT>,
177 public virtual SolidMesh
178 {
179 
180 
181 public:
182 
183  /// \short Constructor: Pass number of elements in various directions,
184  /// the inner and outer radius and the length of the tube.
185  /// Builds mesh and copies Eulerian coords to Lagrangian
186  /// ones so that the initial configuration is the stress-free one.
187  ElasticQuarterPipeMesh(const unsigned &ntheta, const unsigned &nr,
188  const unsigned &nz, const double &rmin,
189  const double &rmax, const double &length,
190  TimeStepper* time_stepper_pt=
191  &Mesh::Default_TimeStepper) :
192  SimpleCubicMesh<ELEMENT>(ntheta,nr,nz,1.0,1.0,1.0,time_stepper_pt),
193  QuarterPipeMesh<ELEMENT>(ntheta,nr,nz,rmin,rmax,length,time_stepper_pt)
194  {
195  /// Make the current configuration the undeformed one by
196  /// setting the nodal Lagrangian coordinates to their current
197  /// Eulerian ones
198  set_lagrangian_nodal_coordinates();
199  }
200 
201 };
202 
203 
204 
205 //////////////////////////////////////////////////////////////////////////
206 //////////////////////////////////////////////////////////////////////////
207 //////////////////////////////////////////////////////////////////////////
208 
209 
210 
211 //================================================================
212 /// Refineable elastic quarter pipe mesh class
213 //================================================================
214 template <class ELEMENT>
216 public virtual ElasticQuarterPipeMesh<ELEMENT>,
217 public RefineableBrickMesh<ELEMENT>
218 {
219 
220 public:
221 
222  /// \short Constructor: Pass number of elements in various directions,
223  /// the inner and outer radius and the length of the tube.
224  /// Builds mesh and copies Eulerian coords to Lagrangian
225  /// ones so that the initial configuration is the stress-free one.
226  ElasticRefineableQuarterPipeMesh(const unsigned &ntheta, const unsigned &nr,
227  const unsigned &nz, const double &rmin,
228  const double &rmax, const double &length,
229  TimeStepper* time_stepper_pt=
230  &Mesh::Default_TimeStepper) :
231  SimpleCubicMesh<ELEMENT>(ntheta,nr,nz,1.0,1.0,1.0,time_stepper_pt),
232  QuarterPipeMesh<ELEMENT>(ntheta,nr,nz,rmin,rmax,length,time_stepper_pt),
233  ElasticQuarterPipeMesh<ELEMENT>(ntheta,nr,nz,rmin,rmax,length,
234  time_stepper_pt)
235  {
236  // Setup Octree forest: Turn elements into individual octrees
237  // and plant in forest
238  Vector<TreeRoot*> trees_pt;
239  for (unsigned iel=0;iel<(nr*ntheta*nz);iel++)
240  {
241  FiniteElement* el_pt=QuarterPipeMesh<ELEMENT>::finite_element_pt(iel);
242  ELEMENT* ref_el_pt=dynamic_cast<ELEMENT*>(el_pt);
243  OcTreeRoot* octree_root_pt=new OcTreeRoot(ref_el_pt);
244  trees_pt.push_back(octree_root_pt);
245  }
246  this->Forest_pt = new OcTreeForest(trees_pt);
247 
248  // Loop over all elements and set the undeformed macro element pointer
249  unsigned n_element=this->nelement();
250  for (unsigned e=0;e<n_element;e++)
251  {
252  // Get pointer to full element type
253  ELEMENT* el_pt=dynamic_cast<ELEMENT*>(this->element_pt(e));
254 
255  // Set pointer to macro element so the curvlinear boundaries
256  // of the undeformed mesh/domain get picked up during adaptive
257  // mesh refinement
258  el_pt->set_undeformed_macro_elem_pt(this->
259  Domain_pt->macro_element_pt(e));
260 
261  // Use MacroElement representation for
262  // Lagrangian coordinates of newly created
263  // nodes
264  el_pt->enable_use_of_undeformed_macro_element_for_new_lagrangian_coords();
265  }
266 
267 
268  }
269 };
270 
271 
272 } //endofnamespace
273 
274 
275 
276 #endif
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...
const unsigned & nz() const
Access function for number of elements in y directions.
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...
Simple cubic 3D Brick mesh class.
QuarterPipeDomain * domain_pt() const
Access function to underlying domain.
Refineable elastic quarter pipe mesh class.
QuarterPipeDomain * Domain_pt
Pointer to domain.
QuarterPipeDomain * domain_pt()
Access function to domain.
unsigned Nz
Number of elements axial direction.
unsigned Nr
Number of elements radial direction.
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...
Domain representing a quarter pipe.
virtual ~QuarterPipeMesh()
Empty Destructor.
unsigned Ntheta
Number of elements azimuthal direction.
virtual ~RefineableQuarterPipeMesh()
Destructor – delete forest.