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// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
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_ELEMENTS_HEADER
32 #define OOMPH_TFOEPPLVONKARMAN_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 // TFoepplvonKarmanElement
55 ////////////////////////////////////////////////////////////////////////
56 ////////////////////////////////////////////////////////////////////////
57 
58 
59 
60 //======================================================================
61 /// TFoepplvonKarmanElement<NNODE_1D> elements are isoparametric
62 /// triangular 2-dimensional Foeppl von Karman elements with NNODE_1D
63 /// nodal points along each element edge. Inherits from TElement and
64 /// FoepplvonKarmanEquations
65 //======================================================================
66 template <unsigned NNODE_1D>
67 class TFoepplvonKarmanElement : public virtual TElement<2,NNODE_1D>,
68  public virtual FoepplvonKarmanEquations,
69  public virtual ElementWithZ2ErrorEstimator
70 {
71 
72  public:
73 
74  ///\short Constructor: Call constructors for TElement and
75  /// Foeppl von Karman equations
77  { }
78 
79 
80  /// Broken copy constructor
82  {
83  BrokenCopy::broken_copy("TFoepplvonKarmanElement");
84  }
85 
86  /// Broken assignment operator
88  {
89  BrokenCopy::broken_assign("TFoepplvonKarmanElement");
90  }
91 
92  /// \short Access function for Nvalue: # of `values' (pinned or dofs)
93  /// at node n (always returns the same value at every node, 8)
94  inline unsigned required_nvalue(const unsigned &n) const
95  {return Initial_Nvalue;}
96 
97  /// \short Output function:
98  /// x,y,w
99  void output(std::ostream &outfile)
100  {
102  }
103 
104  /// \short Output function:
105  /// x,y,w at n_plot^2 plot points
106  void output(std::ostream &outfile, const unsigned &n_plot)
107  {
108  FoepplvonKarmanEquations::output(outfile,n_plot);
109  }
110 
111 
112  /// \short C-style output function:
113  /// x,y,w
114  void output(FILE* file_pt)
115  {
117  }
118 
119 
120  /// \short C-style output function:
121  /// x,y,w at n_plot^2 plot points
122  void output(FILE* file_pt, const unsigned &n_plot)
123  {
124  FoepplvonKarmanEquations::output(file_pt,n_plot);
125  }
126 
127 
128  /// \short Output function for an exact solution:
129  /// x,y,w_exact
130  void output_fct(std::ostream &outfile, const unsigned &n_plot,
132  {
133  FoepplvonKarmanEquations::output_fct(outfile,n_plot,exact_soln_pt);
134  }
135 
136 
137  /// \short Output function for a time-dependent exact solution.
138  /// x,y,w_exact (calls the steady version)
139  void output_fct(std::ostream &outfile, const unsigned &n_plot,
140  const double& time,
142  {
143  FoepplvonKarmanEquations::output_fct(outfile,n_plot,time,exact_soln_pt);
144  }
145 
146 protected:
147 
148  /// Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
149  inline double dshape_and_dtest_eulerian_fvk(const Vector<double> &s,
150  Shape &psi,
151  DShape &dpsidx,
152  Shape &test,
153  DShape &dtestdx) const;
154 
155 
156  /// Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
157  inline double dshape_and_dtest_eulerian_at_knot_fvk(const unsigned &ipt,
158  Shape &psi,
159  DShape &dpsidx,
160  Shape &test,
161  DShape &dtestdx)
162  const;
163 
164  /// \short Order of recovery shape functions for Z2 error estimation:
165  /// Same order as shape functions.
166  unsigned nrecovery_order() {return (NNODE_1D-1);}
167 
168  /// Number of 'flux' terms for Z2 error estimation
169  unsigned num_Z2_flux_terms() {return 2;}
170 
171  /// Get 'flux' for Z2 error recovery: Standard flux.from FvK equations
173  {this->get_gradient_of_deflection(s,flux);}
174 
175  /// \short Number of vertex nodes in the element
176  unsigned nvertex_node() const
178 
179  /// \short Pointer to the j-th vertex node in the element
180  Node* vertex_node_pt(const unsigned& j) const
182 
183 private:
184 
185  /// Static unsigned that holds the (same) number of variables at every node
186  static const unsigned Initial_Nvalue;
187 
188 
189 };
190 
191 
192 
193 
194 //Inline functions:
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 NNODE_1D>
205  const Vector<double> &s,
206  Shape &psi,
207  DShape &dpsidx,
208  Shape &test,
209  DShape &dtestdx) const
210 {
211  unsigned n_node = this->nnode();
212 
213  //Call the geometrical shape functions and derivatives
214  double J = this->dshape_eulerian(s,psi,dpsidx);
215 
216  //Loop over the test functions and derivatives and set them equal to the
217  //shape functions
218  for(unsigned i=0;i<n_node;i++)
219  {
220  test[i] = psi[i];
221  dtestdx(i,0) = dpsidx(i,0);
222  dtestdx(i,1) = dpsidx(i,1);
223  }
224 
225  //Return the jacobian
226  return J;
227 }
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>
240  const unsigned &ipt,
241  Shape &psi,
242  DShape &dpsidx,
243  Shape &test,
244  DShape &dtestdx) const
245 {
246 
247  //Call the geometrical shape functions and derivatives
248  double J = this->dshape_eulerian_at_knot(ipt,psi,dpsidx);
249 
250  //Set the pointers of the test functions
251  test = psi;
252  dtestdx = dpsidx;
253 
254  //Return the jacobian
255  return J;
256 
257 }
258 
259 
260 //=======================================================================
261 /// Face geometry for the TFoepplvonKarmanElement elements: The spatial
262 /// dimension of the face elements is one lower than that of the
263 /// bulk element but they have the same number of points
264 /// along their 1D edges.
265 //=======================================================================
266 template<unsigned NNODE_1D>
268  public virtual TElement<1,NNODE_1D>
269 {
270 
271  public:
272 
273  /// \short Constructor: Call the constructor for the
274  /// appropriate lower-dimensional TElement
275  FaceGeometry() : TElement<1,NNODE_1D>() {}
276 
277 };
278 
279 }
280 
281 #endif
282 
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
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.
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
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 output(FILE *file_pt)
C-style output function: x,y,w.
static const unsigned Initial_Nvalue
Static unsigned that holds the (same) number of variables at every node.
cstr elem_len * i
Definition: cfortran.h:607
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
TFoepplvonKarmanElement()
Constructor: Call constructors for TElement and Foeppl von Karman equations.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,y,w at n_plot^2 plot points.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional TElement. ...
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get &#39;flux&#39; for Z2 error recovery: Standard flux.from FvK equations.
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
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:852
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 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) ...
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)
Broken copy constructor.
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(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
Definition: elements.h:1723
void get_gradient_of_deflection(const Vector< double > &s, Vector< double > &gradient) const
Get gradient of deflection: gradient[i] = dw/dx_i.
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
static char t char * s
Definition: cfortran.h:572
void output(std::ostream &outfile)
Output function: x,y,w.
void operator=(const TFoepplvonKarmanElement< NNODE_1D > &)
Broken assignment operator.
void output(std::ostream &outfile)
Output with default number of plot points.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: x,y,w at n_plot^2 plot points.
unsigned required_nvalue(const unsigned &n) const
Access function for Nvalue: # of `values&#39; (pinned or dofs) at node n (always returns the same value a...
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
unsigned num_Z2_flux_terms()
Number of &#39;flux&#39; terms for Z2 error estimation.
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
unsigned nvertex_node() const
Number of vertex nodes in the element.
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2146