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