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-2022 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 {
49  // TDisplacementBasedFoepplvonKarmanElement
52 
53 
54  // -----------------------------------------------------------------------
55  // THE TRIANGLE ELEMENT
56  // -----------------------------------------------------------------------
57 
58 
59  //======================================================================
65  //======================================================================
66  template<unsigned NNODE_1D>
68  : public virtual TElement<2, NNODE_1D>,
70  public virtual ElementWithZ2ErrorEstimator
71  {
72  public:
77  {
78  }
79 
80 
84 
87  delete;
88 
91  inline unsigned required_nvalue(const unsigned& n) const
92  {
93  return Initial_Nvalue;
94  }
95 
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 
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 
233  void output(std::ostream& outfile)
234  {
236  }
237 
240  void output(std::ostream& outfile, const unsigned& n_plot)
241  {
243  }
244 
245 
248  void output(FILE* file_pt)
249  {
251  }
252 
253 
256  void output(FILE* file_pt, const unsigned& n_plot)
257  {
259  }
260 
261 
264  void output_fct(std::ostream& outfile,
265  const unsigned& n_plot,
267  {
269  outfile, n_plot, exact_soln_pt);
270  }
271 
272 
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:
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 
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 
304  unsigned nrecovery_order()
305  {
306  return (NNODE_1D - 1);
307  }
308 
310  unsigned num_Z2_flux_terms()
311  {
312  return 2;
313  } // The dimension
314 
317  {
319  }
320 
322  unsigned nvertex_node() const
323  {
325  }
326 
328  Node* vertex_node_pt(const unsigned& j) const
329  {
331  }
332 
333  private:
335  static const unsigned Initial_Nvalue;
336  };
337 
338 
339  // Inline functions:
340 
341 
342  //======================================================================
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  //======================================================================
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  //=======================================================================
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:
414  FaceGeometry() : TElement<1, NNODE_1D>() {}
415  };
416 
417 } // namespace oomph
418 
419 #endif
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
Definition: shape.h:278
Definition: displacement_based_foeppl_von_karman_elements.h:55
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.
Definition: displacement_based_foeppl_von_karman_elements.cc:176
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: displacement_based_foeppl_von_karman_elements.h:130
void get_gradient_of_deflection(const Vector< double > &s, Vector< double > &gradient) const
Get gradient of deflection: gradient[i] = dw/dx_i.
Definition: displacement_based_foeppl_von_karman_elements.h:256
Definition: error_estimator.h:79
FaceGeometry()
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:414
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
Definition: elements.h:1432
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Definition: elements.h:1759
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Definition: elements.h:1765
unsigned long eqn_number(const unsigned &ieqn_local) const
Definition: elements.h:704
int local_eqn_number(const unsigned long &ieqn_global) const
Definition: elements.h:726
Definition: nodes.h:906
Definition: shape.h:76
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:71
void operator=(const TDisplacementBasedFoepplvonKarmanElement< NNODE_1D > &)=delete
Broken assignment operator.
TDisplacementBasedFoepplvonKarmanElement()
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:75
void output(FILE *file_pt, const unsigned &n_plot)
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:256
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:310
void output(std::ostream &outfile)
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:233
double dshape_and_dtest_eulerian_fvk(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:350
static const unsigned Initial_Nvalue
Static unsigned that holds the (same) number of variables at every node.
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:335
void output(FILE *file_pt)
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:248
unsigned required_nvalue(const unsigned &n) const
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:91
unsigned ndof_types() const
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:98
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:322
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Standard flux.from FvK equations.
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:316
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:264
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:240
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:328
double dshape_and_dtest_eulerian_at_knot_fvk(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:383
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)
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:275
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:124
unsigned nrecovery_order()
Definition: Tdisplacement_based_foeppl_von_karman_elements.h:304
Definition: Telements.h:1208
RealScalar s
Definition: level1_cplx_impl.h:130
void flux(const double &time, const Vector< double > &x, double &flux)
Get flux applied along boundary x=0.
Definition: pretend_melt.cc:59
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
Definition: indexed_view.cpp:20
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2