Twomersley_elements.h
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: 1097 $
7 //LIC//
8 //LIC// $LastChangedDate: 2015-12-17 11:53:17 +0000 (Thu, 17 Dec 2015) $
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 //Header file for TWomersley elements
31 #ifndef OOMPH_TWOMERSLEY_ELEMENTS_HEADER
32 #define OOMPH_TWOMERSLEY_ELEMENTS_HEADER
33 
34 
35 // Config header generated by autoconfig
36 #ifdef HAVE_CONFIG_H
37  #include <oomph-lib-config.h>
38 #endif
39 
40 
41 //OOMPH-LIB headers
42 #include "../generic/nodes.h"
43 #include "../generic/oomph_utilities.h"
44 #include "../generic/Telements.h"
45 #include "../generic/error_estimator.h"
46 #include "womersley_elements.h"
47 
48 namespace oomph
49 {
50 
51 
52 
53 ///////////////////////////////////////////////////////////////////////////
54 ///////////////////////////////////////////////////////////////////////////
55 ///////////////////////////////////////////////////////////////////////////
56 
57 
58 
59 //======================================================================
60 /// TWomersleyElement elements are linear/triangular/tetrahedral
61 /// Womersley elements with isoparametric interpolation for the function.
62 //======================================================================
63 template <unsigned DIM, unsigned NNODE_1D>
64  class TWomersleyElement : public virtual TElement<DIM,NNODE_1D>,
65  public virtual WomersleyEquations<DIM>
66  {
67  private:
68 
69  /// \short Static array of ints to hold number of variables at
70  /// nodes: Initial_Nvalue[n]
71  static const unsigned Initial_Nvalue;
72 
73  public:
74 
75  ///\short Constructor: Call constructors for TElement and
76  /// Womersley equations
77  TWomersleyElement() : TElement<DIM,NNODE_1D>(),
78  WomersleyEquations<DIM>()
79  { }
80 
81  /// Broken copy constructor
83  {
84  BrokenCopy::broken_copy("TWomersleyElement");
85  }
86 
87  /// Broken assignment operator
89  {
90  BrokenCopy::broken_assign("TWomersleyElement");
91  }
92 
93  /// \short Required # of `values' (pinned or dofs)
94  /// at node n
95  inline unsigned required_nvalue(const unsigned &n) const
96  {return Initial_Nvalue;}
97 
98  /// \short Output function:
99  /// x,y,u or x,y,z,u
100  void output(std::ostream &outfile)
102 
103 
104  /// \short Output function:
105  /// x,y,u or x,y,z,u at n_plot^DIM plot points
106  void output(std::ostream &outfile, const unsigned &n_plot)
107  {WomersleyEquations<DIM>::output(outfile,n_plot);}
108 
109 
110 
111  /// \short C-style output function:
112  /// x,y,u or x,y,z,u
113  void output(FILE* file_pt)
115 
116 
117  /// \short C-style output function:
118  /// x,y,u or x,y,z,u at n_plot^DIM plot points
119  void output(FILE* file_pt, const unsigned &n_plot)
120  {WomersleyEquations<DIM>::output(file_pt,n_plot);}
121 
122 
123  /// \short Output function for an exact solution:
124  /// x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points
125  void output_fct(std::ostream &outfile, const unsigned &n_plot,
127  exact_soln_pt)
128  {WomersleyEquations<DIM>::output_fct(outfile,n_plot,exact_soln_pt);}
129 
130 
131 
132  /// \short Output function for a time-dependent exact solution.
133  /// x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points
134  /// (Calls the steady version)
135  void output_fct(std::ostream &outfile, const unsigned &n_plot,
136  const double& time,
138  {WomersleyEquations<DIM>::output_fct(outfile,n_plot,time,exact_soln_pt);}
139 
140 
141 
142 protected:
143 
144  /// Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
146  Shape &psi,
147  DShape &dpsidx,
148  Shape &test,
149  DShape &dtestdx) const;
150 
151 
152  /// \short Shape/test functions and derivs w.r.t. to global coords at
153  /// integration point ipt; return Jacobian of mapping
154  inline double dshape_and_dtest_eulerian_at_knot_womersley(const unsigned &ipt,
155  Shape &psi,
156  DShape &dpsidx,
157  Shape &test,
158  DShape &dtestdx)
159  const;
160 
161 };
162 
163 
164 ////////////////////////////////////////////////////////////////////////
165 ////////////////////////////////////////////////////////////////////////
166 ////////////////////////////////////////////////////////////////////////
167 
168 
169 //======================================================================
170 /// Define the shape functions and test functions and derivatives
171 /// w.r.t. global coordinates and return Jacobian of mapping.
172 ///
173 /// Galerkin: Test functions = shape functions
174 //======================================================================
175 template<unsigned DIM, unsigned NNODE_1D>
178  Shape &psi,
179  DShape &dpsidx,
180  Shape &test,
181  DShape &dtestdx) const
182 {
183  //Call the geometrical shape functions and derivatives
184  double J = this->dshape_eulerian(s,psi,dpsidx);
185 
186  //Loop over the test functions and derivatives and set them equal to the
187  //shape functions
188  for(unsigned i=0;i<NNODE_1D;i++)
189  {
190  test[i] = psi[i];
191  for(unsigned j=0;j<DIM;j++)
192  {
193  dtestdx(i,j) = dpsidx(i,j);
194  }
195  }
196 
197  //Return the jacobian
198  return J;
199 }
200 
201 
202 //======================================================================
203 /// Define the shape functions and test functions and derivatives
204 /// w.r.t. global coordinates and return Jacobian of mapping.
205 ///
206 /// Galerkin: Test functions = shape functions
207 //======================================================================
208 template<unsigned DIM,unsigned NNODE_1D>
211  const unsigned &ipt,
212  Shape &psi,
213  DShape &dpsidx,
214  Shape &test,
215  DShape &dtestdx) const
216 {
217  //Call the geometrical shape functions and derivatives
218  double J = this->dshape_eulerian_at_knot(ipt,psi,dpsidx);
219 
220  //Set the test functions equal to the shape functions
221  //(sets internal pointers)
222  test = psi;
223  dtestdx = dpsidx;
224 
225  //Return the jacobian
226  return J;
227 }
228 
229 
230 ////////////////////////////////////////////////////////////////////////
231 ////////////////////////////////////////////////////////////////////////
232 
233 
234 
235 //=======================================================================
236 /// Face geometry for the TWomersleyElement elements: The spatial
237 /// dimension of the face elements is one lower than that of the
238 /// bulk element but they have the same number of points
239 /// along their 1D edges.
240 //=======================================================================
241 template<unsigned DIM, unsigned NNODE_1D>
242 class FaceGeometry<TWomersleyElement<DIM,NNODE_1D> >:
243 public virtual TElement<DIM-1,NNODE_1D>
244 {
245 
246  public:
247 
248  /// \short Constructor: Call the constructor for the
249  /// appropriate lower-dimensional TElement
250  FaceGeometry() : TElement<DIM-1,NNODE_1D>() {}
251 
252 };
253 
254 
255 ////////////////////////////////////////////////////////////////////////
256 ////////////////////////////////////////////////////////////////////////
257 ////////////////////////////////////////////////////////////////////////
258 
259 
260 //=======================================================================
261 /// Face geometry for the 1D TWomersleyElement elements: Point elements
262 //=======================================================================
263 template<unsigned NNODE_1D>
264 class FaceGeometry<TWomersleyElement<1,NNODE_1D> >:
265  public virtual PointElement
266 {
267 
268  public:
269 
270  /// \short Constructor: Call the constructor for the
271  /// appropriate lower-dimensional TElement
273 
274 };
275 
276 
277 }
278 
279 #endif
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: x,y,u or x,y,z,u at n_plot^DIM plot points.
virtual double dshape_eulerian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidx) const
Return the geometric shape functions and also first derivatives w.r.t. global coordinates at the ipt-...
Definition: elements.cc:3254
void operator=(const TWomersleyElement< DIM, NNODE_1D > &)
Broken assignment operator.
cstr elem_len * i
Definition: cfortran.h:607
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output function for a time-dependent exact solution. x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot ...
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
Definition: elements.h:1729
unsigned required_nvalue(const unsigned &n) const
Required # of `values&#39; (pinned or dofs) at node n.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,y,u or x,y,z,u at n_plot^DIM plot points.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
Definition: elements.h:1723
TWomersleyElement()
Constructor: Call constructors for TElement and Womersley equations.
double dshape_and_dtest_eulerian_womersley(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
double dshape_and_dtest_eulerian_at_knot_womersley(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape/test functions and derivs w.r.t. to global coords at integration point ipt; return Jacobian of ...
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Compute the geometric shape functions and also first derivatives w.r.t. global coordinates at local c...
Definition: elements.cc:3227
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional TElement. ...
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
static char t char * s
Definition: cfortran.h:572
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for an exact solution: x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points...
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,u_exact or x,y,z,u_exact at nplot^DIM plot points.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional TElement. ...
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
void output(FILE *file_pt)
C-style output function: x,y,u or x,y,z,u.
void output(std::ostream &outfile)
Output with default number of plot points.
TWomersleyElement(const TWomersleyElement< DIM, NNODE_1D > &dummy)
Broken copy constructor.