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
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
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:2315
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...
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
Definition: mesh.h:497
const unsigned & nz() const
Access function for number of elements in y directions.
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:201
Simple cubic 3D Brick mesh class.
A general Finite Element class.
Definition: elements.h:1274
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:100
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:852
unsigned long nboundary_node(const unsigned &ibound) const
Return number of nodes on a particular boundary.
Definition: mesh.h:809
e
Definition: cfortran.h:575
QuarterPipeDomain * Domain_pt
Pointer to domain.
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:587
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:1833
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:995
unsigned Nz
Number of elements axial direction.
unsigned Nr
Number of elements radial direction.
Domain representing a quarter pipe.
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(...) function for FiniteElements and doesn&#39;t do anything for other element types. If a MacroElement pointer has been set for a FiniteElement, the MacroElement representation is used to update the nodal positions; if not get_x(...) uses the FE interpolation and thus leaves the nodal positions unchanged. Virtual, so it can be overloaded by specific meshes, such as AlgebraicMeshes or SpineMeshes. Generally, this function updates the position of all nodes in response to changes in the boundary position. However, we ignore all SolidNodes since their position is computed as part of the solution – unless the bool flag is set to true. Such calls are typically made when the initial mesh is created and/or after a mesh has been refined repeatedly before the start of the computation.
Definition: mesh.cc:290
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:470
unsigned Ntheta
Number of elements azimuthal direction.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Definition: timesteppers.h:219