Tpoisson_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 TPoisson elements
27 #ifndef OOMPH_TPOISSON_ELEMENTS_HEADER
28 #define OOMPH_TPOISSON_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 #include "poisson_elements.h"
43 
44 namespace oomph
45 {
48  // TPoissonElement
51 
52 
53  //======================================================================
57  //======================================================================
58  template<unsigned DIM, unsigned NNODE_1D>
59  class TPoissonElement : public virtual TElement<DIM, NNODE_1D>,
60  public virtual PoissonEquations<DIM>,
61  public virtual ElementWithZ2ErrorEstimator
62  {
63  public:
67 
68 
71 
74 
77  inline unsigned required_nvalue(const unsigned& n) const
78  {
79  return Initial_Nvalue;
80  }
81 
84  void output(std::ostream& outfile)
85  {
87  }
88 
91  void output(std::ostream& outfile, const unsigned& n_plot)
92  {
93  PoissonEquations<DIM>::output(outfile, n_plot);
94  }
95 
96 
99  void output(FILE* file_pt)
100  {
102  }
103 
104 
107  void output(FILE* file_pt, const unsigned& n_plot)
108  {
109  PoissonEquations<DIM>::output(file_pt, n_plot);
110  }
111 
112 
115  void output_fct(std::ostream& outfile,
116  const unsigned& n_plot,
118  {
119  PoissonEquations<DIM>::output_fct(outfile, n_plot, exact_soln_pt);
120  }
121 
122 
125  void output_fct(std::ostream& outfile,
126  const unsigned& n_plot,
127  const double& time,
129  {
130  PoissonEquations<DIM>::output_fct(outfile, n_plot, time, exact_soln_pt);
131  }
132 
133  protected:
137  Shape& psi,
138  DShape& dpsidx,
139  Shape& test,
140  DShape& dtestdx) const;
141 
142 
146  const unsigned& ipt,
147  Shape& psi,
148  DShape& dpsidx,
149  Shape& test,
150  DShape& dtestdx) const;
151 
156  const unsigned& ipt,
157  Shape& psi,
158  DShape& dpsidx,
159  RankFourTensor<double>& d_dpsidx_dX,
160  Shape& test,
161  DShape& dtestdx,
162  RankFourTensor<double>& d_dtestdx_dX,
163  DenseMatrix<double>& djacobian_dX) const;
164 
167  unsigned nrecovery_order()
168  {
169  return (NNODE_1D - 1);
170  }
171 
173  unsigned num_Z2_flux_terms()
174  {
175  return DIM;
176  }
177 
180  {
181  this->get_flux(s, flux);
182  }
183 
185  unsigned nvertex_node() const
186  {
188  }
189 
191  Node* vertex_node_pt(const unsigned& j) const
192  {
194  }
195 
196  private:
198  static const unsigned Initial_Nvalue;
199  };
200 
201 
202  // Inline functions:
203 
204 
205  //======================================================================
210  //======================================================================
211  template<unsigned DIM, unsigned NNODE_1D>
213  const Vector<double>& s,
214  Shape& psi,
215  DShape& dpsidx,
216  Shape& test,
217  DShape& dtestdx) const
218  {
219  unsigned n_node = this->nnode();
220 
221  // Call the geometrical shape functions and derivatives
222  double J = this->dshape_eulerian(s, psi, dpsidx);
223 
224  // Loop over the test functions and derivatives and set them equal to the
225  // shape functions
226  for (unsigned i = 0; i < n_node; i++)
227  {
228  test[i] = psi[i];
229  dtestdx(i, 0) = dpsidx(i, 0);
230  dtestdx(i, 1) = dpsidx(i, 1);
231  }
232 
233  // Return the jacobian
234  return J;
235  }
236 
237 
238  //======================================================================
243  //======================================================================
244  template<unsigned DIM, unsigned NNODE_1D>
247  Shape& psi,
248  DShape& dpsidx,
249  Shape& test,
250  DShape& dtestdx) const
251  {
252  // Call the geometrical shape functions and derivatives
253  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
254 
255  // Set the pointers of the test functions
256  test = psi;
257  dtestdx = dpsidx;
258 
259  // Return the jacobian
260  return J;
261  }
262 
263 
264  //======================================================================
271  //======================================================================
272  template<unsigned DIM, unsigned NNODE_1D>
275  const unsigned& ipt,
276  Shape& psi,
277  DShape& dpsidx,
278  RankFourTensor<double>& d_dpsidx_dX,
279  Shape& test,
280  DShape& dtestdx,
281  RankFourTensor<double>& d_dtestdx_dX,
282  DenseMatrix<double>& djacobian_dX) const
283  {
284  // Call the geometrical shape functions and derivatives
285  const double J = this->dshape_eulerian_at_knot(
286  ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
287 
288  // Set the pointers of the test functions
289  test = psi;
290  dtestdx = dpsidx;
291  d_dtestdx_dX = d_dpsidx_dX;
292 
293  // Return the jacobian
294  return J;
295  }
296 
297 
298  //=======================================================================
303  //=======================================================================
304  template<unsigned DIM, unsigned NNODE_1D>
305  class FaceGeometry<TPoissonElement<DIM, NNODE_1D>>
306  : public virtual TElement<DIM - 1, NNODE_1D>
307  {
308  public:
311  FaceGeometry() : TElement<DIM - 1, NNODE_1D>() {}
312  };
313 
314  //=======================================================================
316  //=======================================================================
317  template<unsigned NNODE_1D>
318  class FaceGeometry<TPoissonElement<1, NNODE_1D>> : public virtual PointElement
319  {
320  public:
324  };
325 
326 
327 } // namespace oomph
328 
329 #endif
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: error_estimator.h:79
FaceGeometry()
Definition: Tpoisson_elements.h:323
FaceGeometry()
Definition: Tpoisson_elements.h:311
Definition: elements.h:4998
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Definition: elements.h:1759
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Definition: elements.h:1765
Definition: nodes.h:906
Definition: elements.h:3439
Definition: poisson_elements.h:56
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: poisson_elements.h:214
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: flux[i] = du/dx_i.
Definition: poisson_elements.h:364
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: poisson_elements.cc:400
A Rank 4 Tensor class.
Definition: matrices.h:1701
Definition: shape.h:76
Definition: Telements.h:1208
Definition: Tpoisson_elements.h:62
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Definition: Tpoisson_elements.h:125
void output(FILE *file_pt)
Definition: Tpoisson_elements.h:99
void output(std::ostream &outfile)
Definition: Tpoisson_elements.h:84
TPoissonElement()
Definition: Tpoisson_elements.h:66
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: Tpoisson_elements.h:115
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
Definition: Tpoisson_elements.h:173
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: Tpoisson_elements.h:185
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: Tpoisson_elements.h:91
double dshape_and_dtest_eulerian_at_knot_poisson(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tpoisson_elements.h:246
void output(FILE *file_pt, const unsigned &n_plot)
Definition: Tpoisson_elements.h:107
double dshape_and_dtest_eulerian_poisson(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tpoisson_elements.h:212
unsigned required_nvalue(const unsigned &n) const
Definition: Tpoisson_elements.h:77
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: Tpoisson_elements.h:191
void operator=(const TPoissonElement< DIM, NNODE_1D > &)=delete
Broken assignment operator.
TPoissonElement(const TPoissonElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Standard flux.from Poisson equations.
Definition: Tpoisson_elements.h:179
static const unsigned Initial_Nvalue
Static unsigned that holds the (same) number of variables at every node.
Definition: Tpoisson_elements.h:198
unsigned nrecovery_order()
Definition: Tpoisson_elements.h:167
RealScalar s
Definition: level1_cplx_impl.h:130
#define DIM
Definition: linearised_navier_stokes_elements.h:44
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