channel_with_leaflet_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-2022 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_CHANNEL_WITH_LEAFLET_MESH_HEADER
27 #define OOMPH_CHANNEL_WITH_LEAFLET_MESH_HEADER
28 
29 // Generic includes
30 #include "../generic/refineable_quad_mesh.h"
31 #include "../generic/macro_element.h"
32 #include "../generic/domain.h"
33 #include "../generic/quad_mesh.h"
34 
35 // Mesh is based on simple_rectangular_quadmesh
38 
39 // Include macro elements
40 #include "../generic/macro_element_node_update_element.h"
41 
42 // and algebraic elements
43 #include "../generic/algebraic_elements.h"
44 
45 // Include the headers file for domain
47 
48 namespace oomph
49 {
50  //===================================================================
52  //===================================================================
53  template<class ELEMENT>
55  {
56  public:
67  GeomObject* leaflet_pt,
68  const double& lleft,
69  const double& lright,
70  const double& hleaflet,
71  const double& htot,
72  const unsigned& nleft,
73  const unsigned& nright,
74  const unsigned& ny1,
75  const unsigned& ny2,
76  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
77 
80 
83  {
84  return Domain_pt;
85  }
86 
87  protected:
90 
93  };
94 
95 
99 
100 
101  //===================================================================
103  //===================================================================
104  template<class ELEMENT>
106  : public virtual ChannelWithLeafletMesh<ELEMENT>,
107  public RefineableQuadMesh<ELEMENT>
108  {
109  public:
120  GeomObject* leaflet_pt,
121  const double& lleft,
122  const double& lright,
123  const double& hleaflet,
124  const double& htot,
125  const unsigned& nleft,
126  const unsigned& nright,
127  const unsigned& ny1,
128  const unsigned& ny2,
129  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
130  : ChannelWithLeafletMesh<ELEMENT>(leaflet_pt,
131  lleft,
132  lright,
133  hleaflet,
134  htot,
135  nleft,
136  nright,
137  ny1,
138  ny2,
139  time_stepper_pt)
140  {
141  // Build quadtree forest
142  this->setup_quadtree_forest();
143  }
144 
147  };
148 
149 
153 
154 
155  //=====start_of_mesh=======================================================
164  //========================================================================
165  template<class ELEMENT>
167  : public virtual MacroElementNodeUpdateMesh,
168  public virtual ChannelWithLeafletMesh<ELEMENT>
169  {
170  public:
181  GeomObject* leaflet_pt,
182  const double& lleft,
183  const double& lright,
184  const double& hleaflet,
185  const double& htot,
186  const unsigned& nleft,
187  const unsigned& nright,
188  const unsigned& ny1,
189  const unsigned& ny2,
190  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
191  : ChannelWithLeafletMesh<ELEMENT>(leaflet_pt,
192  lleft,
193  lright,
194  hleaflet,
195  htot,
196  nleft,
197  nright,
198  ny1,
199  ny2,
200  time_stepper_pt)
201  {
202 #ifdef PARANOID
203  ELEMENT* el_pt = new ELEMENT;
204  if (dynamic_cast<MacroElementNodeUpdateElementBase*>(el_pt) == 0)
205  {
206  std::ostringstream error_message;
207  error_message << "Base class for ELEMENT in "
208  << "MacroElementNodeUpdateChannelWithLeafletMesh needs"
209  << "to be of type MacroElementNodeUpdateElement!\n";
210  error_message << "Whereas it is: typeid(el_pt).name()"
211  << typeid(el_pt).name() << std::endl;
212 
213  std::string function_name =
214  "MacroElementNodeUpdateChannelWithLeafletMesh::\n";
215  function_name += "MacroElementNodeUpdateChannelWithLeafletMesh()";
216 
217  throw OomphLibError(error_message.str(),
220  }
221  delete el_pt;
222 #endif
223 
224  // Setup all the information that's required for MacroElement-based
225  // node update: Tell the elements that their geometry depends on the
226  // wall geometric object
227  unsigned n_element = this->nelement();
228  for (unsigned i = 0; i < n_element; i++)
229  {
230  // Upcast from FiniteElement to the present element
231  ELEMENT* el_pt = dynamic_cast<ELEMENT*>(this->element_pt(i));
232 
233 #ifdef PARANOID
234  // Check if cast is successful
236  dynamic_cast<MacroElementNodeUpdateElementBase*>(el_pt);
237  if (m_el_pt == 0)
238  {
239  std::ostringstream error_message;
240  error_message
241  << "Failed to upcast to MacroElementNodeUpdateElementBase\n";
242  error_message << "Element must be derived from "
243  "MacroElementNodeUpdateElementBase\n";
244  error_message << "but it is of type " << typeid(el_pt).name();
245 
246  std::string function_name =
247  "MacroElementNodeUpdateChannelWithLeafletMesh::\n";
248  function_name += "MacroElementNodeUpdateChannelWithLeafletMesh()";
249 
250  throw OomphLibError(error_message.str(),
253  }
254 #endif
255 
256  // There's just one GeomObject
257  Vector<GeomObject*> geom_object_pt(1);
258  geom_object_pt[0] = this->Leaflet_pt;
259 
260  // Tell the element which geom objects its macro-element-based
261  // node update depends on
262  el_pt->set_node_update_info(geom_object_pt);
263  }
264 
265  // Add the geometric object(s) for the wall to the mesh's storage
266  Vector<GeomObject*> geom_object_pt(1);
267  geom_object_pt[0] = this->Leaflet_pt;
269 
270  // Fill in the domain pointer to the mesh's storage in the base class
272 
273  } // end of constructor
274 
275 
278 
279 
280  }; // end of mesh
281 
282 
286 
287 
288  //=====start_of_mesh=======================================================
290  //========================================================================
291  template<class ELEMENT>
293  : public virtual MacroElementNodeUpdateChannelWithLeafletMesh<ELEMENT>,
294  public virtual RefineableQuadMesh<ELEMENT>
295  {
296  public:
307  GeomObject* leaflet_pt,
308  const double& lleft,
309  const double& lright,
310  const double& hleaflet,
311  const double& htot,
312  const unsigned& nleft,
313  const unsigned& nright,
314  const unsigned& ny1,
315  const unsigned& ny2,
316  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
317  : ChannelWithLeafletMesh<ELEMENT>(leaflet_pt,
318  lleft,
319  lright,
320  hleaflet,
321  htot,
322  nleft,
323  nright,
324  ny1,
325  ny2,
326  time_stepper_pt),
328  lleft,
329  lright,
330  hleaflet,
331  htot,
332  nleft,
333  nright,
334  ny1,
335  ny2,
336  time_stepper_pt)
337  {
338  // Build quadtree forest
339  this->setup_quadtree_forest();
340  }
341 
342 
345 
346  }; // end of mesh
347 
348 
352 
353 
354  //=================================================================
358  //=================================================================
359  template<class ELEMENT>
361  : public AlgebraicMesh,
362  public virtual ChannelWithLeafletMesh<ELEMENT>
363  {
364  public:
375  GeomObject* leaflet_pt,
376  const double& lleft,
377  const double& lright,
378  const double& hleaflet,
379  const double& htot,
380  const unsigned& nleft,
381  const unsigned& nright,
382  const unsigned& ny1,
383  const unsigned& ny2,
384  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
385  : ChannelWithLeafletMesh<ELEMENT>(leaflet_pt,
386  lleft,
387  lright,
388  hleaflet,
389  htot,
390  nleft,
391  nright,
392  ny1,
393  ny2,
394  time_stepper_pt)
395  {
396  // Store origin of leaflet for fast reference
397  Vector<double> zeta(1);
398  zeta[0] = 0.0;
399  Vector<double> r(2);
400  this->Leaflet_pt->position(zeta, r);
401  X_0 = r[0];
402 
403  // Store length of the leaflet for fast access (it's also available
404  // through the domain, of course)
405  Hleaflet = hleaflet;
406 
407  // Add the geometric object to the list associated with this AlgebraicMesh
409 
410  // Setup algebraic node update operations
412  }
413 
414 
417 
418 
423 
426  void algebraic_node_update(const unsigned& t, AlgebraicNode*& node_pt);
427 
428  protected:
431 
433  void node_update_I(const unsigned& t, AlgebraicNode*& node_pt);
434 
436  void node_update_II(const unsigned& t, AlgebraicNode*& node_pt);
437 
439  void node_update_III(const unsigned& t, AlgebraicNode*& node_pt);
440 
442  void node_update_IV(const unsigned& t, AlgebraicNode*& node_pt);
443 
445  void slanted_bound_up(const unsigned& t,
446  const Vector<double>& zeta,
447  Vector<double>& r);
448 
452  double X_0;
453 
457  double Hleaflet;
458  };
459 
463 
464 
465  //===================================================================
467  //===================================================================
468  template<class ELEMENT>
470  : public RefineableQuadMesh<ELEMENT>,
471  public virtual AlgebraicChannelWithLeafletMesh<ELEMENT>
472  {
473  public:
484  GeomObject* leaflet_pt,
485  const double& lleft,
486  const double& lright,
487  const double& hleaflet,
488  const double& htot,
489  const unsigned& nleft,
490  const unsigned& nright,
491  const unsigned& ny1,
492  const unsigned& ny2,
493  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
494  : ChannelWithLeafletMesh<ELEMENT>(leaflet_pt,
495  lleft,
496  lright,
497  hleaflet,
498  htot,
499  nleft,
500  nright,
501  ny1,
502  ny2,
503  time_stepper_pt),
504  AlgebraicChannelWithLeafletMesh<ELEMENT>(leaflet_pt,
505  lleft,
506  lright,
507  hleaflet,
508  htot,
509  nleft,
510  nright,
511  ny1,
512  ny2,
513  time_stepper_pt)
514  {
515  // Build quadtree forest
516  this->setup_quadtree_forest();
517  }
518 
522  };
523 
524 
528 
529 
530  //==========================================================================
532  //==========================================================================
533  template<class ELEMENT>
535  : public virtual ChannelWithLeafletMesh<ELEMENT>,
536  public virtual SolidMesh
537  {
538  public:
548  GeomObject* leaflet_pt,
549  const double& lleft,
550  const double& lright,
551  const double& hleaflet,
552  const double& htot,
553  const unsigned& nleft,
554  const unsigned& nright,
555  const unsigned& ny1,
556  const unsigned& ny2,
557  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
558  : ChannelWithLeafletMesh<ELEMENT>(leaflet_pt,
559  lleft,
560  lright,
561  hleaflet,
562  htot,
563  nleft,
564  nright,
565  ny1,
566  ny2,
567  time_stepper_pt)
568  {
569  // Update position of all nodes (the ones haven't been given
570  // positions yet!)
571  bool update_all_solid_nodes = true;
572  node_update(update_all_solid_nodes);
573 
574  // Make the current configuration the undeformed one by
575  // setting the nodal Lagrangian coordinates to their current
576  // Eulerian ones
578  }
579 
582  };
583 
584 
585 } // namespace oomph
586 
587 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Definition: channel_with_leaflet_mesh.template.h:363
void setup_algebraic_node_update()
Function to setup the algebraic node update.
Definition: channel_with_leaflet_mesh.template.cc:242
double X_0
Definition: channel_with_leaflet_mesh.template.h:452
AlgebraicChannelWithLeafletMesh(GeomObject *leaflet_pt, const double &lleft, const double &lright, const double &hleaflet, const double &htot, const unsigned &nleft, const unsigned &nright, const unsigned &ny1, const unsigned &ny2, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: channel_with_leaflet_mesh.template.h:374
double Hleaflet
Definition: channel_with_leaflet_mesh.template.h:457
void algebraic_node_update(const unsigned &t, AlgebraicNode *&node_pt)
Perform algebraic node update.
Definition: channel_with_leaflet_mesh.template.cc:412
void node_update_I(const unsigned &t, AlgebraicNode *&node_pt)
Update function for nodes in lower left region (I)
Definition: channel_with_leaflet_mesh.template.cc:455
void node_update_III(const unsigned &t, AlgebraicNode *&node_pt)
Update function for nodes in upper left region (III)
Definition: channel_with_leaflet_mesh.template.cc:564
virtual ~AlgebraicChannelWithLeafletMesh()
Destructor: empty.
Definition: channel_with_leaflet_mesh.template.h:416
void node_update_II(const unsigned &t, AlgebraicNode *&node_pt)
Update function for nodes in lower right region (II)
Definition: channel_with_leaflet_mesh.template.cc:500
void slanted_bound_up(const unsigned &t, const Vector< double > &zeta, Vector< double > &r)
Helper function.
Definition: channel_with_leaflet_mesh.template.cc:542
void node_update_IV(const unsigned &t, AlgebraicNode *&node_pt)
Update function for nodes in upper right region (IV)
Definition: channel_with_leaflet_mesh.template.cc:598
void update_node_update(AlgebraicNode *&node_pt)
Definition: channel_with_leaflet_mesh.template.h:422
Definition: algebraic_elements.h:599
void add_geom_object_list_pt(GeomObject *geom_object_pt)
Definition: algebraic_elements.h:823
AlgebraicNode * node_pt(const unsigned long &n)
Return a pointer to the n-th global AlgebraicNode.
Definition: algebraic_elements.h:620
Definition: algebraic_elements.h:55
Definition: channel_with_leaflet_domain.h:42
Channel with leaflet mesh.
Definition: channel_with_leaflet_mesh.template.h:55
ChannelWithLeafletDomain * Domain_pt
Pointer to domain.
Definition: channel_with_leaflet_mesh.template.h:89
ChannelWithLeafletDomain * domain_pt()
Access function to domain.
Definition: channel_with_leaflet_mesh.template.h:82
GeomObject * Leaflet_pt
Pointer to GeomObject that represents the leaflet.
Definition: channel_with_leaflet_mesh.template.h:92
ChannelWithLeafletMesh(GeomObject *leaflet_pt, const double &lleft, const double &lright, const double &hleaflet, const double &htot, const unsigned &nleft, const unsigned &nright, const unsigned &ny1, const unsigned &ny2, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: channel_with_leaflet_mesh.template.cc:48
virtual ~ChannelWithLeafletMesh()
Destructor : empty.
Definition: channel_with_leaflet_mesh.template.h:79
Definition: geom_objects.h:101
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
Definition: channel_with_leaflet_mesh.template.h:169
virtual ~MacroElementNodeUpdateChannelWithLeafletMesh()
Destructor: empty.
Definition: channel_with_leaflet_mesh.template.h:277
MacroElementNodeUpdateChannelWithLeafletMesh(GeomObject *leaflet_pt, const double &lleft, const double &lright, const double &hleaflet, const double &htot, const unsigned &nleft, const unsigned &nright, const unsigned &ny1, const unsigned &ny2, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: channel_with_leaflet_mesh.template.h:180
Base class for elements that allow MacroElement-based node update.
Definition: macro_element_node_update_element.h:197
Definition: macro_element_node_update_element.h:360
void set_geom_object_vector_pt(Vector< GeomObject * > geom_object_vector_pt)
Definition: macro_element_node_update_element.h:510
Domain *& macro_domain_pt()
Broken assignment operator.
Definition: macro_element_node_update_element.h:376
Refineable mesh with MacroElement-based node update.
Definition: channel_with_leaflet_mesh.template.h:295
MacroElementNodeUpdateRefineableChannelWithLeafletMesh(GeomObject *leaflet_pt, const double &lleft, const double &lright, const double &hleaflet, const double &htot, const unsigned &nleft, const unsigned &nright, const unsigned &ny1, const unsigned &ny2, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: channel_with_leaflet_mesh.template.h:306
virtual ~MacroElementNodeUpdateRefineableChannelWithLeafletMesh()
Destructor: empty.
Definition: channel_with_leaflet_mesh.template.h:344
static Steady< 0 > Default_TimeStepper
The Steady Timestepper.
Definition: mesh.h:75
virtual void node_update(const bool &update_all_solid_nodes=false)
Definition: mesh.cc:287
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:460
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
Definition: oomph_definitions.h:222
Channel with leaflet mesh upgraded to (pseudo-)solid mesh.
Definition: channel_with_leaflet_mesh.template.h:537
PseudoElasticChannelWithLeafletMesh(GeomObject *leaflet_pt, const double &lleft, const double &lright, const double &hleaflet, const double &htot, const unsigned &nleft, const unsigned &nright, const unsigned &ny1, const unsigned &ny2, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: channel_with_leaflet_mesh.template.h:547
virtual ~PseudoElasticChannelWithLeafletMesh()
Destructor : empty.
Definition: channel_with_leaflet_mesh.template.h:581
Refineable version of algebraic ChannelWithLeafletMesh.
Definition: channel_with_leaflet_mesh.template.h:472
RefineableAlgebraicChannelWithLeafletMesh(GeomObject *leaflet_pt, const double &lleft, const double &lright, const double &hleaflet, const double &htot, const unsigned &nleft, const unsigned &nright, const unsigned &ny1, const unsigned &ny2, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: channel_with_leaflet_mesh.template.h:483
void update_node_update(AlgebraicNode *&node_pt)
Update the node update functions.
Definition: channel_with_leaflet_mesh.template.cc:639
Refineable version of ChannelWithLeafletMesh.
Definition: channel_with_leaflet_mesh.template.h:108
RefineableChannelWithLeafletMesh(GeomObject *leaflet_pt, const double &lleft, const double &lright, const double &hleaflet, const double &htot, const unsigned &nleft, const unsigned &nright, const unsigned &ny1, const unsigned &ny2, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: channel_with_leaflet_mesh.template.h:119
virtual ~RefineableChannelWithLeafletMesh()
Destructor (empty)
Definition: channel_with_leaflet_mesh.template.h:146
Definition: refineable_quad_mesh.h:53
void setup_quadtree_forest()
Definition: refineable_quad_mesh.h:88
Definition: simple_rectangular_quadmesh.template.h:58
Definition: mesh.h:2562
void set_lagrangian_nodal_coordinates()
Definition: mesh.cc:9564
Definition: timesteppers.h:231
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition: SpecialFunctionsArrayAPI.h:152
r
Definition: UniformPSDSelfTest.py:20
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
string name
Definition: plotDoE.py:33
t
Definition: plotPSD.py:36
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86