quarter_pipe_mesh.template.cc
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_QUARTER_PIPE_MESH_TEMPLATE_CC
27 #define OOMPH_QUARTER_PIPE_MESH_TEMPLATE_CC
28 
30 
31 
32 namespace oomph
33 {
34  //====================================================================
35  /// Constructor: Pass number of elements in various directions,
36  /// the inner and outer radius and the length of the tube
37  //====================================================================
38  template<class ELEMENT>
40  const unsigned& nr,
41  const unsigned& nz,
42  const double& rmin,
43  const double& rmax,
44  const double& length,
45  TimeStepper* time_stepper_pt)
46  : SimpleCubicMesh<ELEMENT>(
47  ntheta, nr, nz, 1.0, 1.0, length, time_stepper_pt)
48  {
49  // Mesh can only be built with 3D Qelements.
50  MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(3);
51 
52  // Variables declaration
53  Ntheta = ntheta;
54  Nr = nr;
55  Nz = nz;
56  Rmin = rmin;
57  Rmax = rmax;
58  Length = length;
59 
60  // Build macro element-based domain
61  Domain_pt = new QuarterPipeDomain(ntheta, nr, nz, rmin, rmax, length);
62 
63  // Loop over all elements
64  unsigned nel = this->nelement();
65  for (unsigned e = 0; e < nel; e++)
66  {
67  // Try to cast to FiniteElement
68  FiniteElement* el_pt = dynamic_cast<FiniteElement*>(this->element_pt(e));
69 
70  // Set macro element pointer
72  }
73 
74  // Update node coordinates with macroelement coordinates,
75  // updating solid coordinates too.
76  this->node_update(true);
77 
78  // Setup boundary coordinates on inner boundary (boundary 1)
79  unsigned b = 1;
80  unsigned nnod = this->nboundary_node(b);
81  for (unsigned j = 0; j < nnod; j++)
82  {
83  // Pointer to node
84  Node* nod_pt = this->boundary_node_pt(b, j);
85 
86  // Get the Eulerian coordinates
87  double x = nod_pt->x(0);
88  double y = nod_pt->x(1);
89  double z = nod_pt->x(2);
90 
91  // Polar angle
92  double phi = atan2(y, x);
93 
94  // Set boundary coordinates
95  Vector<double> zeta(2);
96  zeta[0] = z;
97  zeta[1] = phi;
98  nod_pt->set_coordinates_on_boundary(b, zeta);
99  }
100  this->Boundary_coordinate_exists[b] = true;
101  }
102 
103 } // namespace oomph
104 
105 
106 #endif
e
Definition: cfortran.h:571
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
virtual void set_macro_elem_pt(MacroElement *macro_elem_pt)
Set pointer to macro element – can be overloaded in derived elements to perform additional tasks.
Definition: elements.h:1876
unsigned long nboundary_node(const unsigned &ibound) const
Return number of nodes on a particular boundary.
Definition: mesh.h:833
std::vector< bool > Boundary_coordinate_exists
Vector of boolean data that indicates whether the boundary coordinates have been set for the boundary...
Definition: mesh.h:190
virtual void node_update(const bool &update_all_solid_nodes=false)
Update nodal positions in response to changes in the domain shape. Uses the FiniteElement::get_x(....
Definition: mesh.cc:287
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:460
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
Definition: mesh.h:493
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:906
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
virtual void set_coordinates_on_boundary(const unsigned &b, const unsigned &k, const Vector< double > &boundary_zeta)
Set the vector of the k-th generalised boundary coordinates on mesh boundary b. Broken virtual interf...
Definition: nodes.cc:2394
Domain representing a quarter pipe.
QuarterPipeDomain * Domain_pt
Pointer to domain.
unsigned Nz
Number of elements axial direction.
QuarterPipeMesh(const unsigned &ntheta, const unsigned &nr, const unsigned &nz, const double &rmin, const double &rmax, const double &length, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in various directions, the inner and outer radius and the length...
unsigned Nr
Number of elements radial direction.
unsigned Ntheta
Number of elements azimuthal direction.
Simple cubic 3D Brick mesh class.
const unsigned & nz() const
Access function for number of elements in y directions.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Definition: timesteppers.h:231
//////////////////////////////////////////////////////////////////// ////////////////////////////////...