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