31 #ifndef OOMPH_REFINEABLE_SPHERICAL_NAVIER_STOKES_ELEMENTS_HEADER 32 #define OOMPH_REFINEABLE_SPHERICAL_NAVIER_STOKES_ELEMENTS_HEADER 36 #include <oomph-lib-config.h> 40 #include "../generic/refineable_quad_element.h" 41 #include "../generic/error_estimator.h" 91 unsigned num_entries=DIM+((DIM*DIM)-DIM)/2;
92 if (flux.size() < num_entries)
94 std::ostringstream error_message;
95 error_message <<
"The flux vector is too small, size " 96 << flux.size() <<
", whereas it should be " 97 << num_entries << std::endl;
100 OOMPH_CURRENT_FUNCTION,
101 OOMPH_EXCEPTION_LOCATION);
112 for(
unsigned i=0;
i<DIM;
i++)
114 flux[icount]=strainrate(
i,
i);
119 for(
unsigned i=0;
i<DIM;
i++)
121 for(
unsigned j=
i+1;j<DIM;j++)
123 flux[icount]=strainrate(
i,j);
131 {
return x[0]*x[0]*sin(x[1]);}
147 this->
Re_pt = cast_father_element_pt->
re_pt();
155 this->
G_pt = cast_father_element_pt->
g_pt();
182 unsigned n_element=element_pt.size();
183 for(
unsigned e=0;
e<n_element;
e++)
196 unsigned n_element = element_pt.size();
197 for(
unsigned e=0;
e<n_element;
e++)
233 {
return this->
node_pt(this->Pconv[n_p]);}
238 unsigned n_node = this->
nnode();
241 for(
unsigned n=0;n<n_node;n++) {this->
node_pt(n)->
unpin(p_index);}
248 unsigned n_node = this->
nnode();
251 for(
unsigned n=0;n<n_node;n++) {this->
node_pt(n)->
pin(p_index);}
255 for(
unsigned l=0;l<n_pres;l++)
303 values.resize(4,0.0);
323 for(
unsigned i=0;
i<4;
i++) {values[
i]=0.0;}
326 unsigned n_node =
nnode();
333 for(
unsigned i=0;
i<3;
i++)
337 for(
unsigned l=0;l<n_node;l++)
353 this->setup_hang_for_value(3);
365 if(n_value==3) {
return this->
node_pt(this->Pconv[n]);}
367 else {
return this->
node_pt(n);}
399 unsigned total_index=0;
401 unsigned NNODE_1D = 2;
406 for(
unsigned i=0;
i<2;
i++)
416 index[
i] = NNODE_1D-1;
422 double float_index = 0.5*(1.0 + s[
i])*(NNODE_1D-1);
423 index[
i] = int(float_index);
426 double excess = float_index - index[
i];
436 total_index += index[
i]*
437 static_cast<unsigned>(pow(static_cast<float>(NNODE_1D),
438 static_cast<int>(
i)));
441 return this->
node_pt(this->Pconv[total_index]);
455 if(n_value==3) {
return 2;}
463 if(n_value==3) {
return 4;}
464 else {
return this->
nnode();}
471 const int &n_value)
const 474 else {
return this->
shape(s,psi);}
489 public virtual FaceGeometry<QSphericalTaylorHoodElement>
501 public virtual FaceGeometry<FaceGeometry<QSphericalTaylorHoodElement> >
526 for(
unsigned l=0;l<n_pres;l++)
545 using namespace QuadTreeNames;
557 for (
unsigned ison=0;ison<4;ison++)
560 av_press += quadtree_pt()->son_pt(ison)->object_pt()->
576 double slope1= quadtree_pt()->son_pt(
SE)->object_pt()->
578 quadtree_pt()->son_pt(
SW)->object_pt()->
581 double slope2 = quadtree_pt()->son_pt(
NE)->object_pt()->
583 quadtree_pt()->son_pt(
NW)->object_pt()->
589 set_value(1,0.5*(slope1+slope2));
600 slope1 = quadtree_pt()->son_pt(
NE)->object_pt()->
602 quadtree_pt()->son_pt(
SE)->object_pt()->
605 slope2 = quadtree_pt()->son_pt(
NW)->object_pt()->
607 quadtree_pt()->son_pt(
SW)->object_pt()->
613 set_value(2,0.5*(slope1+slope2));
640 values.resize(3,0.0);
662 for(
unsigned i=0;
i<3;
i++) {values[
i]=0.0;}
665 unsigned n_node =
nnode();
672 for(
unsigned i=0;
i<3;
i++)
676 for(
unsigned l=0;l<n_node;l++)
696 using namespace QuadTreeNames;
699 int son_type=quadtree_pt()->son_type();
703 quadtree_pt()->father_pt()->object_pt();
716 else if (son_type==
SE)
722 else if (son_type==
NE)
729 else if (son_type==
NW)
746 set_value(1,0.5*cast_father_el_pt
751 set_value(2,0.5*cast_father_el_pt
765 public virtual FaceGeometry<QSphericalCrouzeixRaviartElement>
778 public virtual FaceGeometry<FaceGeometry<QSphericalCrouzeixRaviartElement> >
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: 3 (velocities)
void unpin(const unsigned &i)
Unpin the i-th stored variable.
double value(const unsigned &i) const
Return i-th stored value. This function is not virtual so that it can be inlined. This means that if ...
SphericalNavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: 4 (3 velocities + 1 pressure)
void interpolated_u_spherical_nst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
double *& re_invfr_pt()
Pointer to global inverse Froude number.
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
virtual Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure node (Default: NULL, indicating that pressure is not based on nodal interp...
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Strain-rate tensor: 1/2 (du_i/dx_j + du_j/dx_i)
void fill_in_generic_residual_contribution_spherical_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add element's contribution to the elemental residual vector and/or Jacobian matrix flag=1: compute bo...
Node * interpolating_node_pt(const unsigned &n, const int &n_value)
The velocities are isoparametric and so the "nodes" interpolating the velocities are the geometric no...
unsigned ninterpolating_node_1d(const int &n_value)
The number of 1d pressure nodes is 2, the number of 1d velocity nodes is the same as the number of 1d...
RefineableQSphericalTaylorHoodElement()
Constructor:
virtual RefineableElement * father_element_pt() const
Return a pointer to the father element.
virtual Node * get_node_at_local_coordinate(const Vector< double > &s) const
If there is a node at this local coordinate, return the pointer to the node.
void get_interpolated_values(const unsigned &t, const Vector< double > &s, Vector< double > &values)
Get all function values [u,v..,p] at previous timestep t (t=0: present; t>0: previous timestep)...
SphericalNavierStokesSourceFctPt & source_fct_pt()
Access function for the source-function pointer.
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Refineable version of the Spherical Navier–Stokes equations.
double geometric_jacobian(const Vector< double > &x)
Fill in the geometric Jacobian, which in this case is r*r*sin(theta)
double * ReSt_pt
Pointer to global Reynolds number x Strouhal number (=Womersley)
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
virtual void pin_elemental_redundant_nodal_pressure_dofs()
Pin unused nodal pressure dofs (empty by default, because.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
bool is_hanging() const
Test whether the node is geometrically hanging.
void further_build()
Further build: pass the pointers down to the sons.
unsigned nvertex_node() const
Number of vertex nodes in the element.
void pin(const unsigned &i)
Pin the i-th stored variable.
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
double *& density_ratio_pt()
Pointer to Density ratio.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
unsigned nvertex_node() const
Number of vertex nodes in the element.
RefineableSphericalNavierStokesEquations()
Empty Constructor.
virtual unsigned npres_spherical_nst() const =0
Function to return number of pressure degrees of freedom.
double interpolated_p_spherical_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
RefineableQSphericalCrouzeixRaviartElement()
Constructor:
void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes...
Vector< double > * G_pt
Pointer to global gravity Vector.
virtual unsigned nvertex_node() const
void rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: empty.
Vector< double > *& g_pt()
Pointer to Vector of gravitational components.
void set_value(const unsigned &i, const double &value_)
Set the i-th stored data value to specified value. The only reason that we require an explicit set fu...
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
double * ReInvRo_pt
Pointer to global Reynolds number x inverse Rossby number (used when in a rotating frame) ...
SphericalNavierStokesSourceFctPt Source_fct_pt
Pointer to volumetric source function.
void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes...
unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at node n.
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...
virtual void pshape_spherical_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
double *& re_invro_pt()
Pointer to global inverse Froude number.
static const double Node_location_tolerance
Default value for the tolerance to be used when locating nodes via local coordinates.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
double * Density_Ratio_pt
Pointer to the density ratio (relative to the density used in the definition of the Reynolds number) ...
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...
unsigned ninterpolating_node(const int &n_value)
The number of pressure nodes is 4. The number of velocity nodes is the same as the number of geometri...
static void pin_redundant_nodal_pressures(const Vector< GeneralisedElement *> &element_pt)
Loop over all elements in Vector (which typically contains all the elements in a fluid mesh) and pin ...
virtual void unpin_elemental_pressure_dofs()=0
Unpin all pressure dofs in the element.
virtual unsigned u_index_spherical_nst(const unsigned &i) const
Return the index at which the i-th unknown velocity component.
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overloa...
double * ReInvFr_pt
Pointer to global Reynolds number x inverse Froude number (= Bond number / Capillary number) ...
Node * get_interpolating_node_at_local_coordinate(const Vector< double > &s, const int &n_value)
The velocity nodes are the same as the geometric nodes. The pressure nodes must be calculated by usin...
double * Re_pt
Pointer to global Reynolds number.
double local_one_d_fraction_of_interpolating_node(const unsigned &n1d, const unsigned &i, const int &n_value)
The pressure nodes are the corner nodes, so when n_value==DIM, the fraction is the same as the 1d nod...
void rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: Reconstruct pressure from the (merged) sons.
void pin_elemental_redundant_nodal_pressure_dofs()
Unpin the proper nodal pressure dofs.
void unpin_elemental_pressure_dofs()
Unpin all pressure dofs.
void interpolating_basis(const Vector< double > &s, Shape &psi, const int &n_value) const
The basis interpolating the pressure is given by pshape(). / The basis interpolating the velocity is ...
virtual Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element. Broken virtual function in "pure" finite elements...
void unpin_elemental_pressure_dofs()
Unpin all the internal pressure freedoms.
Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure node.
static void unpin_all_pressure_dofs(const Vector< GeneralisedElement *> &element_pt)
Unpin all pressure dofs in elements listed in vector.
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Upper triangular entries in strain rate tensor. ...
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley number)
SphericalNavierStokesBodyForceFctPt & body_force_fct_pt()
Access function for the body-force pointer.
double *& re_pt()
Pointer to Reynolds number.
virtual double local_one_d_fraction_of_node(const unsigned &n1d, const unsigned &i)
Get the local fraction of any node in the n-th position in a one dimensional expansion along the i-th...
virtual int p_nodal_index_spherical_nst() const
Return the index at which the pressure is stored if it is stored at the nodes. If not stored at the n...
double * Viscosity_Ratio_pt
Pointer to the viscosity ratio (relative to the viscosity used in the definition of the Reynolds numb...
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...
unsigned nnode() const
Return the number of nodes.
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...
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...
double *& viscosity_ratio_pt()
Pointer to Viscosity Ratio.