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