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