refineable_gen_axisym_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// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 //Header file for elements that solve the advection diffusion equation
31 //and that can be refined.
32 
33 #ifndef OOMPH_REFINEABLE_GEN_AXISYM_ADVECTION_DIFFUSION_ELEMENTS_HEADER
34 #define OOMPH_REFINEABLE_GEN_AXISYM_ADVECTION_DIFFUSION_ELEMENTS_HEADER
35 
36 // Config header generated by autoconfig
37 #ifdef HAVE_CONFIG_H
38  #include <oomph-lib-config.h>
39 #endif
40 
41 //oomph-lib headers
42 #include "../generic/refineable_quad_element.h"
43 #include "../generic/refineable_brick_element.h"
44 #include "../generic/error_estimator.h"
46 
47 namespace oomph
48 {
49 
50 //======================================================================
51 /// \short A version of the GeneralisedAxisymAdvectionDiffusion
52 /// equations that can be
53 /// used with non-uniform mesh refinement. In essence, the class overloads
54 /// the fill_in_generic_residual_contribution_cons_axisym_adv_diff()
55 /// function so that contributions
56 /// from hanging nodes (or alternatively in-compatible function values)
57 /// are taken into account.
58 //======================================================================
60  public virtual GeneralisedAxisymAdvectionDiffusionEquations,
61  public virtual RefineableElement,
62  public virtual ElementWithZ2ErrorEstimator
63 {
64  public:
65 
66  /// \short Empty Constructor
68  GeneralisedAxisymAdvectionDiffusionEquations(),
71  {}
72 
73 
74  /// Broken copy constructor
77  {
79  "RefineableGeneralisedAxisymAdvectionDiffusionEquations");
80  }
81 
82  /// Broken assignment operator
83 //Commented out broken assignment operator because this can lead to a conflict warning
84 //when used in the virtual inheritence hierarchy. Essentially the compiler doesn't
85 //realise that two separate implementations of the broken function are the same and so,
86 //quite rightly, it shouts.
87  /*void operator=(const RefineableGeneralisedAxisymAdvectionDiffusionEquations&)
88  {
89  BrokenCopy::broken_assign(
90  "RefineableGeneralisedAxisymAdvectionDiffusionEquations");
91  }*/
92 
93  /// Number of 'flux' terms for Z2 error estimation
94  unsigned num_Z2_flux_terms() {return 2;}
95 
96  /// \short Get 'flux' for Z2 error recovery:
97  /// Standard flux.from GeneralisedAxisymAdvectionDiffusion equations
99  {this->get_flux(s,flux);}
100 
101 
102  /// \short Get the function value u in Vector.
103  /// Note: Given the generality of the interface (this function
104  /// is usually called from black-box documentation or interpolation routines),
105  /// the values Vector sets its own size in here.
107  {
108  // Set size of Vector: u
109  values.resize(1);
110 
111  //Find number of nodes
112  const unsigned n_node = nnode();
113 
114  //Find the index at which the unknown is stored
115  const unsigned u_nodal_index = this->u_index_cons_axisym_adv_diff();
116 
117  //Local shape function
118  Shape psi(n_node);
119 
120  //Find values of shape function
121  shape(s,psi);
122 
123  //Initialise value of u
124  values[0] = 0.0;
125 
126  //Loop over the local nodes and sum
127  for(unsigned l=0;l<n_node;l++)
128  {
129  values[0] += this->nodal_value(l,u_nodal_index)*psi[l];
130  }
131  }
132 
133  /// \short Get the function value u in Vector.
134  /// Note: Given the generality of the interface (this function
135  /// is usually called from black-box documentation or interpolation routines),
136  /// the values Vector sets its own size in here.
137  void get_interpolated_values(const unsigned& t, const Vector<double>&s,
138  Vector<double>& values)
139  {
140  // Set size of Vector:
141  values.resize(1);
142 
143  //Find out how many nodes there are
144  const unsigned n_node = nnode();
145 
146  //Find the nodal index at which the unknown is stored
147  const unsigned u_nodal_index = this->u_index_cons_axisym_adv_diff();
148 
149  // Shape functions
150  Shape psi(n_node);
151 
152  //Find values of shape function
153  shape(s,psi);
154 
155  //Initialise the value of u
156  values[0] = 0.0;
157 
158  //Calculate value
159  for(unsigned l=0;l<n_node;l++)
160  {
161  values[0] += this->nodal_value(t,l,u_nodal_index)*psi[l];
162  }
163  }
164 
165  /// Fill in the geometric Jacobian, which in this case is r
167  {return x[0];}
168 
169 
170  /// Further build: Copy source function pointer from father element
172  {
174  cast_father_element_pt
176  this->father_element_pt());
177 
178  //Set the values of the pointers from the father
179  this->Source_fct_pt = cast_father_element_pt->source_fct_pt();
180  this->Wind_fct_pt = cast_father_element_pt->wind_fct_pt();
181  this->Conserved_wind_fct_pt = cast_father_element_pt->
183  this->Diff_fct_pt = cast_father_element_pt->diff_fct_pt();
184  this->Pe_pt = cast_father_element_pt->pe_pt();
185  this->PeSt_pt = cast_father_element_pt->pe_st_pt();
186 
187  //Set the ALE status
188  this->ALE_is_disabled = cast_father_element_pt->ALE_is_disabled;
189  }
190 
191  protected:
192 
193 /// \short Add the element's contribution to the elemental residual vector
194 /// and/or Jacobian matrix
195 /// flag=1: compute both
196 /// flag=0: compute only residual vector
198  Vector<double> &residuals, DenseMatrix<double> &jacobian,
199  DenseMatrix<double> &mass_matrix, unsigned flag);
200 
201 };
202 
203 
204 //======================================================================
205 /// \short Refineable version of QGeneralisedAxisymAdvectionDiffusionElement.
206 /// Inherit from the standard QGeneralisedAxisymAdvectionDiffusionElement
207 /// and the
208 /// appropriate refineable geometric element and the refineable equations.
209 //======================================================================
210 template <unsigned NNODE_1D>
214  public virtual RefineableQElement<2>
215 {
216  public:
217 
218  /// \short Empty Constructor:
222  RefineableQElement<2>(),
224  {}
225 
226 
227  /// Broken copy constructor
230  dummy)
231  {
233  "RefineableQuadGeneralisedAxisymAdvectionDiffusionElement");
234  }
235 
236  /// Broken assignment operator
237  /*void operator=(const RefineableQGeneralisedAxisymAdvectionDiffusionElement<
238  NNODE_1D>&)
239  {
240  BrokenCopy::broken_assign(
241  "RefineableQuadGeneralisedAxisymAdvectionDiffusionElement");
242  }*/
243 
244  /// Number of continuously interpolated values: 1
245  unsigned ncont_interpolated_values() const {return 1;}
246 
247  /// \short Number of vertex nodes in the element
248  unsigned nvertex_node() const
249  {return
251 
252  /// \short Pointer to the j-th vertex node in the element
253  Node* vertex_node_pt(const unsigned& j) const
254  {return
256 
257  /// Rebuild from sons: empty
258  void rebuild_from_sons(Mesh* &mesh_pt) {}
259 
260  /// \short Order of recovery shape functions for Z2 error estimation:
261  /// Same order as shape functions.
262  unsigned nrecovery_order() {return (NNODE_1D-1);}
263 
264  /// \short Perform additional hanging node procedures for variables
265  /// that are not interpolated by all nodes. Empty.
267 
268 };
269 
270 ////////////////////////////////////////////////////////////////////////
271 ////////////////////////////////////////////////////////////////////////
272 ////////////////////////////////////////////////////////////////////////
273 
274 
275 
276 //=======================================================================
277 /// Face geometry for the
278 /// RefineableQuadGeneralisedAxisymAdvectionDiffusionElement elements:
279 /// The spatial
280 /// dimension of the face elements is one lower than that of the
281 /// bulk element but they have the same number of points
282 /// along their 1D edges.
283 //=======================================================================
284 template<unsigned NNODE_1D>
286 NNODE_1D> >:
287 public virtual QElement<1,NNODE_1D>
288 {
289 
290  public:
291 
292  /// \short Constructor: Call the constructor for the
293  /// appropriate lower-dimensional QElement
294  FaceGeometry() : QElement<1,NNODE_1D>() {}
295 
296 };
297 
298 }
299 
300 #endif
301 
Refineable version of QGeneralisedAxisymAdvectionDiffusionElement. Inherit from the standard QGeneral...
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
GeneralisedAxisymAdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
virtual RefineableElement * father_element_pt() const
Return a pointer to the father element.
GeneralisedAxisymAdvectionDiffusionWindFctPt & conserved_wind_fct_pt()
Access function: Pointer to additional (conservative) wind function.
GeneralisedAxisymAdvectionDiffusionWindFctPt Wind_fct_pt
Pointer to wind function:
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get &#39;flux&#39; for Z2 error recovery: Standard flux.from GeneralisedAxisymAdvectionDiffusion equations...
void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes...
char t
Definition: cfortran.h:572
void get_interpolated_values(const unsigned &t, const Vector< double > &s, Vector< double > &values)
Get the function value u in Vector. Note: Given the generality of the interface (this function is usu...
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:852
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
RefineableQGeneralisedAxisymAdvectionDiffusionElement(const RefineableQGeneralisedAxisymAdvectionDiffusionElement< NNODE_1D > &dummy)
Broken copy constructor.
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: .
A version of the GeneralisedAxisymAdvectionDiffusion equations that can be used with non-uniform mesh...
double * PeSt_pt
Pointer to global Peclet number multiplied by Strouhal number.
GeneralisedAxisymAdvectionDiffusionWindFctPt Conserved_wind_fct_pt
Pointer to additional (conservative) wind function:
static char t char * s
Definition: cfortran.h:572
void fill_in_generic_residual_contribution_cons_axisym_adv_diff(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add the element&#39;s contribution to the elemental residual vector and/or Jacobian matrix flag=1: comput...
QGeneralisedAxisymAdvectionDiffusionElement elements are linear/quadrilateral/brick-shaped Advection ...
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
RefineableGeneralisedAxisymAdvectionDiffusionEquations(const RefineableGeneralisedAxisymAdvectionDiffusionEquations &dummy)
Broken copy constructor.
GeneralisedAxisymAdvectionDiffusionDiffFctPt Diff_fct_pt
Pointer to diffusivity funciton.
double nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n. Produces suitably interpolated values for hanging nodes...
Definition: elements.h:2470
void get_interpolated_values(const Vector< double > &s, Vector< double > &values)
Get the function value u in Vector. Note: Given the generality of the interface (this function is usu...
void further_build()
Further build: Copy source function pointer from father element.
double geometric_jacobian(const Vector< double > &x)
Fill in the geometric Jacobian, which in this case is r.
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
virtual unsigned u_index_cons_axisym_adv_diff() const
A class for all elements that solve the Advection Diffusion equations in conservative form using isop...
double * Pe_pt
Pointer to global Peclet number.
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2146
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
A general mesh class.
Definition: mesh.h:74