refineable_young_laplace_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-2023 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 
27 #ifndef OOMPH_REFINEABLE_YOUNGLAPLACE_ELEMENTS_HEADER
28 #define OOMPH_REFINEABLE_YOUNGLAPLACE_ELEMENTS_HEADER
29 
30 // Config header generated by autoconfig
31 #ifdef HAVE_CONFIG_H
32 #include <oomph-lib-config.h>
33 #endif
34 
35 
36 // oomph-lib headers
37 #include "../generic/refineable_quad_element.h"
38 #include "../generic/error_estimator.h"
39 #include "young_laplace_elements.h"
40 
41 
42 namespace oomph
43 {
44  /// ////////////////////////////////////////////////////////////////////////
45  /// ////////////////////////////////////////////////////////////////////////
46 
47 
48  //======================================================================
49  /// Refineable version of YoungLaplace equations
50  ///
51  ///
52  //======================================================================
54  : public virtual YoungLaplaceEquations,
55  public virtual RefineableElement,
56  public virtual ElementWithZ2ErrorEstimator
57  {
58  public:
59  /// Constructor: Pass refinement level to refineable element
60  /// (default 0 = root)
61  RefineableYoungLaplaceEquations(const int& refine_level = 0)
65  {
66  }
67 
68 
69  /// Broken copy constructor
71  const RefineableYoungLaplaceEquations& dummy) = delete;
72 
73  /// Broken assignment operator
75 
76  /// Compute element residual vector taking hanging nodes into account
78 
79  /// Number of 'flux' terms for Z2 error estimation
80  unsigned num_Z2_flux_terms()
81  {
82  return 2;
83  }
84 
85  /// Get 'flux' for Z2 error recovery: Standard flux
86  /// from YoungLaplace equations
88  {
89  this->get_flux(s, flux);
90  }
91 
92  /// Get the function value u in Vector.
93  /// Note: Given the generality of the interface (this function
94  /// is usually called from black-box documentation or interpolation
95  /// routines), the values Vector sets its own size in here.
97  Vector<double>& values)
98  {
99  // Set size of Vector: u
100  values.resize(1);
101 
102  // Find number of nodes
103  unsigned n_node = nnode();
104 
105  // Local shape function
106  Shape psi(n_node);
107 
108  // Find values of shape function
109  shape(s, psi);
110 
111  // Initialise value of u
112  values[0] = 0.0;
113 
114  // Loop over the local nodes and sum
115  for (unsigned l = 0; l < n_node; l++)
116  {
117  values[0] += this->u(l) * psi[l];
118  }
119  }
120 
121 
122  /// Get the function value u in Vector.
123  /// Note: Given the generality of the interface (this function
124  /// is usually called from black-box documentation or interpolation
125  /// routines), the values Vector sets its own size in here.
126  void get_interpolated_values(const unsigned& t,
127  const Vector<double>& s,
128  Vector<double>& values)
129  {
130  if (t != 0)
131  {
132  throw OomphLibError("These equations are steady => No time dependence",
133  OOMPH_CURRENT_FUNCTION,
134  OOMPH_EXCEPTION_LOCATION);
135  }
136  else
137  {
138  get_interpolated_values(s, values);
139  }
140  }
141 
142 
143  /// Further build: Copy function pointers to spine and spine base
144  /// functions from father. Kappa is passed across with set_kappa(...)
145  /// to ensure that it's added to the element's external Data.
147  {
148  // Copy kappa with set_kappa() to ensure that it's added to the
149  // element's external Data.
150  this->set_kappa(dynamic_cast<RefineableYoungLaplaceEquations*>(
151  this->father_element_pt())
152  ->kappa_pt());
153 
154  // Copy spine functions
155  this->Spine_fct_pt = dynamic_cast<RefineableYoungLaplaceEquations*>(
156  this->father_element_pt())
157  ->spine_fct_pt();
158 
159  this->Spine_base_fct_pt = dynamic_cast<RefineableYoungLaplaceEquations*>(
160  this->father_element_pt())
161  ->spine_base_fct_pt();
162  }
163  };
164 
165 
166  //======================================================================
167  /// Refineable version of 2D QYoungLaplaceElement elements
168  ///
169  ///
170  //======================================================================
171  template<unsigned NNODE_1D>
173  : public QYoungLaplaceElement<NNODE_1D>,
174  public virtual RefineableYoungLaplaceEquations,
175  public virtual RefineableQElement<2>
176  {
177  public:
178  /// Constructor: Pass refinement level to refineable quad element
179  /// (default 0 = root)
181  : RefineableElement(),
183  RefineableQElement<2>(),
184  QYoungLaplaceElement<NNODE_1D>()
185  {
186  }
187 
188  /// Broken copy constructor
190  const RefineableQYoungLaplaceElement<NNODE_1D>& dummy) = delete;
191 
192  /// Broken assignment operator
194 
195  /// Number of continuously interpolated values: 1
196  unsigned ncont_interpolated_values() const
197  {
198  return 1;
199  }
200 
201  /// Number of vertex nodes in the element
202  unsigned nvertex_node() const
203  {
205  }
206 
207  /// Pointer to the j-th vertex node in the element
208  Node* vertex_node_pt(const unsigned& j) const
209  {
211  }
212 
213  /// Rebuild from sons: empty
214  void rebuild_from_sons(Mesh*& mesh_pt) {}
215 
216  /// Order of recovery shape functions for Z2 error estimation:
217  /// Same order as shape functions.
218  unsigned nrecovery_order()
219  {
220  return (NNODE_1D - 1);
221  }
222 
223  /// Perform additional hanging node procedures for variables
224  /// that are not interpolated by all nodes. Empty.
226  };
227 
228  /// /////////////////////////////////////////////////////////////////////
229  /// /////////////////////////////////////////////////////////////////////
230  /// /////////////////////////////////////////////////////////////////////
231 
232 
233  //=======================================================================
234  /// Face geometry for the RefineableQuadYoungLaplaceElement elements: The
235  /// spatial dimension of the face elements is one lower than that of the bulk
236  /// element but they have the same number of points along their 1D edges.
237  //=======================================================================
238  template<unsigned NNODE_1D>
240  : public virtual QElement<1, NNODE_1D>
241  {
242  public:
243  /// Constructor: Call the constructor for the
244  /// appropriate lower-dimensional QElement
245  FaceGeometry() : QElement<1, NNODE_1D>() {}
246  };
247 
248 
249 } // namespace oomph
250 
251 #endif
static char t char * s
Definition: cfortran.h:568
char t
Definition: cfortran.h:568
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition: elements.h:4998
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...
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
A general mesh class.
Definition: mesh.h:67
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:906
An OomphLibError object which should be thrown when an run-time error is encountered....
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: Qelements.h:907
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: Qelements.h:913
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Definition: Qelements.h:459
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
virtual RefineableElement * father_element_pt() const
Return a pointer to the father element.
A class that is used to template the refineable Q elements by dimension. It's really nothing more tha...
Definition: Qelements.h:2259
Refineable version of 2D QYoungLaplaceElement elements.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
void rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: empty.
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: 1.
void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes....
unsigned nvertex_node() const
Number of vertex nodes in the element.
RefineableQYoungLaplaceElement()
Constructor: Pass refinement level to refineable quad element (default 0 = root)
void operator=(const RefineableQYoungLaplaceElement< NNODE_1D > &)=delete
Broken assignment operator.
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
RefineableQYoungLaplaceElement(const RefineableQYoungLaplaceElement< NNODE_1D > &dummy)=delete
Broken copy constructor.
////////////////////////////////////////////////////////////////////////
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...
RefineableYoungLaplaceEquations(const RefineableYoungLaplaceEquations &dummy)=delete
Broken copy constructor.
RefineableYoungLaplaceEquations(const int &refine_level=0)
Constructor: Pass refinement level to refineable element (default 0 = root)
void operator=(const RefineableYoungLaplaceEquations &)=delete
Broken assignment operator.
void further_build()
Further build: Copy function pointers to spine and spine base functions from father....
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 get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Standard flux from YoungLaplace equations.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute element residual vector taking hanging nodes into account.
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
Definition: shape.h:76
A class for all isoparametric elements that solve the YoungLaplace equations.
SpineBaseFctPt & spine_base_fct_pt()
Access function to function pointer that specifies spine base vector field.
void set_kappa(Data *kappa_pt)
Set curvature data (and add it to the element's external Data)
SpineFctPt & spine_fct_pt()
Access function to function pointer that specifies spine vector field.
virtual double u(const unsigned &n) const
Access function: Nodal function value at local node n Uses suitably interpolated value for hanging no...
SpineFctPt Spine_fct_pt
Pointer to spine function:
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: flux[i] = du/dx_i: Mainly used for error estimation.
SpineBaseFctPt Spine_base_fct_pt
Pointer to spine base function:
Data * kappa_pt()
Access function: Pointer Data object that stores kappa (const version – kappa must be set with set_ka...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...