Tdisplacement_based_foeppl_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-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 TFoepplvonKarman elements
27 #ifndef OOMPH_TFOEPPLVONKARMAN_DISPLACEMENT_ELEMENTS_HEADER
28 #define OOMPH_TFOEPPLVONKARMAN_DISPLACEMENT_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  // TDisplacementBasedFoepplvonKarmanElement
50  /// /////////////////////////////////////////////////////////////////////
51  /// /////////////////////////////////////////////////////////////////////
52 
53 
54  // -----------------------------------------------------------------------
55  // THE TRIANGLE ELEMENT
56  // -----------------------------------------------------------------------
57 
58 
59  //======================================================================
60  /// TDisplacementBasedFoepplvonKarmanElement<NNODE_1D> elements are
61  /// isoparametric
62  /// triangular 2-dimensional Foeppl von Karman elements with NNODE_1D
63  /// nodal points along each element edge. Inherits from TElement and
64  /// DisplacementBasedFoepplvonKarmanEquations
65  //======================================================================
66  template<unsigned NNODE_1D>
68  : public virtual TElement<2, NNODE_1D>,
70  public virtual ElementWithZ2ErrorEstimator
71  {
72  public:
73  /// Constructor: Call constructors for TElement and
74  /// Foeppl von Karman equations
77  {
78  }
79 
80 
81  /// Broken copy constructor
84 
85  /// Broken assignment operator
87  delete;
88 
89  /// Access function for Nvalue: # of `values' (pinned or
90  /// dofs) at node n (always returns the same value at every node, 4)
91  inline unsigned required_nvalue(const unsigned& n) const
92  {
93  return Initial_Nvalue;
94  }
95 
96  /// The number of dof types that degrees of freedom in this
97  /// element are sub-divided into
98  unsigned ndof_types() const
99  {
100  // NOTE: this assumes "clamped" bcs
101  // [0]: laplacian w interior
102  // [1]: laplacian w boundary
103  // [2]: W
104  // [3]: Ux
105  // [4]: Uy
106  return 5;
107  }
108 
109  /// Create a list of pairs for all unknowns in this element,
110  /// so that the first entry in each pair contains the global
111  /// equation number of the unknown, while the second one contains
112  /// the number of the dof type that this unknown is associated with.
113  /// (Function can obviously only be called if the equation numbering
114  /// scheme has been set up.)
115  /// Dof_types
116  /// 0,1: Laplacian;
117  /// 2: Bending w
118  /// 3: Displacements Ux and Uy
119  /// The indexing of the dofs in the element is like below
120  /// [0]: w
121  /// [1]: laplacian w
122  /// [2]: U_x
123  /// [3]: U_y
125  std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list) const
126  {
127  // number of nodes
128  const unsigned n_node = this->nnode();
129 
130  // temporary pair (used to store dof lookup prior to being added to list)
131  std::pair<unsigned, unsigned> dof_lookup;
132 
133  // loop over the nodes
134  for (unsigned n = 0; n < n_node; n++)
135  {
136  // Zeroth nodal value: displacement
137  //---------------------------------
138  unsigned v = 0;
139 
140  // determine local eqn number
141  int local_eqn_number = this->nodal_local_eqn(n, v);
142 
143  // ignore pinned values
144  if (local_eqn_number >= 0)
145  {
146  // store dof lookup in temporary pair: Global equation
147  // number is the first entry in pair
148  dof_lookup.first = this->eqn_number(local_eqn_number);
149 
150  // set dof type numbers: Dof type is the second entry in pair
151  dof_lookup.second = 2;
152 
153  // add to list
154  dof_lookup_list.push_front(dof_lookup);
155  }
156 
157  // First nodal value: Laplacian
158  //-----------------------------
159  v = 1;
160 
161  // determine local eqn number
162  local_eqn_number = this->nodal_local_eqn(n, v);
163 
164  // ignore pinned values
165  if (local_eqn_number >= 0)
166  {
167  // store dof lookup in temporary pair: Global equation
168  // number is the first entry in pair
169  dof_lookup.first = this->eqn_number(local_eqn_number);
170 
171  // Is it a boundary node? If so: It's dof type 1
172  if (node_pt(n)->is_on_boundary(0) || node_pt(n)->is_on_boundary(1))
173  {
174  dof_lookup.second = 1;
175  }
176  // otherwise it's in the interior: It's dof type 0
177  else
178  {
179  dof_lookup.second = 0;
180  }
181 
182  // add to list
183  dof_lookup_list.push_front(dof_lookup);
184  }
185 
186  // Second nodal value: U_x
187  //---------------------------------
188  v = 2;
189 
190  // determine local eqn number
191  local_eqn_number = this->nodal_local_eqn(n, v);
192 
193  // ignore pinned values
194  if (local_eqn_number >= 0)
195  {
196  // store dof lookup in temporary pair: Global equation
197  // number is the first entry in pair
198  dof_lookup.first = this->eqn_number(local_eqn_number);
199 
200  // set dof type numbers: Dof type is the second entry in pair
201  dof_lookup.second = 3;
202 
203  // add to list
204  dof_lookup_list.push_front(dof_lookup);
205  }
206 
207  // Third nodal value: U_y
208  //---------------------------------
209  v = 3;
210 
211  // determine local eqn number
212  local_eqn_number = this->nodal_local_eqn(n, v);
213 
214  // ignore pinned values
215  if (local_eqn_number >= 0)
216  {
217  // store dof lookup in temporary pair: Global equation
218  // number is the first entry in pair
219  dof_lookup.first = this->eqn_number(local_eqn_number);
220 
221  // set dof type numbers: Dof type is the second entry in pair
222  dof_lookup.second = 4;
223 
224  // add to list
225  dof_lookup_list.push_front(dof_lookup);
226  }
227 
228  } // for (n < n_node)
229  }
230 
231  /// Output function:
232  /// x,y,w
233  void output(std::ostream& outfile)
234  {
236  }
237 
238  /// Output function:
239  /// x,y,w at n_plot^2 plot points
240  void output(std::ostream& outfile, const unsigned& n_plot)
241  {
243  }
244 
245 
246  /// C-style output function:
247  /// x,y,w
248  void output(FILE* file_pt)
249  {
251  }
252 
253 
254  /// C-style output function:
255  /// x,y,w at n_plot^2 plot points
256  void output(FILE* file_pt, const unsigned& n_plot)
257  {
259  }
260 
261 
262  /// Output function for an exact solution:
263  /// x,y,w_exact
264  void output_fct(std::ostream& outfile,
265  const unsigned& n_plot,
267  {
269  outfile, n_plot, exact_soln_pt);
270  }
271 
272 
273  /// Output function for a time-dependent exact solution.
274  /// x,y,w_exact (calls the steady version)
275  void output_fct(std::ostream& outfile,
276  const unsigned& n_plot,
277  const double& time,
279  {
281  outfile, n_plot, time, exact_soln_pt);
282  }
283 
284  protected:
285  /// Shape, test functions & derivs. w.r.t. to global coords. Return
286  /// Jacobian.
287  inline double dshape_and_dtest_eulerian_fvk(const Vector<double>& s,
288  Shape& psi,
289  DShape& dpsidx,
290  Shape& test,
291  DShape& dtestdx) const;
292 
293 
294  /// Shape, test functions & derivs. w.r.t. to global coords. Return
295  /// Jacobian.
296  inline double dshape_and_dtest_eulerian_at_knot_fvk(const unsigned& ipt,
297  Shape& psi,
298  DShape& dpsidx,
299  Shape& test,
300  DShape& dtestdx) const;
301 
302  /// Order of recovery shape functions for Z2 error estimation:
303  /// Same order as shape functions.
304  unsigned nrecovery_order()
305  {
306  return (NNODE_1D - 1);
307  }
308 
309  /// Number of 'flux' terms for Z2 error estimation
310  unsigned num_Z2_flux_terms()
311  {
312  return 2;
313  } // The dimension
314 
315  /// Get 'flux' for Z2 error recovery: Standard flux.from FvK equations
317  {
318  this->get_gradient_of_deflection(s, flux);
319  }
320 
321  /// Number of vertex nodes in the element
322  unsigned nvertex_node() const
323  {
325  }
326 
327  /// Pointer to the j-th vertex node in the element
328  Node* vertex_node_pt(const unsigned& j) const
329  {
331  }
332 
333  private:
334  /// Static unsigned that holds the (same) number of variables at every node
335  static const unsigned Initial_Nvalue;
336  };
337 
338 
339  // Inline functions:
340 
341 
342  //======================================================================
343  /// Define the shape functions and test functions and derivatives
344  /// w.r.t. global coordinates and return Jacobian of mapping.
345  ///
346  /// Galerkin: Test functions = shape functions
347  //======================================================================
348  template<unsigned NNODE_1D>
350  NNODE_1D>::dshape_and_dtest_eulerian_fvk(const Vector<double>& s,
351  Shape& psi,
352  DShape& dpsidx,
353  Shape& test,
354  DShape& dtestdx) const
355  {
356  unsigned n_node = this->nnode();
357 
358  // Call the geometrical shape functions and derivatives
359  double J = this->dshape_eulerian(s, psi, dpsidx);
360 
361  // Loop over the test functions and derivatives and set them equal to the
362  // shape functions
363  for (unsigned i = 0; i < n_node; i++)
364  {
365  test[i] = psi[i];
366  dtestdx(i, 0) = dpsidx(i, 0);
367  dtestdx(i, 1) = dpsidx(i, 1);
368  }
369 
370  // Return the jacobian
371  return J;
372  }
373 
374 
375  //======================================================================
376  /// Define the shape functions and test functions and derivatives
377  /// w.r.t. global coordinates and return Jacobian of mapping.
378  ///
379  /// Galerkin: Test functions = shape functions
380  //======================================================================
381  template<unsigned NNODE_1D>
383  NNODE_1D>::dshape_and_dtest_eulerian_at_knot_fvk(const unsigned& ipt,
384  Shape& psi,
385  DShape& dpsidx,
386  Shape& test,
387  DShape& dtestdx) const
388  {
389  // Call the geometrical shape functions and derivatives
390  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
391 
392  // Set the pointers of the test functions
393  test = psi;
394  dtestdx = dpsidx;
395 
396  // Return the jacobian
397  return J;
398  }
399 
400 
401  //=======================================================================
402  /// Face geometry for the TDisplacementBasedFoepplvonKarmanElement
403  // elements:The spatial / dimension of the face elements is one lower
404  // than that of the / bulk element but they have the same number of
405  // points / along their 1D edges.
406  //=======================================================================
407  template<unsigned NNODE_1D>
409  : public virtual TElement<1, NNODE_1D>
410  {
411  public:
412  /// Constructor: Call the constructor for the
413  /// appropriate lower-dimensional TElement
414  FaceGeometry() : TElement<1, NNODE_1D>() {}
415  };
416 
417 } // namespace oomph
418 
419 #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
A class for all isoparametric elements that solve the Foeppl von Karman equations.
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.
void get_gradient_of_deflection(const Vector< double > &s, Vector< double > &gradient) const
Get gradient of deflection: gradient[i] = dw/dx_i.
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:4998
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node.
Definition: elements.h:1432
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
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
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number.
Definition: elements.h:704
int local_eqn_number(const unsigned long &ieqn_global) const
Return the local equation number corresponding to the ieqn_global-th global equation number....
Definition: elements.h:726
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
//////////////////////////////////////////////////////////////////////
void operator=(const TDisplacementBasedFoepplvonKarmanElement< NNODE_1D > &)=delete
Broken assignment operator.
TDisplacementBasedFoepplvonKarmanElement()
Constructor: Call constructors for TElement and Foeppl von Karman equations.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: x,y,w at n_plot^2 plot points.
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
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.
static const unsigned Initial_Nvalue
Static unsigned that holds the (same) number of variables at every node.
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...
unsigned ndof_types() const
The number of dof types that degrees of freedom in this element are sub-divided into.
unsigned nvertex_node() const
Number of vertex nodes in the element.
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Standard flux.from FvK equations.
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.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,y,w at n_plot^2 plot points.
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.
TDisplacementBasedFoepplvonKarmanElement(const TDisplacementBasedFoepplvonKarmanElement< 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)
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Create a list of pairs for all unknowns in this element, so that the first entry in each pair contain...
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
General TElement class.
Definition: Telements.h:1208
//////////////////////////////////////////////////////////////////// ////////////////////////////////...