tube_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#ifndef OOMPH_TUBE_MESH_HEADER
27#define OOMPH_TUBE_MESH_HEADER
28
29// Headers
32#include "generic/domain.h"
34#include "generic/brick_mesh.h"
36
37// Include the headers file for domain
38#include "tube_domain.h"
39
40namespace oomph
41{
42 //====================================================================
43 /// 3D tube mesh class.
44 /// The domain is specified by the GeomObject that identifies
45 /// the entire volume. Non-refineable base version!
46 ///
47 /// The mesh boundaries are numbered as follows:
48 /// - Boundary 0: "Inflow" cross section; located along the
49 /// line parametrised by \f$ \xi_0 = \xi_0^{lo} \f$.
50 /// - Boundary 1: The outer wall, represetned by \f$\xi_2 = 1\f$.
51 /// - Boundary 2: The out flow, represented by \f$\xi_0 = \xi_0^{hi}\f$.
52 ///
53 //====================================================================
54 template<class ELEMENT>
55 class TubeMesh : public virtual BrickMeshBase
56 {
57 public:
58 /// Constructor: Pass pointer to geometric object that
59 /// specifies the volume, start and end coordinates for the centreline
60 /// on the geometric object. Values of theta at which dividing lines
61 /// are to be placed, fractions of the radius for the central box
62 /// at the dividing lines, the number of layers
63 /// and the timestepper.
64 /// Timestepper defaults to Steady dummy timestepper.
65 TubeMesh(GeomObject* wall_pt,
69 const unsigned& nlayer,
70 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
71
72 /// Destructor: empty
73 virtual ~TubeMesh()
74 {
75 delete Domain_pt;
76 }
77
78 /// Access function to GeomObject representing wall
80 {
81 return Volume_pt;
82 }
83
84 /// Access function to domain
86 {
87 return Domain_pt;
88 }
89
90 /// Access function to underlying domain
92 {
93 return Domain_pt;
94 }
95
96 protected:
97 /// Pointer to domain
99
100 /// Pointer to the geometric object that represents the curved wall
102 };
103
104
105 ////////////////////////////////////////////////////////////////////
106 ////////////////////////////////////////////////////////////////////
107 ////////////////////////////////////////////////////////////////////
108
109 //=============================================================
110 /// Adaptative version of the TubeMesh base mesh.
111 /// The domain is specified by the GeomObject that identifies
112 /// the entire volume
113 ///
114 /// The mesh boundaries are numbered as follows:
115 /// - Boundary 0: "Inflow" cross section; located along the
116 /// line parametrised by \f$ \xi_0 = \xi_0^{lo} \f$.
117 /// - Boundary 1: The outer wall, represetned by \f$\xi_2 = 1\f$.
118 /// - Boundary 2: The out flow, represented by \f$\xi_0 = \xi_0^{hi}\f$.
119 ///
120 //=============================================================
121 template<class ELEMENT>
122 class RefineableTubeMesh : public TubeMesh<ELEMENT>,
123 public RefineableBrickMesh<ELEMENT>
124
125 {
126 public:
127 /// Constructor for adaptive deformable quarter tube mesh class.
128 /// Pass pointer to geometric object that
129 /// specifies the volume, start and end coordinates for the centreline
130 /// on the geometric object. Values of theta at which dividing lines
131 /// are to be placed, fractions of the radius for the central box
132 /// at the dividing lines, the number of layers
133 /// and the timestepper.
134 /// Timestepper defaults to Steady dummy timestepper.
136 GeomObject* wall_pt,
140 const unsigned& nlayer,
141 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
142 : TubeMesh<ELEMENT>(wall_pt,
146 nlayer,
147 time_stepper_pt)
148 {
149 // Loop over all elements and set macro element pointer
150 for (unsigned ielem = 0; ielem < TubeMesh<ELEMENT>::nelement(); ielem++)
151 {
152 dynamic_cast<RefineableQElement<3>*>(
154 ->set_macro_elem_pt(this->Domain_pt->macro_element_pt(ielem));
155 }
156
157 // Setup Octree forest: Turn elements into individual octrees
158 // and plant in forest
160 for (unsigned iel = 0; iel < TubeMesh<ELEMENT>::nelement(); iel++)
161 {
163 ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(el_pt);
165 trees_pt.push_back(octree_root_pt);
166 }
167 this->Forest_pt = new OcTreeForest(trees_pt);
168
169#ifdef PARANOID
170 // Run self test
171 unsigned success_flag =
172 dynamic_cast<OcTreeForest*>(this->Forest_pt)->self_test();
173 if (success_flag == 0)
174 {
175 oomph_info << "Successfully built octree forest " << std::endl;
176 }
177 else
178 {
179 throw OomphLibError("Trouble in building octree forest ",
182 }
183#endif
184 }
185
186 /// Destructor: empty
188 };
189
190} // namespace oomph
191#include "tube_mesh.template.cc"
192#endif
Base class for brick meshes (meshes made of 3D brick elements).
Definition brick_mesh.h:178
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition domain.h:116
A general Finite Element class.
Definition elements.h:1317
A geometric object is an object that provides a parametrised description of its shape via the functio...
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 self_test()
Self-test: Check elements and nodes. Return 0 for OK.
Definition mesh.cc:778
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
An OomphLibError object which should be thrown when an run-time error is encountered....
Intermediate mesh class that implements the mesh adaptation functions specified in the TreeBasedRefin...
Adaptative version of the TubeMesh base mesh. The domain is specified by the GeomObject that identifi...
Definition tube_mesh.h:125
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...
Definition tube_mesh.h:135
virtual ~RefineableTubeMesh()
Destructor: empty.
Definition tube_mesh.h:187
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.
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....
Definition tube_mesh.h:56
GeomObject * Volume_pt
Pointer to the geometric object that represents the curved wall.
Definition tube_mesh.h:101
TubeDomain * domain_pt()
Access function to domain.
Definition tube_mesh.h:85
TubeDomain * Domain_pt
Pointer to domain.
Definition tube_mesh.h:98
TubeDomain * domain_pt() const
Access function to underlying domain.
Definition tube_mesh.h:91
GeomObject *& volume_pt()
Access function to GeomObject representing wall.
Definition tube_mesh.h:79
virtual ~TubeMesh()
Destructor: empty.
Definition tube_mesh.h:73
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...