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// 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_QUARTER_PIPE_MESH_TEMPLATE_CC
31 #define OOMPH_QUARTER_PIPE_MESH_TEMPLATE_CC
32 
34 
35 
36 
37 namespace oomph
38 {
39 
40  //====================================================================
41  /// Constructor: Pass number of elements in various directions,
42  /// the inner and outer radius and the length of the tube
43  //====================================================================
44  template<class ELEMENT>
46  const unsigned &nr,
47  const unsigned &nz,
48  const double &rmin,
49  const double &rmax,
50  const double &length,
51  TimeStepper* time_stepper_pt) :
52  SimpleCubicMesh<ELEMENT>(ntheta,nr,nz,1.0,1.0,length,time_stepper_pt)
53  {
54 
55  // Mesh can only be built with 3D Qelements.
56  MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(3);
57 
58  //Variables declaration
59  Ntheta=ntheta;
60  Nr=nr;
61  Nz=nz;
62  Rmin=rmin;
63  Rmax=rmax;
64  Length=length;
65 
66  //Build macro element-based domain
67  Domain_pt = new QuarterPipeDomain(ntheta,nr,nz,rmin,rmax,length);
68 
69  // Loop over all elements
70  unsigned nel=this->nelement();
71  for (unsigned e=0;e<nel;e++)
72  {
73  // Try to cast to FiniteElement
74  FiniteElement* el_pt = dynamic_cast<FiniteElement*>(this->element_pt(e));
75 
76  // Set macro element pointer
77  el_pt->set_macro_elem_pt(Domain_pt->macro_element_pt(e));
78  }
79 
80  // Update node coordinates with macroelement coordinates,
81  // updating solid coordinates too.
82  this->node_update(true);
83 
84  // Setup boundary coordinates on inner boundary (boundary 1)
85  unsigned b=1;
86  unsigned nnod=this->nboundary_node(b);
87  for (unsigned j=0;j<nnod;j++)
88  {
89  // Pointer to node
90  Node* nod_pt=this->boundary_node_pt(b,j);
91 
92  // Get the Eulerian coordinates
93  double x=nod_pt->x(0);
94  double y=nod_pt->x(1);
95  double z=nod_pt->x(2);
96 
97  // Polar angle
98  double phi=atan2(y,x);
99 
100  // Set boundary coordinates
101  Vector<double> zeta(2);
102  zeta[0]=z;
103  zeta[1]=phi;
104  nod_pt->set_coordinates_on_boundary(b,zeta);
105  }
106  this->Boundary_coordinate_exists[b]=true;
107  }
108 
109 }
110 
111 
112 #endif
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...
const unsigned & nz() const
Access function for number of elements in y directions.
Simple cubic 3D Brick mesh class.
QuarterPipeDomain * Domain_pt
Pointer to domain.
unsigned Nz
Number of elements axial direction.
unsigned Nr
Number of elements radial direction.
Domain representing a quarter pipe.
unsigned Ntheta
Number of elements azimuthal direction.