Tadvection_diffusion_reaction_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 TAdvectionDiffusionReaction elements
27 #ifndef OOMPH_TADVECTION_DIFFUSION_REACTION_ELEMENTS_HEADER
28 #define OOMPH_TADVECTION_DIFFUSION_REACTION_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"
43 
44 namespace oomph
45 {
48  // TAdvectionDiffusionReactionElement
51 
52 
53  //======================================================================
60  //======================================================================
61  template<unsigned NREAGENT, unsigned DIM, unsigned NNODE_1D>
63  : public virtual TElement<DIM, NNODE_1D>,
64  public virtual AdvectionDiffusionReactionEquations<NREAGENT, DIM>,
65  public virtual ElementWithZ2ErrorEstimator
66  {
67  public:
71  : TElement<DIM, NNODE_1D>(),
73  {
74  }
75 
76 
80  dummy) = delete;
81 
83  void operator=(
85  delete;
86 
89  inline unsigned required_nvalue(const unsigned& n) const
90  {
91  return NREAGENT;
92  }
93 
96  void output(std::ostream& outfile)
97  {
99  }
100 
103  void output(std::ostream& outfile, const unsigned& n_plot)
104  {
106  n_plot);
107  }
108 
109 
112  void output(FILE* file_pt)
113  {
115  }
116 
117 
120  void output(FILE* file_pt, const unsigned& n_plot)
121  {
123  n_plot);
124  }
125 
126 
129  void output_fct(std::ostream& outfile,
130  const unsigned& n_plot,
132  {
134  outfile, n_plot, exact_soln_pt);
135  }
136 
137 
140  void output_fct(std::ostream& outfile,
141  const unsigned& n_plot,
142  const double& time,
144  {
146  outfile, n_plot, time, exact_soln_pt);
147  }
148 
149  protected:
153  const Vector<double>& s,
154  Shape& psi,
155  DShape& dpsidx,
156  Shape& test,
157  DShape& dtestdx) const;
158 
159 
163  const unsigned& ipt,
164  Shape& psi,
165  DShape& dpsidx,
166  Shape& test,
167  DShape& dtestdx) const;
168 
173  const unsigned& ipt,
174  Shape& psi,
175  DShape& dpsidx,
176  RankFourTensor<double>& d_dpsidx_dX,
177  Shape& test,
178  DShape& dtestdx,
179  RankFourTensor<double>& d_dtestdx_dX,
180  DenseMatrix<double>& djacobian_dX) const;
181 
184  unsigned nrecovery_order()
185  {
186  return (NNODE_1D - 1);
187  }
188 
190  unsigned num_Z2_flux_terms()
191  {
192  return NREAGENT * DIM;
193  }
194 
198  {
199  this->get_flux(s, flux);
200  }
201 
203  unsigned nvertex_node() const
204  {
206  }
207 
209  Node* vertex_node_pt(const unsigned& j) const
210  {
212  }
213  };
214 
215 
216  // Inline functions:
217 
218 
219  //======================================================================
224  //======================================================================
225  template<unsigned NREAGENT, unsigned DIM, unsigned NNODE_1D>
228  Shape& psi,
229  DShape& dpsidx,
230  Shape& test,
231  DShape& dtestdx) const
232  {
233  unsigned n_node = this->nnode();
234 
235  // Call the geometrical shape functions and derivatives
236  double J = this->dshape_eulerian(s, psi, dpsidx);
237 
238  // Loop over the test functions and derivatives and set them equal to the
239  // shape functions
240  for (unsigned i = 0; i < n_node; i++)
241  {
242  test[i] = psi[i];
243  dtestdx(i, 0) = dpsidx(i, 0);
244  dtestdx(i, 1) = dpsidx(i, 1);
245  }
246 
247  // Return the jacobian
248  return J;
249  }
250 
251 
252  //======================================================================
257  //======================================================================
258  template<unsigned NREAGENT, unsigned DIM, unsigned NNODE_1D>
261  Shape& psi,
262  DShape& dpsidx,
263  Shape& test,
264  DShape& dtestdx) const
265  {
266  // Call the geometrical shape functions and derivatives
267  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
268 
269  // Set the pointers of the test functions
270  test = psi;
271  dtestdx = dpsidx;
272 
273  // Return the jacobian
274  return J;
275  }
276 
277 
278  //======================================================================
285  //======================================================================
286  template<unsigned NREAGENT, unsigned DIM, unsigned NNODE_1D>
289  const unsigned& ipt,
290  Shape& psi,
291  DShape& dpsidx,
292  RankFourTensor<double>& d_dpsidx_dX,
293  Shape& test,
294  DShape& dtestdx,
295  RankFourTensor<double>& d_dtestdx_dX,
296  DenseMatrix<double>& djacobian_dX) const
297  {
298  // Call the geometrical shape functions and derivatives
299  const double J = this->dshape_eulerian_at_knot(
300  ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
301 
302  // Set the pointers of the test functions
303  test = psi;
304  dtestdx = dpsidx;
305  d_dtestdx_dX = d_dpsidx_dX;
306 
307  // Return the jacobian
308  return J;
309  }
310 
311 
312  //=======================================================================
316  //=======================================================================
317  template<unsigned NREAGENT, unsigned DIM, unsigned NNODE_1D>
319  TAdvectionDiffusionReactionElement<NREAGENT, DIM, NNODE_1D>>
320  : public virtual TElement<DIM - 1, NNODE_1D>
321  {
322  public:
325  FaceGeometry() : TElement<DIM - 1, NNODE_1D>() {}
326  };
327 
328  //=======================================================================
331  //=======================================================================
332  template<unsigned NREAGENT, unsigned NNODE_1D>
333  class FaceGeometry<TAdvectionDiffusionReactionElement<NREAGENT, 1, NNODE_1D>>
334  : public virtual PointElement
335  {
336  public:
340  };
341 
342 
343 } // namespace oomph
344 
345 #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: advection_diffusion_reaction_elements.h:53
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: .
Definition: advection_diffusion_reaction_elements.h:481
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: advection_diffusion_reaction_elements.h:196
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: advection_diffusion_reaction_elements.cc:519
Definition: shape.h:278
Definition: error_estimator.h:79
FaceGeometry()
Definition: Tadvection_diffusion_reaction_elements.h:339
FaceGeometry()
Definition: Tadvection_diffusion_reaction_elements.h:325
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: Tadvection_diffusion_reaction_elements.h:66
void operator=(const TAdvectionDiffusionReactionElement< NREAGENT, DIM, NNODE_1D > &)=delete
Broken assignment operator.
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: Tadvection_diffusion_reaction_elements.h:103
void output(FILE *file_pt, const unsigned &n_plot)
Definition: Tadvection_diffusion_reaction_elements.h:120
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Definition: Tadvection_diffusion_reaction_elements.h:140
void output(FILE *file_pt)
Definition: Tadvection_diffusion_reaction_elements.h:112
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: Tadvection_diffusion_reaction_elements.h:209
void output(std::ostream &outfile)
Definition: Tadvection_diffusion_reaction_elements.h:96
double dshape_and_dtest_eulerian_adv_diff_react(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tadvection_diffusion_reaction_elements.h:227
unsigned nrecovery_order()
Definition: Tadvection_diffusion_reaction_elements.h:184
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: Tadvection_diffusion_reaction_elements.h:203
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Definition: Tadvection_diffusion_reaction_elements.h:197
double dshape_and_dtest_eulerian_at_knot_adv_diff_react(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tadvection_diffusion_reaction_elements.h:260
unsigned required_nvalue(const unsigned &n) const
Definition: Tadvection_diffusion_reaction_elements.h:89
TAdvectionDiffusionReactionElement()
Definition: Tadvection_diffusion_reaction_elements.h:70
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: Tadvection_diffusion_reaction_elements.h:129
TAdvectionDiffusionReactionElement(const TAdvectionDiffusionReactionElement< NREAGENT, DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
Definition: Tadvection_diffusion_reaction_elements.h:190
Definition: Telements.h:1208
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