Tfoeppl_von_karman_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-2024 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 TFoepplvonKarman elements
27 #ifndef OOMPH_TFOEPPLVONKARMAN_ELEMENTS_HEADER
28 #define OOMPH_TFOEPPLVONKARMAN_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 
44 
45 namespace oomph
46 {
47  /// //////////////////////////////////////////////////////////////////////
48  /// //////////////////////////////////////////////////////////////////////
49  // TFoepplvonKarmanElement
50  /// /////////////////////////////////////////////////////////////////////
51  /// /////////////////////////////////////////////////////////////////////
52 
53 
54  //======================================================================
55  /// TFoepplvonKarmanElement<NNODE_1D> elements are isoparametric
56  /// triangular 2-dimensional Foeppl von Karman elements with NNODE_1D
57  /// nodal points along each element edge. Inherits from TElement and
58  /// FoepplvonKarmanEquations
59  //======================================================================
60  template<unsigned NNODE_1D>
61  class TFoepplvonKarmanElement : public virtual TElement<2, NNODE_1D>,
62  public virtual FoepplvonKarmanEquations,
63  public virtual ElementWithZ2ErrorEstimator
64  {
65  public:
66  /// Constructor: Call constructors for TElement and
67  /// Foeppl von Karman equations
69  : TElement<2, NNODE_1D>(), FoepplvonKarmanEquations()
70  {
71  }
72 
73 
74  /// Broken copy constructor
76  delete;
77 
78  /// Broken assignment operator
80 
81  /// Access function for Nvalue: # of `values' (pinned or dofs)
82  /// at node n (always returns the same value at every node, 8)
83  inline unsigned required_nvalue(const unsigned& n) const
84  {
85  return Initial_Nvalue;
86  }
87 
88  /// Output function:
89  /// x,y,w
90  void output(std::ostream& outfile)
91  {
93  }
94 
95  /// Output function:
96  /// x,y,w at n_plot^2 plot points
97  void output(std::ostream& outfile, const unsigned& n_plot)
98  {
99  FoepplvonKarmanEquations::output(outfile, n_plot);
100  }
101 
102 
103  /// C-style output function:
104  /// x,y,w
105  void output(FILE* file_pt)
106  {
108  }
109 
110 
111  /// C-style output function:
112  /// x,y,w at n_plot^2 plot points
113  void output(FILE* file_pt, const unsigned& n_plot)
114  {
115  FoepplvonKarmanEquations::output(file_pt, n_plot);
116  }
117 
118 
119  /// Output function for an exact solution:
120  /// x,y,w_exact
121  void output_fct(std::ostream& outfile,
122  const unsigned& n_plot,
124  {
125  FoepplvonKarmanEquations::output_fct(outfile, n_plot, exact_soln_pt);
126  }
127 
128 
129  /// Output function for a time-dependent exact solution.
130  /// x,y,w_exact (calls the steady version)
131  void output_fct(std::ostream& outfile,
132  const unsigned& n_plot,
133  const double& time,
135  {
137  outfile, n_plot, time, exact_soln_pt);
138  }
139 
140  protected:
141  /// Shape, test functions & derivs. w.r.t. to global coords. Return
142  /// Jacobian.
143  inline double dshape_and_dtest_eulerian_fvk(const Vector<double>& s,
144  Shape& psi,
145  DShape& dpsidx,
146  Shape& test,
147  DShape& dtestdx) const;
148 
149 
150  /// Shape, test functions & derivs. w.r.t. to global coords. Return
151  /// Jacobian.
152  inline double dshape_and_dtest_eulerian_at_knot_fvk(const unsigned& ipt,
153  Shape& psi,
154  DShape& dpsidx,
155  Shape& test,
156  DShape& dtestdx) const;
157 
158  /// Order of recovery shape functions for Z2 error estimation:
159  /// Same order as shape functions.
160  unsigned nrecovery_order()
161  {
162  return (NNODE_1D - 1);
163  }
164 
165  /// Number of 'flux' terms for Z2 error estimation
166  unsigned num_Z2_flux_terms()
167  {
168  return 2;
169  }
170 
171  /// Get 'flux' for Z2 error recovery: Standard flux.from FvK equations
173  {
174  this->get_gradient_of_deflection(s, flux);
175  }
176 
177  /// Number of vertex nodes in the element
178  unsigned nvertex_node() const
179  {
181  }
182 
183  /// Pointer to the j-th vertex node in the element
184  Node* vertex_node_pt(const unsigned& j) const
185  {
187  }
188 
189  private:
190  /// Static unsigned that holds the (same) number of variables at every node
191  static const unsigned Initial_Nvalue;
192  };
193 
194 
195  // Inline functions:
196 
197 
198  //======================================================================
199  /// Define the shape functions and test functions and derivatives
200  /// w.r.t. global coordinates and return Jacobian of mapping.
201  ///
202  /// Galerkin: Test functions = shape functions
203  //======================================================================
204  template<unsigned NNODE_1D>
206  const Vector<double>& s,
207  Shape& psi,
208  DShape& dpsidx,
209  Shape& test,
210  DShape& dtestdx) const
211  {
212  unsigned n_node = this->nnode();
213 
214  // Call the geometrical shape functions and derivatives
215  double J = this->dshape_eulerian(s, psi, dpsidx);
216 
217  // Loop over the test functions and derivatives and set them equal to the
218  // shape functions
219  for (unsigned i = 0; i < n_node; i++)
220  {
221  test[i] = psi[i];
222  dtestdx(i, 0) = dpsidx(i, 0);
223  dtestdx(i, 1) = dpsidx(i, 1);
224  }
225 
226  // Return the jacobian
227  return J;
228  }
229 
230 
231  //======================================================================
232  /// Define the shape functions and test functions and derivatives
233  /// w.r.t. global coordinates and return Jacobian of mapping.
234  ///
235  /// Galerkin: Test functions = shape functions
236  //======================================================================
237  template<unsigned NNODE_1D>
239  NNODE_1D>::dshape_and_dtest_eulerian_at_knot_fvk(const unsigned& ipt,
240  Shape& psi,
241  DShape& dpsidx,
242  Shape& test,
243  DShape& dtestdx) const
244  {
245  // Call the geometrical shape functions and derivatives
246  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
247 
248  // Set the pointers of the test functions
249  test = psi;
250  dtestdx = dpsidx;
251 
252  // Return the jacobian
253  return J;
254  }
255 
256 
257  //=======================================================================
258  /// Face geometry for the TFoepplvonKarmanElement elements: The spatial
259  /// dimension of the face elements is one lower than that of the
260  /// bulk element but they have the same number of points
261  /// along their 1D edges.
262  //=======================================================================
263  template<unsigned NNODE_1D>
265  : public virtual TElement<1, NNODE_1D>
266  {
267  public:
268  /// Constructor: Call the constructor for the
269  /// appropriate lower-dimensional TElement
270  FaceGeometry() : TElement<1, NNODE_1D>() {}
271  };
272 
273 } // namespace oomph
274 
275 #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
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional TElement.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition: elements.h:5002
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as .
Definition: elements.h:1763
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
Definition: elements.h:1769
A class for all isoparametric elements that solve the Foeppl von Karman equations.
void get_gradient_of_deflection(const Vector< double > &s, Vector< double > &gradient) const
Get gradient of deflection: gradient[i] = dw/dx_i.
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,w_exact at n_plot^DIM plot points.
void output(std::ostream &outfile)
Output with default number of plot points.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:906
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
//////////////////////////////////////////////////////////////////////
TFoepplvonKarmanElement()
Constructor: Call constructors for TElement and Foeppl von Karman equations.
unsigned required_nvalue(const unsigned &n) const
Access function for Nvalue: # of ‘values’ (pinned or dofs) at node n (always returns the same value a...
static const unsigned Initial_Nvalue
Static unsigned that holds the (same) number of variables at every node.
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
double dshape_and_dtest_eulerian_at_knot_fvk(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
TFoepplvonKarmanElement(const TFoepplvonKarmanElement< NNODE_1D > &dummy)=delete
Broken copy constructor.
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,w_exact (calls the steady version)
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
void operator=(const TFoepplvonKarmanElement< NNODE_1D > &)=delete
Broken assignment operator.
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for an exact solution: x,y,w_exact.
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Standard flux.from FvK equations.
void output(std::ostream &outfile)
Output function: x,y,w.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,y,w at n_plot^2 plot points.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: x,y,w at n_plot^2 plot points.
void output(FILE *file_pt)
C-style output function: x,y,w.
double dshape_and_dtest_eulerian_fvk(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.
unsigned nvertex_node() const
Number of vertex nodes in the element.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...