Tunsteady_heat_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 TUnsteadyHeat elements
27 #ifndef OOMPH_TUNSTEADY_HEAT_ELEMENTS_HEADER
28 #define OOMPH_TUNSTEADY_HEAT_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 "unsteady_heat_elements.h"
43 
44 namespace oomph
45 {
48  // TUnsteadyHeatElement
51 
52 
53  //======================================================================
57  //======================================================================
58  template<unsigned DIM, unsigned NNODE_1D>
59  class TUnsteadyHeatElement : public virtual TElement<DIM, NNODE_1D>,
60  public virtual UnsteadyHeatEquations<DIM>,
61  public virtual ElementWithZ2ErrorEstimator
62  {
63  public:
67  : TElement<DIM, NNODE_1D>(), UnsteadyHeatEquations<DIM>()
68  {
69  }
70 
71 
74  delete;
75 
77  // Commented out broken assignment operator because this can lead to a
78  // conflict warning when used in the virtual inheritence hierarchy.
79  // Essentially the compiler doesn't realise that two separate
80  // implementations of the broken function are the same and so, quite
81  // rightly, it shouts.
82  /*void operator=(const TUnsteadyHeatElement<DIM,NNODE_1D>&) = delete;*/
83 
86  inline unsigned required_nvalue(const unsigned& n) const
87  {
88  return Initial_Nvalue;
89  }
90 
93  void output(std::ostream& outfile)
94  {
96  }
97 
100  void output(std::ostream& outfile, const unsigned& n_plot)
101  {
102  UnsteadyHeatEquations<DIM>::output(outfile, n_plot);
103  }
104 
105 
108  void output(FILE* file_pt)
109  {
111  }
112 
113 
116  void output(FILE* file_pt, const unsigned& n_plot)
117  {
118  UnsteadyHeatEquations<DIM>::output(file_pt, n_plot);
119  }
120 
121 
124  void output_fct(std::ostream& outfile,
125  const unsigned& n_plot,
127  {
128  UnsteadyHeatEquations<DIM>::output_fct(outfile, n_plot, exact_soln_pt);
129  }
130 
131 
134  void output_fct(std::ostream& outfile,
135  const unsigned& n_plot,
136  const double& time,
138  {
140  outfile, n_plot, time, exact_soln_pt);
141  }
142 
143  protected:
147  Shape& psi,
148  DShape& dpsidx,
149  Shape& test,
150  DShape& dtestdx) const;
151 
152 
156  const unsigned& ipt,
157  Shape& psi,
158  DShape& dpsidx,
159  Shape& test,
160  DShape& dtestdx) const;
161 
166  const unsigned& ipt,
167  Shape& psi,
168  DShape& dpsidx,
169  RankFourTensor<double>& d_dpsidx_dX,
170  Shape& test,
171  DShape& dtestdx,
172  RankFourTensor<double>& d_dtestdx_dX,
173  DenseMatrix<double>& djacobian_dX) const;
174 
177  unsigned nrecovery_order()
178  {
179  return (NNODE_1D - 1);
180  }
181 
183  unsigned num_Z2_flux_terms()
184  {
185  return DIM;
186  }
187 
191  {
192  this->get_flux(s, flux);
193  }
194 
196  unsigned nvertex_node() const
197  {
199  }
200 
202  Node* vertex_node_pt(const unsigned& j) const
203  {
205  }
206 
207  private:
209  static const unsigned Initial_Nvalue;
210  };
211 
212 
213  // Inline functions:
214 
215 
216  //======================================================================
221  //======================================================================
222  template<unsigned DIM, unsigned NNODE_1D>
225  Shape& psi,
226  DShape& dpsidx,
227  Shape& test,
228  DShape& dtestdx) const
229  {
230  unsigned n_node = this->nnode();
231 
232  // Call the geometrical shape functions and derivatives
233  double J = this->dshape_eulerian(s, psi, dpsidx);
234 
235  // Loop over the test functions and derivatives and set them equal to the
236  // shape functions
237  for (unsigned i = 0; i < n_node; i++)
238  {
239  test[i] = psi[i];
240  dtestdx(i, 0) = dpsidx(i, 0);
241  dtestdx(i, 1) = dpsidx(i, 1);
242  }
243 
244  // Return the jacobian
245  return J;
246  }
247 
248 
249  //======================================================================
254  //======================================================================
255  template<unsigned DIM, unsigned NNODE_1D>
258  Shape& psi,
259  DShape& dpsidx,
260  Shape& test,
261  DShape& dtestdx) const
262  {
263  // Call the geometrical shape functions and derivatives
264  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
265 
266  // Set the pointers of the test functions
267  test = psi;
268  dtestdx = dpsidx;
269 
270  // Return the jacobian
271  return J;
272  }
273 
274 
275  //======================================================================
282  //======================================================================
283  template<unsigned DIM, unsigned NNODE_1D>
286  const unsigned& ipt,
287  Shape& psi,
288  DShape& dpsidx,
289  RankFourTensor<double>& d_dpsidx_dX,
290  Shape& test,
291  DShape& dtestdx,
292  RankFourTensor<double>& d_dtestdx_dX,
293  DenseMatrix<double>& djacobian_dX) const
294  {
295  // Call the geometrical shape functions and derivatives
296  const double J = this->dshape_eulerian_at_knot(
297  ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
298 
299  // Set the pointers of the test functions
300  test = psi;
301  dtestdx = dpsidx;
302  d_dtestdx_dX = d_dpsidx_dX;
303 
304  // Return the jacobian
305  return J;
306  }
307 
308 
309  //=======================================================================
314  //=======================================================================
315  template<unsigned DIM, unsigned NNODE_1D>
317  : public virtual TElement<DIM - 1, NNODE_1D>
318  {
319  public:
322  FaceGeometry() : TElement<DIM - 1, NNODE_1D>() {}
323  };
324 
325  //=======================================================================
327  //=======================================================================
328  template<unsigned NNODE_1D>
329  class FaceGeometry<TUnsteadyHeatElement<1, NNODE_1D>>
330  : public virtual PointElement
331  {
332  public:
336  };
337 
338 
339 } // namespace oomph
340 
341 #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: Tunsteady_heat_elements.h:335
FaceGeometry()
Definition: Tunsteady_heat_elements.h:322
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
A Rank 4 Tensor class.
Definition: matrices.h:1701
Definition: shape.h:76
Definition: Telements.h:1208
Definition: Tunsteady_heat_elements.h:62
void output(std::ostream &outfile)
Definition: Tunsteady_heat_elements.h:93
double dshape_and_dtest_eulerian_at_knot_ust_heat(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tunsteady_heat_elements.h:257
TUnsteadyHeatElement()
Definition: Tunsteady_heat_elements.h:66
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: Tunsteady_heat_elements.h:100
void output(FILE *file_pt)
Definition: Tunsteady_heat_elements.h:108
unsigned nrecovery_order()
Definition: Tunsteady_heat_elements.h:177
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
Definition: Tunsteady_heat_elements.h:183
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: Tunsteady_heat_elements.h:196
double dshape_and_dtest_eulerian_ust_heat(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tunsteady_heat_elements.h:224
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: Tunsteady_heat_elements.h:124
static const unsigned Initial_Nvalue
Static unsigned that holds the (same) number of variables at every node.
Definition: Tunsteady_heat_elements.h:209
TUnsteadyHeatElement(const TUnsteadyHeatElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Definition: Tunsteady_heat_elements.h:190
void output(FILE *file_pt, const unsigned &n_plot)
Definition: Tunsteady_heat_elements.h:116
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: Tunsteady_heat_elements.h:202
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
Definition: Tunsteady_heat_elements.h:86
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Definition: Tunsteady_heat_elements.h:134
Definition: unsteady_heat_elements.h:72
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: flux[i] = du/dx_i.
Definition: unsteady_heat_elements.h:280
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: unsteady_heat_elements.h:167
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,u_exact or x,y,z,u_exact at nplot^DIM plot points.
Definition: unsteady_heat_elements.cc:366
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