cylinder_with_flag_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-2024 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_CYLINDER_WITH_FLAG_MESH_HEADER
27 #define OOMPH_CYLINDER_WITH_FLAG_MESH_HEADER
28 
29 
30 // Include the headers file for domain
32 
33 // Generic includes
34 #include "../generic/refineable_quad_mesh.h"
35 #include "../generic/quad_mesh.h"
36 
37 // Include algebraic elements
38 #include "../generic/algebraic_elements.h"
39 
40 
41 namespace oomph
42 {
43  //=============================================================
44  /// Domain-based mesh for cylinder with flag as in Turek
45  /// benchmark.
46  //=============================================================
47  template<class ELEMENT>
48  class CylinderWithFlagMesh : public virtual Mesh, public virtual QuadMeshBase
49  {
50  public:
51  /// Constructor. Pass the pointers to the GeomObjects that
52  /// parametrise the cylinder, the three edges of the flag, the length and
53  /// height of the domain, the length and height of the flag, the coordinates
54  /// of the centre of the cylinder and its radius. Timestepper defaults to
55  /// Steady default timestepper.
57  Circle* cylinder_pt,
58  GeomObject* top_flag_pt,
59  GeomObject* bottom_flag_pt,
60  GeomObject* tip_flag_pt,
61  const double& length,
62  const double& height,
63  const double& flag_length,
64  const double& flag_height,
65  const double& centre_x,
66  const double& centre_y,
67  const double& a,
68  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
69 
70  /// Destructor: Kill the domain
72  {
73  delete Domain_pt;
74  }
75 
76  /// Access function to the domain
78  {
79  return Domain_pt;
80  }
81 
82  protected:
83  /// Pointer to the domain
85 
86  }; // end of mesh class
87 
88 
89  /// ///////////////////////////////////////////////////////////////////////
90  /// ///////////////////////////////////////////////////////////////////////
91  /// ///////////////////////////////////////////////////////////////////////
92 
93 
94  //===================================================================
95  /// Refineable version of CylinderWithFlagMesh.
96  //===================================================================
97  template<class ELEMENT>
99  public RefineableQuadMesh<ELEMENT>
100  {
101  public:
102  /// Constructor. Pass the pointers to the GeomObjects that
103  /// parametrise the cylinder, the three edges of the flag, the length and
104  /// height of the domain, the length and height of the flag, the coordinates
105  /// of the centre of the cylinder and its radius. Timestepper defaults to
106  /// Steady default timestepper.
108  Circle* cylinder_pt,
109  GeomObject* top_flag_pt,
110  GeomObject* bottom_flag_pt,
111  GeomObject* tip_flag_pt,
112  const double& length,
113  const double& height,
114  const double& flag_length,
115  const double& flag_height,
116  const double& centre_x,
117  const double& centre_y,
118  const double& a,
119  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
120  : CylinderWithFlagMesh<ELEMENT>(cylinder_pt,
121  top_flag_pt,
122  bottom_flag_pt,
123  tip_flag_pt,
124  length,
125  height,
126  flag_length,
127  flag_height,
128  centre_x,
129  centre_y,
130  a,
131  time_stepper_pt)
132  {
133  // Nodal positions etc. were created in constructor for
134  // Cylinder...<...>. Need to setup adaptive information.
135 
136  // Setup quadtree forest for mesh refinement
137  this->setup_quadtree_forest();
138  }
139 
140 
141  /// Destructor: Empty
143  };
144 
145 
146  /// ///////////////////////////////////////////////////////////////////////
147  /// ///////////////////////////////////////////////////////////////////////
148  /// ///////////////////////////////////////////////////////////////////////
149 
150 
151  //===================================================================
152  /// Algebraic version of CylinderWithFlagMesh.
153  //===================================================================
154  template<class ELEMENT>
156  : public AlgebraicMesh,
157  public virtual CylinderWithFlagMesh<ELEMENT>
158  {
159  public:
160  /// Constructor. Pass the pointers to the GeomObjects that
161  /// parametrise the cylinder, the three edges of the flag, the length and
162  /// height of the domain, the length and height of the flag, the coordinates
163  /// of the centre of the cylinder and its radius. Timestepper defaults to
164  /// Steady default timestepper.
166  Circle* cylinder_pt,
167  GeomObject* top_flag_pt,
168  GeomObject* bottom_flag_pt,
169  GeomObject* tip_flag_pt,
170  const double& length,
171  const double& height,
172  const double& flag_length,
173  const double& flag_height,
174  const double& centre_x,
175  const double& centre_y,
176  const double& a,
177  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
178  : CylinderWithFlagMesh<ELEMENT>(cylinder_pt,
179  top_flag_pt,
181  tip_flag_pt,
182  length,
183  height,
184  flag_length,
185  flag_height,
186  centre_x,
187  centre_y,
188  a,
189  time_stepper_pt),
190  Cylinder_pt(cylinder_pt),
194  Length(length),
195  Height(height),
196  Flag_length(flag_length),
197  Flag_height(flag_height),
198  Centre_x(centre_x),
199  Centre_y(centre_y),
200  A(a)
201  {
202  // Add the geometric objects to the list associated with this
203  // AlgebraicMesh
204  AlgebraicMesh::add_geom_object_list_pt(cylinder_pt);
205  AlgebraicMesh::add_geom_object_list_pt(top_flag_pt);
206  AlgebraicMesh::add_geom_object_list_pt(bottom_flag_pt);
207  AlgebraicMesh::add_geom_object_list_pt(tip_flag_pt);
208 
209  // Setup algebraic node update operations
211  }
212 
213  /// Destructor: empty
215 
216 
217  /// Set geometric object that defines the
218  /// bottom face of the flag
220  {
221  // Need to alter the domain's bottom_flag_pt too
224  }
225 
226  /// Set the geometric object that defines the
227  /// top face of the flag
228  void set_top_flag_pt(GeomObject* top_flag_pt)
229  {
230  this->domain_pt()->top_flag_pt() = top_flag_pt;
232  }
233 
234 
235  /// Set the geometric object that defines the
236  /// tip of the flag
237  void set_tip_flag_pt(GeomObject* tip_flag_pt)
238  {
239  this->domain_pt()->tip_flag_pt() = tip_flag_pt;
241  }
242 
243 
244  /// Read-only access to geometric object that defines the
245  /// bottom face of the flag
246  GeomObject* bottom_flag_pt() const
247  {
248  return Bottom_flag_pt;
249  }
250 
251 
252  /// Read-only access to geometric object that defines the
253  /// top face of the flag
254  GeomObject* top_flag_pt() const
255  {
256  return Top_flag_pt;
257  }
258 
259  /// Read-only access to geometric object that defines the
260  /// tip of the flag
261  GeomObject* tip_flag_pt() const
262  {
263  return Tip_flag_pt;
264  }
265 
266 
267  /// Update the geometric references that are used
268  /// to update node after mesh adaptation.
269  /// Empty -- no update of node update required without adaptativity
270  void update_node_update(AlgebraicNode*& node_pt) {}
271 
272 
273  /// Update nodal position at time level t (t=0: present;
274  /// t>0: previous)
275  void algebraic_node_update(const unsigned& t, AlgebraicNode*& node_pt);
276 
277  protected:
278  /// Function to setup the algebraic node update
280 
281  /// Helper function
282  void node_update_I(const unsigned& t, AlgebraicNode*& node_pt);
283 
284  /// Helper function
285  void node_update_II(const unsigned& t, AlgebraicNode*& node_pt);
286 
287  /// Helper function
288  void node_update_III(const unsigned& t, AlgebraicNode*& node_pt);
289 
290  /// Helper function
291  void node_update_IV(const unsigned& t, AlgebraicNode*& node_pt);
292 
293  /// Helper function
294  void node_update_V(const unsigned& t, AlgebraicNode*& node_pt);
295 
296  /// Helper function
297  void node_update_VI(const unsigned& t, AlgebraicNode*& node_pt);
298 
299  /// Helper function
300  void node_update_VII(const unsigned& t, AlgebraicNode*& node_pt);
301 
302  /// Helper function
303  void node_update_VIII(const unsigned& t, AlgebraicNode*& node_pt);
304 
305  /// Helper function
306  void node_update_IX(const unsigned& t, AlgebraicNode*& node_pt);
307 
308  /// Cylinder
309  GeomObject* Cylinder_pt;
310 
311  /// Top flag
312  GeomObject* Top_flag_pt;
313 
314  /// Bottom flag
315  GeomObject* Bottom_flag_pt;
316 
317  /// Tip flag
318  GeomObject* Tip_flag_pt;
319 
320  /// Length of the domain
321  double Length;
322 
323  /// Height of the domain
324  double Height;
325 
326  /// Flag length
327  double Flag_length;
328 
329  /// Flag thickness
330  double Flag_height;
331 
332  /// x position of the centre of the cylinder
333  double Centre_x;
334 
335  /// x position of the centre of the cylinder
336  double Centre_y;
337 
338  /// radius of the cylinder
339  double A;
340  };
341 
342 
343  /// ////////////////////////////////////////////////////////////////////////
344  /// ////////////////////////////////////////////////////////////////////////
345  /// ////////////////////////////////////////////////////////////////////////
346 
347  //===================================================================
348  /// Refineable version of AlgebraicCylinderWithFlagMesh
349  //===================================================================
350  template<class ELEMENT>
352  : public RefineableQuadMesh<ELEMENT>,
353  public virtual AlgebraicCylinderWithFlagMesh<ELEMENT>
354  {
355  public:
356  /// Constructor: Pass the pointers to the GeomObjects that
357  /// parametrise the cylinder, the three edges of the flag, the length and
358  /// height of the domain, the length and height of the flag, the coordinates
359  /// of the centre of the cylinder and its radius. Timestepper defaults to
360  /// Steady default timestepper.
362  Circle* cylinder_pt,
363  GeomObject* top_flag_pt,
364  GeomObject* bottom_flag_pt,
365  GeomObject* tip_flag_pt,
366  const double& length,
367  const double& height,
368  const double& flag_length,
369  const double& flag_height,
370  const double& centre_x,
371  const double& centre_y,
372  const double& a,
373  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
374  : CylinderWithFlagMesh<ELEMENT>(cylinder_pt,
375  top_flag_pt,
377  tip_flag_pt,
378  length,
379  height,
380  flag_length,
381  flag_height,
382  centre_x,
383  centre_y,
384  a,
385  time_stepper_pt),
386  AlgebraicCylinderWithFlagMesh<ELEMENT>(cylinder_pt,
387  top_flag_pt,
389  tip_flag_pt,
390  length,
391  height,
392  flag_length,
393  flag_height,
394  centre_x,
395  centre_y,
396  a,
397  time_stepper_pt)
398  {
399  // Build quadtree forest
400  this->setup_quadtree_forest();
401  }
402 
403  /// Update the node update data for specified node following
404  /// any mesh adapation
405  void update_node_update(AlgebraicNode*& node_pt);
406  };
407 
408 
409 } // namespace oomph
410 
411 
412 #endif
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
void node_update_V(const unsigned &t, AlgebraicNode *&node_pt)
Helper function.
GeomObject * top_flag_pt() const
Read-only access to geometric object that defines the top face of the flag.
void set_tip_flag_pt(GeomObject *tip_flag_pt)
Set the geometric object that defines the tip of the flag.
void node_update_II(const unsigned &t, AlgebraicNode *&node_pt)
Helper function.
AlgebraicCylinderWithFlagMesh(Circle *cylinder_pt, GeomObject *top_flag_pt, GeomObject *bottom_flag_pt, GeomObject *tip_flag_pt, const double &length, const double &height, const double &flag_length, const double &flag_height, const double &centre_x, const double &centre_y, const double &a, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor. Pass the pointers to the GeomObjects that parametrise the cylinder, the three edges of t...
double Centre_x
x position of the centre of the cylinder
void node_update_III(const unsigned &t, AlgebraicNode *&node_pt)
Helper function.
void algebraic_node_update(const unsigned &t, AlgebraicNode *&node_pt)
Update nodal position at time level t (t=0: present; t>0: previous)
void node_update_IV(const unsigned &t, AlgebraicNode *&node_pt)
Helper function.
void set_bottom_flag_pt(GeomObject *bottom_flag_pt)
Set geometric object that defines the bottom face of the flag.
double Centre_y
x position of the centre of the cylinder
void node_update_I(const unsigned &t, AlgebraicNode *&node_pt)
Helper function.
void node_update_VIII(const unsigned &t, AlgebraicNode *&node_pt)
Helper function.
void node_update_VI(const unsigned &t, AlgebraicNode *&node_pt)
Helper function.
GeomObject * bottom_flag_pt() const
Read-only access to geometric object that defines the bottom face of the flag.
void set_top_flag_pt(GeomObject *top_flag_pt)
Set the geometric object that defines the top face of the flag.
void update_node_update(AlgebraicNode *&node_pt)
Update the geometric references that are used to update node after mesh adaptation....
void node_update_VII(const unsigned &t, AlgebraicNode *&node_pt)
Helper function.
void setup_algebraic_node_update()
Function to setup the algebraic node update.
GeomObject * tip_flag_pt() const
Read-only access to geometric object that defines the tip of the flag.
void node_update_IX(const unsigned &t, AlgebraicNode *&node_pt)
Helper function.
Domain for cylinder with flag as in Turek benchmark.
GeomObject *& bottom_flag_pt()
Access fct to GeomObjects for top, bottom and tip.
Domain-based mesh for cylinder with flag as in Turek benchmark.
virtual ~CylinderWithFlagMesh()
Destructor: Kill the domain.
CylinderWithFlagDomain * Domain_pt
Pointer to the domain.
CylinderWithFlagMesh(Circle *cylinder_pt, GeomObject *top_flag_pt, GeomObject *bottom_flag_pt, GeomObject *tip_flag_pt, const double &length, const double &height, const double &flag_length, const double &flag_height, const double &centre_x, const double &centre_y, const double &a, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor. Pass the pointers to the GeomObjects that parametrise the cylinder, the three edges of t...
CylinderWithFlagDomain * domain_pt()
Access function to the domain.
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
void update_node_update(AlgebraicNode *&node_pt)
Update the node update data for specified node following any mesh adapation.
RefineableAlgebraicCylinderWithFlagMesh(Circle *cylinder_pt, GeomObject *top_flag_pt, GeomObject *bottom_flag_pt, GeomObject *tip_flag_pt, const double &length, const double &height, const double &flag_length, const double &flag_height, const double &centre_x, const double &centre_y, const double &a, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass the pointers to the GeomObjects that parametrise the cylinder, the three edges of t...
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
RefineableCylinderWithFlagMesh(Circle *cylinder_pt, GeomObject *top_flag_pt, GeomObject *bottom_flag_pt, GeomObject *tip_flag_pt, const double &length, const double &height, const double &flag_length, const double &flag_height, const double &centre_x, const double &centre_y, const double &a, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor. Pass the pointers to the GeomObjects that parametrise the cylinder, the three edges of t...
////////////////////////////////////////////////////////////////////// //////////////////////////////...