tube_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 #ifndef OOMPH_TUBE_MESH_HEADER
31 #define OOMPH_TUBE_MESH_HEADER
32 
33 // Headers
34 #include "../generic/refineable_brick_mesh.h"
35 #include "../generic/macro_element.h"
36 #include "../generic/domain.h"
37 #include "../generic/algebraic_elements.h"
38 #include "../generic/brick_mesh.h"
39 #include "../generic/macro_element_node_update_element.h"
40 
41 
42 //Include the headers file for domain
43 #include "tube_domain.h"
44 
45 namespace oomph
46 {
47 
48 
49 //====================================================================
50 /// \short 3D tube mesh class.
51 /// The domain is specified by the GeomObject that identifies
52 /// the entire volume. Non-refineable base version!
53 ///
54 /// The mesh boundaries are numbered as follows:
55 /// - Boundary 0: "Inflow" cross section; located along the
56 /// line parametrised by \f$ \xi_0 = \xi_0^{lo} \f$.
57 /// - Boundary 1: The outer wall, represetned by \f$\xi_2 = 1\f$.
58 /// - Boundary 2: The out flow, represented by \f$\xi_0 = \xi_0^{hi}\f$.
59 ///
60 //====================================================================
61 template <class ELEMENT>
62 class TubeMesh : public virtual BrickMeshBase
63 {
64 
65 public:
66 
67  /// \short Constructor: Pass pointer to geometric object that
68  /// specifies the volume, start and end coordinates for the centreline
69  /// on the geometric object. Values of theta at which dividing lines
70  /// are to be placed, fractions of the radius for the central box
71  /// at the dividing lines, the number of layers
72  /// and the timestepper.
73  /// Timestepper defaults to Steady dummy timestepper.
74  TubeMesh(GeomObject* wall_pt,
75  const Vector<double> &centreline_limits,
76  const Vector<double> &theta_positions,
77  const Vector<double> &radius_box,
78  const unsigned& nlayer,
79  TimeStepper* time_stepper_pt=
81 
82  /// \short Destructor: empty
83  virtual ~TubeMesh()
84  {
85  delete Domain_pt;
86  }
87 
88  /// Access function to GeomObject representing wall
90 
91  /// Access function to domain
93 
94  /// Access function to underlying domain
95  TubeDomain* domain_pt() const {return Domain_pt;}
96 
97 protected:
98 
99  /// Pointer to domain
101 
102  /// Pointer to the geometric object that represents the curved wall
104 
105 };
106 
107 
108 
109 
110 ////////////////////////////////////////////////////////////////////
111 ////////////////////////////////////////////////////////////////////
112 ////////////////////////////////////////////////////////////////////
113 
114 
115 
116 
117 
118 //=============================================================
119 /// Adaptative version of the TubeMesh base mesh.
120 /// The domain is specified by the GeomObject that identifies
121 /// the entire volume
122 ///
123 /// The mesh boundaries are numbered as follows:
124 /// - Boundary 0: "Inflow" cross section; located along the
125 /// line parametrised by \f$ \xi_0 = \xi_0^{lo} \f$.
126 /// - Boundary 1: The outer wall, represetned by \f$\xi_2 = 1\f$.
127 /// - Boundary 2: The out flow, represented by \f$\xi_0 = \xi_0^{hi}\f$.
128 ///
129 //=============================================================
130 template<class ELEMENT>
131 class RefineableTubeMesh : public TubeMesh<ELEMENT>,
132  public RefineableBrickMesh<ELEMENT>
133 
134 {
135 
136 public :
137 
138 /// \short Constructor for adaptive deformable quarter tube mesh class.
139 /// Pass pointer to geometric object that
140 /// specifies the volume, start and end coordinates for the centreline
141 /// on the geometric object. Values of theta at which dividing lines
142 /// are to be placed, fractions of the radius for the central box
143 /// at the dividing lines, the number of layers
144 /// and the timestepper.
145 /// Timestepper defaults to Steady dummy timestepper.
147  const Vector<double> &centreline_limits,
148  const Vector<double> &theta_positions,
149  const Vector<double> &radius_box,
150  const unsigned& nlayer,
151  TimeStepper* time_stepper_pt=
153  TubeMesh<ELEMENT>(wall_pt,centreline_limits,theta_positions,
154  radius_box,
155  nlayer,time_stepper_pt)
156  {
157  // Loop over all elements and set macro element pointer
158  for (unsigned ielem=0;ielem<TubeMesh<ELEMENT>::nelement();ielem++)
159  {
160  dynamic_cast<RefineableQElement<3>*>(
162  set_macro_elem_pt(this->Domain_pt->macro_element_pt(ielem));
163  }
164 
165 
166  // Setup Octree forest: Turn elements into individual octrees
167  // and plant in forest
168  Vector<TreeRoot*> trees_pt;
169  for (unsigned iel=0;iel<TubeMesh<ELEMENT>::nelement();iel++)
170  {
172  ELEMENT* ref_el_pt=dynamic_cast<ELEMENT*>(el_pt);
173  OcTreeRoot* octree_root_pt=new OcTreeRoot(ref_el_pt);
174  trees_pt.push_back(octree_root_pt);
175  }
176  this->Forest_pt = new OcTreeForest(trees_pt);
177 
178 #ifdef PARANOID
179  // Run self test
180  unsigned success_flag=
181  dynamic_cast<OcTreeForest*>(this->Forest_pt)->self_test();
182  if (success_flag==0)
183  {
184  oomph_info << "Successfully built octree forest " << std::endl;
185  }
186  else
187  {
188  throw OomphLibError(
189  "Trouble in building octree forest ",
190  OOMPH_CURRENT_FUNCTION,
191  OOMPH_EXCEPTION_LOCATION);
192  }
193 #endif
194 
195  }
196 
197  /// \short Destructor: empty
199 
200 };
201 
202 }
203 #endif
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors. ...
Definition: mesh.h:85
TubeMesh(GeomObject *wall_pt, const Vector< double > &centreline_limits, const Vector< double > &theta_positions, const Vector< double > &radius_box, const unsigned &nlayer, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to geometric object that specifies the volume, start and end coordinates fo...
Base class for brick meshes (meshes made of 3D brick elements).
Definition: brick_mesh.h:197
RefineableTubeMesh(GeomObject *wall_pt, const Vector< double > &centreline_limits, const Vector< double > &theta_positions, const Vector< double > &radius_box, const unsigned &nlayer, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor for adaptive deformable quarter tube mesh class. Pass pointer to geometric object that sp...
A general Finite Element class.
Definition: elements.h:1274
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:100
unsigned self_test()
Self-test: Check elements and nodes. Return 0 for OK.
Definition: mesh.cc:715
OomphInfo oomph_info
TubeDomain * domain_pt()
Access function to domain.
TubeDomain * domain_pt() const
Access function to underlying domain.
Tube as a domain. The entire domain must be defined by a GeomObject with the following convention: ze...
Definition: tube_domain.h:74
virtual ~RefineableTubeMesh()
Destructor: empty.
GeomObject * Volume_pt
Pointer to the geometric object that represents the curved wall.
TubeDomain * Domain_pt
Pointer to domain.
GeomObject *& volume_pt()
Access function to GeomObject representing wall.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
Definition: mesh.h:477
virtual ~TubeMesh()
Destructor: empty.
3D tube mesh class. The domain is specified by the GeomObject that identifies the entire volume...
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:470
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Definition: timesteppers.h:219