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// 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 
31 #ifndef OOMPH_REFINEABLE_YOUNGLAPLACE_ELEMENTS_HEADER
32 #define OOMPH_REFINEABLE_YOUNGLAPLACE_ELEMENTS_HEADER
33 
34 // Config header generated by autoconfig
35 #ifdef HAVE_CONFIG_H
36  #include <oomph-lib-config.h>
37 #endif
38 
39 
40 //oomph-lib headers
41 #include "../generic/refineable_quad_element.h"
42 #include "../generic/error_estimator.h"
43 #include "young_laplace_elements.h"
44 
45 
46 namespace oomph
47 {
48 
49 
50 ///////////////////////////////////////////////////////////////////////////
51 ///////////////////////////////////////////////////////////////////////////
52 
53 
54 
55 //======================================================================
56 /// Refineable version of YoungLaplace equations
57 ///
58 ///
59 //======================================================================
61  public virtual RefineableElement,
62  public virtual ElementWithZ2ErrorEstimator
63 {
64  public:
65 
66  /// \short Constructor: Pass refinement level to refineable element
67  /// (default 0 = root)
68  RefineableYoungLaplaceEquations(const int& refine_level=0) :
72  {}
73 
74 
75  /// Broken copy constructor
77  {
78  BrokenCopy::broken_copy("RefineableYoungLaplaceEquations");
79  }
80 
81  /// Broken assignment operator
83  {
84  BrokenCopy::broken_assign("RefineableYoungLaplaceEquations");
85  }
86 
87  /// Compute element residual vector taking hanging nodes into account
89 
90  /// Number of 'flux' terms for Z2 error estimation
91  unsigned num_Z2_flux_terms() {return 2;}
92 
93  /// \short Get 'flux' for Z2 error recovery: Standard flux
94  /// from YoungLaplace equations
96  {this->get_flux(s,flux);}
97 
98 /// \short Get the function value u in Vector.
99 /// Note: Given the generality of the interface (this function
100 /// is usually called from black-box documentation or interpolation routines),
101 /// the values Vector sets its own size in here.
103  {
104  // Set size of Vector: u
105  values.resize(1);
106 
107  //Find number of nodes
108  unsigned n_node = nnode();
109 
110  //Local shape function
111  Shape psi(n_node);
112 
113  //Find values of shape function
114  shape(s,psi);
115 
116  //Initialise value of u
117  values[0] = 0.0;
118 
119  //Loop over the local nodes and sum
120  for(unsigned l=0;l<n_node;l++)
121  {
122  values[0] += this->u(l)*psi[l];
123  }
124  }
125 
126 
127  /// \short Get the function value u in Vector.
128  /// Note: Given the generality of the interface (this function
129  /// is usually called from black-box documentation or interpolation routines),
130  /// the values Vector sets its own size in here.
131  void get_interpolated_values(const unsigned& t, const Vector<double>&s,
132  Vector<double>& values)
133  {
134  if (t!=0)
135  {
136  throw OomphLibError(
137  "These equations are steady => No time dependence",
138  OOMPH_CURRENT_FUNCTION,
139  OOMPH_EXCEPTION_LOCATION);
140  }
141  else
142  {
143  get_interpolated_values(s,values);
144  }
145  }
146 
147 
148  /// \short Further build: Copy function pointers to spine and spine base
149  /// functions from father. Kappa is passed across with set_kappa(...)
150  /// to ensure that it's added to the element's external Data.
152  {
153  // Copy kappa with set_kappa() to ensure that it's added to the
154  // element's external Data.
155  this->set_kappa(dynamic_cast<RefineableYoungLaplaceEquations*>(
156  this->father_element_pt())->kappa_pt());
157 
158  // Copy spine functions
159  this->Spine_fct_pt=dynamic_cast<RefineableYoungLaplaceEquations*>(
160  this->father_element_pt())->spine_fct_pt();
161 
164  }
165 
166 };
167 
168 
169 //======================================================================
170 /// Refineable version of 2D QYoungLaplaceElement elements
171 ///
172 ///
173 //======================================================================
174 template <unsigned NNODE_1D>
176 public QYoungLaplaceElement<NNODE_1D>,
177  public virtual RefineableYoungLaplaceEquations,
178  public virtual RefineableQElement<2>
179 {
180  public:
181 
182  /// \short Constructor: Pass refinement level to refineable quad element
183  /// (default 0 = root)
187  RefineableQElement<2>(),
188  QYoungLaplaceElement<NNODE_1D>()
189  {}
190 
191  /// Broken copy constructor
193  dummy)
194  {
195  BrokenCopy::broken_copy("RefineableQuadYoungLaplaceElement");
196  }
197 
198  /// Broken assignment operator
200  {
201  BrokenCopy::broken_assign("RefineableQuadYoungLaplaceElement");
202  }
203 
204  /// Number of continuously interpolated values: 1
205  unsigned ncont_interpolated_values() const {return 1;}
206 
207  /// \short Number of vertex nodes in the element
208  unsigned nvertex_node() const
210 
211  /// \short Pointer to the j-th vertex node in the element
212  Node* vertex_node_pt(const unsigned& j) const
214 
215  /// Rebuild from sons: empty
216  void rebuild_from_sons(Mesh* &mesh_pt) {}
217 
218  /// \short Order of recovery shape functions for Z2 error estimation:
219  /// Same order as shape functions.
220  unsigned nrecovery_order() {return (NNODE_1D-1);}
221 
222  /// \short Perform additional hanging node procedures for variables
223  /// that are not interpolated by all nodes. Empty.
225 
226 };
227 
228 ////////////////////////////////////////////////////////////////////////
229 ////////////////////////////////////////////////////////////////////////
230 ////////////////////////////////////////////////////////////////////////
231 
232 
233 
234 //=======================================================================
235 /// Face geometry for the RefineableQuadYoungLaplaceElement elements: The spatial
236 /// dimension of the face elements is one lower than that of the
237 /// bulk element but they have the same number of points
238 /// along their 1D edges.
239 //=======================================================================
240 template<unsigned NNODE_1D>
242  public virtual QElement<1,NNODE_1D>
243 {
244 
245  public:
246 
247  /// \short Constructor: Call the constructor for the
248  /// appropriate lower-dimensional QElement
249  FaceGeometry() : QElement<1,NNODE_1D>() {}
250 
251 };
252 
253 
254 }
255 
256 #endif
257 
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: Qelements.h:910
RefineableYoungLaplaceEquations(const RefineableYoungLaplaceEquations &dummy)
Broken copy constructor.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: flux[i] = du/dx_i: Mainly used for error estimation.
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.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
SpineBaseFctPt & spine_base_fct_pt()
Access function to function pointer that specifies spine base vector field.
Data * kappa_pt()
Access function: Pointer Data object that stores kappa (const version – kappa must be set with set_k...
void operator=(const RefineableQYoungLaplaceElement< NNODE_1D > &)
Broken assignment operator.
char t
Definition: cfortran.h:572
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: Qelements.h:906
void operator=(const RefineableYoungLaplaceEquations &)
Broken assignment operator.
void rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: empty.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:852
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...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute element residual vector taking hanging nodes into account.
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...
RefineableQYoungLaplaceElement()
Constructor: Pass refinement level to refineable quad element (default 0 = root)
SpineFctPt & spine_fct_pt()
Access function to function pointer that specifies spine vector field.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
unsigned nvertex_node() const
Number of vertex nodes in the element.
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...
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get &#39;flux&#39; for Z2 error recovery: Standard flux from YoungLaplace equations.
static char t char * s
Definition: cfortran.h:572
virtual double u(const unsigned &n) const
void further_build()
Further build: Copy function pointers to spine and spine base functions from father. Kappa is passed across with set_kappa(...) to ensure that it&#39;s added to the element&#39;s external Data.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
unsigned num_Z2_flux_terms()
Number of &#39;flux&#39; terms for Z2 error estimation.
SpineBaseFctPt Spine_base_fct_pt
Pointer to spine base function:
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
RefineableQYoungLaplaceElement(const RefineableQYoungLaplaceElement< NNODE_1D > &dummy)
Broken copy constructor.
void set_kappa(Data *kappa_pt)
Set curvature data (and add it to the element&#39;s external Data)
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2146
SpineFctPt Spine_fct_pt
Pointer to spine function:
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
RefineableYoungLaplaceEquations(const int &refine_level=0)
Constructor: Pass refinement level to refineable element (default 0 = root)