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-2025 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_HEADER
27#define OOMPH_QUARTER_PIPE_MESH_TEMPLATE_HEADER
28
29#ifndef OOMPH_QUARTER_PIPE_MESH_HEADER
30#error __FILE__ should only be included from quarter_pipe_mesh.h.
31#endif // OOMPH_QUARTER_PIPE_MESH_HEADER
32
33namespace oomph
34{
35 //====================================================================
36 /// Constructor: Pass number of elements in various directions,
37 /// the inner and outer radius and the length of the tube
38 //====================================================================
39 template<class ELEMENT>
41 const unsigned& nr,
42 const unsigned& nz,
43 const double& rmin,
44 const double& rmax,
45 const double& length,
48 ntheta, nr, nz, 1.0, 1.0, length, time_stepper_pt)
49 {
50 // Mesh can only be built with 3D Qelements.
51 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(3);
52
53 // Variables declaration
54 Ntheta = ntheta;
55 Nr = nr;
56 Nz = nz;
57 Rmin = rmin;
58 Rmax = rmax;
59 Length = length;
60
61 // Build macro element-based domain
63
64 // Loop over all elements
65 unsigned nel = this->nelement();
66 for (unsigned e = 0; e < nel; e++)
67 {
68 // Try to cast to FiniteElement
69 FiniteElement* el_pt = dynamic_cast<FiniteElement*>(this->element_pt(e));
70
71 // Set macro element pointer
72 el_pt->set_macro_elem_pt(Domain_pt->macro_element_pt(e));
73 }
74
75 // Update node coordinates with macroelement coordinates,
76 // updating solid coordinates too.
77 this->node_update(true);
78
79 // Setup boundary coordinates on inner boundary (boundary 1)
80 unsigned b = 1;
81 unsigned nnod = this->nboundary_node(b);
82 for (unsigned j = 0; j < nnod; j++)
83 {
84 // Pointer to node
85 Node* nod_pt = this->boundary_node_pt(b, j);
86
87 // Get the Eulerian coordinates
88 double x = nod_pt->x(0);
89 double y = nod_pt->x(1);
90 double z = nod_pt->x(2);
91
92 // Polar angle
93 double phi = atan2(y, x);
94
95 // Set boundary coordinates
97 zeta[0] = z;
98 zeta[1] = phi;
99 nod_pt->set_coordinates_on_boundary(b, zeta);
100 }
102 }
103
104} // namespace oomph
105
106#endif
Collapsible channel mesh with MacroElement-based node update. The collapsible segment is represented ...
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.
double Rmin
Inner radius.
unsigned Ntheta
Number of elements azimuthal direction.
double Rmax
Outer radius.
Simple cubic 3D Brick mesh class.
const unsigned & nz() const
Access function for number of elements in y directions.