refineable_gen_advection_diffusion_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 elements that solve the advection diffusion equation
27 // and that can be refined.
28 
29 #ifndef OOMPH_REFINEABLE_GEN_ADVECTION_DIFFUSION_ELEMENTS_HEADER
30 #define OOMPH_REFINEABLE_GEN_ADVECTION_DIFFUSION_ELEMENTS_HEADER
31 
32 // Config header generated by autoconfig
33 #ifdef HAVE_CONFIG_H
34 #include <oomph-lib-config.h>
35 #endif
36 
37 // oomph-lib headers
38 #include "../generic/refineable_quad_element.h"
39 #include "../generic/refineable_brick_element.h"
40 #include "../generic/error_estimator.h"
42 
43 namespace oomph
44 {
45  //======================================================================
52  //======================================================================
53  template<unsigned DIM>
55  : public virtual GeneralisedAdvectionDiffusionEquations<DIM>,
56  public virtual RefineableElement,
57  public virtual ElementWithZ2ErrorEstimator
58  {
59  public:
65  {
66  }
67 
68 
72  delete;
73 
75  void operator=(
77 
79  unsigned num_Z2_flux_terms()
80  {
81  return DIM;
82  }
83 
87  {
88  this->get_flux(s, flux);
89  }
90 
91 
97  Vector<double>& values)
98  {
99  // Set size of Vector: u
100  values.resize(1);
101 
102  // Find number of nodes
103  const unsigned n_node = nnode();
104 
105  // Find the index at which the unknown is stored
106  const unsigned u_nodal_index = this->u_index_cons_adv_diff();
107 
108  // Local shape function
109  Shape psi(n_node);
110 
111  // Find values of shape function
112  shape(s, psi);
113 
114  // Initialise value of u
115  values[0] = 0.0;
116 
117  // Loop over the local nodes and sum
118  for (unsigned l = 0; l < n_node; l++)
119  {
120  values[0] += this->nodal_value(l, u_nodal_index) * psi[l];
121  }
122  }
123 
128  void get_interpolated_values(const unsigned& t,
129  const Vector<double>& s,
130  Vector<double>& values)
131  {
132  // Set size of Vector:
133  values.resize(1);
134 
135  // Find out how many nodes there are
136  const unsigned n_node = nnode();
137 
138  // Find the nodal index at which the unknown is stored
139  const unsigned u_nodal_index = this->u_index_cons_adv_diff();
140 
141  // Shape functions
142  Shape psi(n_node);
143 
144  // Find values of shape function
145  shape(s, psi);
146 
147  // Initialise the value of u
148  values[0] = 0.0;
149 
150  // Calculate value
151  for (unsigned l = 0; l < n_node; l++)
152  {
153  values[0] += this->nodal_value(t, l, u_nodal_index) * psi[l];
154  }
155  }
156 
157 
160  {
162  cast_father_element_pt =
164  this->father_element_pt());
165 
166  // Set the values of the pointers from the father
167  this->Source_fct_pt = cast_father_element_pt->source_fct_pt();
168  this->Wind_fct_pt = cast_father_element_pt->wind_fct_pt();
169  this->Conserved_wind_fct_pt =
170  cast_father_element_pt->conserved_wind_fct_pt();
171  this->Diff_fct_pt = cast_father_element_pt->diff_fct_pt();
172  this->Pe_pt = cast_father_element_pt->pe_pt();
173  this->PeSt_pt = cast_father_element_pt->pe_st_pt();
174 
175  // Set the ALE status
176  this->ALE_is_disabled = cast_father_element_pt->ALE_is_disabled;
177  }
178 
179  protected:
185  Vector<double>& residuals,
186  DenseMatrix<double>& jacobian,
187  DenseMatrix<double>& mass_matrix,
188  unsigned flag);
189  };
190 
191 
192  //======================================================================
196  //======================================================================
197  template<unsigned DIM, unsigned NNODE_1D>
199  : public QGeneralisedAdvectionDiffusionElement<DIM, NNODE_1D>,
201  public virtual RefineableQElement<DIM>
202  {
203  public:
206  : RefineableElement(),
210  {
211  }
212 
213 
217  dummy) = delete;
218 
220  void operator=(
222  delete;
223 
225  unsigned ncont_interpolated_values() const
226  {
227  return 1;
228  }
229 
231  unsigned nvertex_node() const
232  {
234  NNODE_1D>::nvertex_node();
235  }
236 
238  Node* vertex_node_pt(const unsigned& j) const
239  {
241  NNODE_1D>::vertex_node_pt(j);
242  }
243 
245  void rebuild_from_sons(Mesh*& mesh_pt) {}
246 
249  unsigned nrecovery_order()
250  {
251  return (NNODE_1D - 1);
252  }
253 
257  };
258 
262 
263 
264  //=======================================================================
270  //=======================================================================
271  template<unsigned DIM, unsigned NNODE_1D>
274  : public virtual QElement<DIM - 1, NNODE_1D>
275  {
276  public:
279  FaceGeometry() : QElement<DIM - 1, NNODE_1D>() {}
280  };
281 
282 } // namespace oomph
283 
284 #endif
Definition: error_estimator.h:79
FaceGeometry()
Definition: refineable_gen_advection_diffusion_elements.h:279
Definition: elements.h:4998
double nodal_value(const unsigned &n, const unsigned &i) const
Definition: elements.h:2593
virtual void shape(const Vector< double > &s, Shape &psi) const =0
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
Definition: gen_advection_diffusion_elements.h:52
GeneralisedAdvectionDiffusionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
Definition: gen_advection_diffusion_elements.h:232
double *& pe_pt()
Pointer to Peclet number.
Definition: gen_advection_diffusion_elements.h:279
double * Pe_pt
Pointer to global Peclet number.
Definition: gen_advection_diffusion_elements.h:599
GeneralisedAdvectionDiffusionDiffFctPt Diff_fct_pt
Pointer to diffusivity funciton.
Definition: gen_advection_diffusion_elements.h:614
double *& pe_st_pt()
Pointer to Peclet number multipled by Strouha number.
Definition: gen_advection_diffusion_elements.h:291
GeneralisedAdvectionDiffusionWindFctPt Wind_fct_pt
Pointer to wind function:
Definition: gen_advection_diffusion_elements.h:608
GeneralisedAdvectionDiffusionWindFctPt Conserved_wind_fct_pt
Pointer to additional (conservative) wind function:
Definition: gen_advection_diffusion_elements.h:611
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: .
Definition: gen_advection_diffusion_elements.h:408
GeneralisedAdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
Definition: gen_advection_diffusion_elements.h:605
double * PeSt_pt
Pointer to global Peclet number multiplied by Strouhal number.
Definition: gen_advection_diffusion_elements.h:602
virtual unsigned u_index_cons_adv_diff() const
Definition: gen_advection_diffusion_elements.h:98
GeneralisedAdvectionDiffusionDiffFctPt & diff_fct_pt()
Access function: Pointer to diffusion function.
Definition: gen_advection_diffusion_elements.h:261
GeneralisedAdvectionDiffusionSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
Definition: gen_advection_diffusion_elements.h:218
bool ALE_is_disabled
Definition: gen_advection_diffusion_elements.h:619
GeneralisedAdvectionDiffusionWindFctPt & conserved_wind_fct_pt()
Access function: Pointer to additional (conservative) wind function.
Definition: gen_advection_diffusion_elements.h:246
Definition: mesh.h:67
Definition: nodes.h:906
Definition: Qelements.h:459
Definition: gen_advection_diffusion_elements.h:641
Definition: refineable_elements.h:97
virtual RefineableElement * father_element_pt() const
Return a pointer to the father element.
Definition: refineable_elements.h:539
Definition: refineable_gen_advection_diffusion_elements.h:58
void further_build()
Further build: Copy source function pointer from father element.
Definition: refineable_gen_advection_diffusion_elements.h:159
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Definition: refineable_gen_advection_diffusion_elements.h:86
void operator=(const RefineableGeneralisedAdvectionDiffusionEquations< DIM > &)=delete
Broken assignment operator.
RefineableGeneralisedAdvectionDiffusionEquations()
Empty Constructor.
Definition: refineable_gen_advection_diffusion_elements.h:61
RefineableGeneralisedAdvectionDiffusionEquations(const RefineableGeneralisedAdvectionDiffusionEquations< DIM > &dummy)=delete
Broken copy constructor.
void fill_in_generic_residual_contribution_cons_adv_diff(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Definition: refineable_gen_advection_diffusion_elements.cc:38
void get_interpolated_values(const unsigned &t, const Vector< double > &s, Vector< double > &values)
Definition: refineable_gen_advection_diffusion_elements.h:128
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
Definition: refineable_gen_advection_diffusion_elements.h:79
void get_interpolated_values(const Vector< double > &s, Vector< double > &values)
Definition: refineable_gen_advection_diffusion_elements.h:96
Definition: Qelements.h:2259
Definition: refineable_gen_advection_diffusion_elements.h:202
void operator=(const RefineableQGeneralisedAdvectionDiffusionElement< DIM, NNODE_1D > &)=delete
Broken assignment operator.
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: refineable_gen_advection_diffusion_elements.h:238
unsigned nrecovery_order()
Definition: refineable_gen_advection_diffusion_elements.h:249
RefineableQGeneralisedAdvectionDiffusionElement(const RefineableQGeneralisedAdvectionDiffusionElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: refineable_gen_advection_diffusion_elements.h:231
RefineableQGeneralisedAdvectionDiffusionElement()
Empty Constructor:
Definition: refineable_gen_advection_diffusion_elements.h:205
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: 1.
Definition: refineable_gen_advection_diffusion_elements.h:225
void rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: empty.
Definition: refineable_gen_advection_diffusion_elements.h:245
void further_setup_hanging_nodes()
Definition: refineable_gen_advection_diffusion_elements.h:256
Definition: shape.h:76
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
t
Definition: plotPSD.py:36
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2