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-2023 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
71  el_pt->set_macro_elem_pt(Domain_pt->macro_element_pt(e));
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
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.
////////////////////////////////////////////////////////////////////// //////////////////////////////...