33 #ifndef OOMPH_REFINEABLE_POLAR_NAVIER_STOKES_HEADER 
   34 #define OOMPH_REFINEABLE_POLAR_NAVIER_STOKES_HEADER 
   38 #include <oomph-lib-config.h> 
   43 #include "../generic/refineable_quad_element.h" 
   44 #include "../generic/error_estimator.h" 
   99       unsigned n_element = element_pt.size();
 
  100       for (
unsigned e = 0; 
e < n_element; 
e++)
 
  113       unsigned n_element = element_pt.size();
 
  114       for (
unsigned e = 0; 
e < n_element; 
e++)
 
  134       unsigned num_entries = 3;
 
  135       if (flux.size() != num_entries)
 
  137         std::ostringstream error_message;
 
  138         error_message << 
"The flux vector has the wrong number of entries, " 
  139                       << flux.size() << 
", whereas it should be " << num_entries
 
  142                             OOMPH_CURRENT_FUNCTION,
 
  143                             OOMPH_EXCEPTION_LOCATION);
 
  156       for (
unsigned i = 0; 
i < 2; 
i++)
 
  158         flux[icount] = strainrate(
i, 
i);
 
  163       for (
unsigned i = 0; 
i < 2; 
i++)
 
  165         for (
unsigned j = 
i + 1; j < 2; j++)
 
  167           flux[icount] = strainrate(
i, j);
 
  186       this->
Re_pt = cast_father_element_pt->
re_pt();
 
  192       this->
G_pt = cast_father_element_pt->
g_pt();
 
  237       unsigned n_node = this->
nnode();
 
  239       for (
unsigned n = 0; n < n_node; n++)
 
  251       unsigned n_node = this->
nnode();
 
  253       for (
unsigned n = 0; n < n_node; n++)
 
  260       for (
unsigned l = 0; l < n_pres; l++)
 
  265           nod_pt->
unpin(p_index);
 
  325       values.resize(3, 0.0);
 
  328       for (
unsigned i = 0; 
i < 2; 
i++)
 
  351       unsigned N_prev_time =
 
  356         std::ostringstream error_message;
 
  358           << 
"The value of t in get_interpolated_values(...), " << 
t 
  360           << 
"is greater than the number of previous stored timesteps";
 
  363                             OOMPH_CURRENT_FUNCTION,
 
  364                             OOMPH_EXCEPTION_LOCATION);
 
  369       values.resize(2 + 1);
 
  372       for (
unsigned i = 0; 
i < 2 + 1; 
i++)
 
  378       unsigned n_node = this->
nnode();
 
  382       this->
shape(s, psif);
 
  385       for (
unsigned i = 0; 
i < 2; 
i++)
 
  389         for (
unsigned l = 0; l < n_node; l++)
 
  391           values[
i] += this->
nodal_value(t, l, u_nodal_index) * psif[l];
 
  456         unsigned total_index = 0;
 
  458         unsigned NNODE_1D = 2;
 
  462         for (
unsigned i = 0; 
i < 2; 
i++)
 
  471           else if (
s[
i] == 1.0)
 
  473             index[
i] = NNODE_1D - 1;
 
  479             double float_index = 0.5 * (1.0 + 
s[
i]) * (NNODE_1D - 1);
 
  480             index[
i] = int(float_index);
 
  483             double excess = float_index - index[
i];
 
  494             index[
i] * 
static_cast<unsigned>(pow(
static_cast<float>(NNODE_1D),
 
  495                                                  static_cast<int>(
i)));
 
  528         return static_cast<unsigned>(pow(2.0, 
static_cast<int>(2)));
 
  532         return this->
nnode();
 
  540                              const int& value_id)
 const 
  548         return this->
shape(s, psi);
 
  563       std::set<std::pair<Data*, unsigned>>& paired_load_data)
 
  567       for (
unsigned i = 0; 
i < 2; 
i++)
 
  573       unsigned n_node = this->
nnode();
 
  574       for (
unsigned n = 0; n < n_node; n++)
 
  586           for (
unsigned j = 0; j < nmaster; j++)
 
  592             for (
unsigned i = 0; 
i < 2; 
i++)
 
  594               paired_load_data.insert(
 
  595                 std::make_pair(master_nod_pt, u_index[
i]));
 
  604           for (
unsigned i = 0; 
i < 2; 
i++)
 
  606             paired_load_data.insert(
 
  607               std::make_pair(this->
node_pt(n), u_index[
i]));
 
  617       for (
unsigned l = 0; l < n_pres; l++)
 
  629           unsigned nmaster = hang_info_pt->
nmaster();
 
  632           for (
unsigned m = 0; m < nmaster; m++)
 
  636             paired_load_data.insert(
 
  645           paired_load_data.insert(std::make_pair(pres_node_pt, p_index));
 
  684       for (
unsigned l = 0; l < n_pres; l++)
 
  737       values.resize(2, 0.0);
 
  740       for (
unsigned i = 0; 
i < 2; 
i++)
 
  764       unsigned N_prev_time =
 
  769         std::ostringstream error_message;
 
  771           << 
"The value of t in get_interpolated_values(...), " << 
t 
  773           << 
"is greater than the number of previous stored timesteps";
 
  776                             OOMPH_CURRENT_FUNCTION,
 
  777                             OOMPH_EXCEPTION_LOCATION);
 
  785       for (
unsigned i = 0; 
i < 2; 
i++)
 
  791       unsigned n_node = this->
nnode();
 
  795       this->
shape(s, psif);
 
  798       for (
unsigned i = 0; 
i < 2; 
i++)
 
  802         for (
unsigned l = 0; l < n_node; l++)
 
  804           values[
i] += this->
nodal_value(t, l, u_nodal_index) * psif[l];
 
  830       std::set<std::pair<Data*, unsigned>>& paired_load_data)
 
  834       for (
unsigned i = 0; 
i < 2; 
i++)
 
  840       unsigned n_node = this->
nnode();
 
  841       for (
unsigned n = 0; n < n_node; n++)
 
  853           for (
unsigned j = 0; j < nmaster; j++)
 
  859             for (
unsigned i = 0; 
i < 2; 
i++)
 
  861               paired_load_data.insert(
 
  862                 std::make_pair(master_nod_pt, u_index[
i]));
 
  871           for (
unsigned i = 0; 
i < 2; 
i++)
 
  873             paired_load_data.insert(
 
  874               std::make_pair(this->
node_pt(n), u_index[
i]));
 
  882       for (
unsigned l = 0; l < n_pres; l++)
 
  886         paired_load_data.insert(std::make_pair(
 
  898     : 
public virtual FaceGeometry<PolarCrouzeixRaviartElement>
 
  911     using namespace QuadTreeNames;
 
  920     double av_press = 0.0;
 
  923     for (
unsigned ison = 0; ison < 4; ison++)
 
 1009       ->
set_value(2, 0.5 * (slope1 + slope2));
 
 1023     using namespace QuadTreeNames;
 
 1042     else if (son_type == 
SE)
 
 1048     else if (son_type == 
NE)
 
 1055     else if (son_type == 
NW)
 
 1071     for (
unsigned i = 1; 
i < 3; 
i++)
 
 1073       double half_father_slope =
 
void pin(const unsigned &i)
Pin the i-th stored variable.
void unpin(const unsigned &i)
Unpin the i-th stored variable.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
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...
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 ...
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
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...
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.
virtual unsigned nvertex_node() const
Return the number of vertex nodes in this element. Broken virtual function in "pure" finite elements.
static const double Node_location_tolerance
Default value for the tolerance to be used when locating nodes via local coordinates.
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.
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.
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overload...
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...
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Class that contains data for hanging nodes.
Node *const  & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
unsigned nmaster() const
Return the number of master nodes.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
HangInfo *const  & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
bool is_hanging() const
Test whether the node is geometrically hanging.
An OomphLibError object which should be thrown when an run-time error is encountered....
/////////////////////////////////////////////////////////////////////////// /////////////////////////...
unsigned npres_pnst() const
Return number of pressure values.
unsigned P_pnst_internal_index
Internal index that indicates at which internal data the pressure is stored.
A class for elements that solve the polar Navier–Stokes equations, This contains the generic maths – ...
double *& density_ratio_pt()
Pointer to Density ratio.
double *& re_invfr_pt()
Pointer to global inverse Froude number.
NavierStokesBodyForceFctPt & body_force_fct_pt()
Access function for the body-force pointer.
double * ReSt_pt
Pointer to global Reynolds number x Strouhal number (=Womersley)
double * Viscosity_Ratio_pt
Pointer to the viscosity ratio (relative to the viscosity used in the definition of the Reynolds numb...
Vector< double > * G_pt
Pointer to global gravity Vector.
NavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
double *& alpha_pt()
Pointer to Alpha.
NavierStokesSourceFctPt & source_fct_pt()
Access function for the source-function pointer.
double * Re_pt
Pointer to global Reynolds number.
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley number)
void strain_rate_by_r(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Function to return polar strain multiplied by r.
double *& re_pt()
Pointer to Reynolds number.
virtual unsigned u_index_pnst(const unsigned &i) const
Return the index at which the i-th unknown velocity component is stored. The default value,...
double * Density_Ratio_pt
Pointer to the density ratio (relative to the density used in the definition of the Reynolds number)
NavierStokesSourceFctPt Source_fct_pt
Pointer to volumetric source function.
double * ReInvFr_pt
Pointer to global Reynolds number x inverse Froude number (= Bond number / Capillary number)
double *& viscosity_ratio_pt()
Pointer to Viscosity Ratio.
void interpolated_u_pnst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
double * Alpha_pt
Pointer to the angle alpha.
double interpolated_p_pnst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
Vector< double > *& g_pt()
Pointer to Vector of gravitational components.
/////////////////////////////////////////////////////////////////////////
void pshape_pnst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
static const unsigned Pconv[]
Static array of ints to hold conversion from pressure node numbers to actual node numbers.
unsigned npres_pnst() const
Return number of pressure values.
virtual int p_nodal_index_pnst()
Which nodal value represents the pressure?
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
Tree * tree_pt()
Access function: Pointer to quadtree representation of this element.
virtual RefineableElement * father_element_pt() const
Return a pointer to the father element.
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
RefineablePolarCrouzeixRaviartElement()
Constructor.
void further_build()
Further build for Crouzeix_Raviart interpolates the internal pressure dofs from father element: Make ...
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
unsigned nvertex_node() const
Number of vertex nodes in the element.
void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes....
void unpin_elemental_pressure_dofs()
Unpin all internal pressure dofs.
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)....
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: DIM (velocities)
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 rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: Reconstruct pressure from the (merged) sons This must be specialised for each dime...
void insert_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Add to the set paired_load_data pairs containing.
Refineable version of my Polar Navier–Stokes equations.
virtual void pin_elemental_redundant_nodal_pressure_dofs()
Pin unused nodal pressure dofs (empty by default, because by default pressure dofs are not associated...
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
virtual void fill_in_generic_residual_contribution(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add element's contribution to elemental residual vector and/or Jacobian matrix flag=1: compute both f...
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Upper triangular entries in strain rate tensor.
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...
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 ...
void further_build()
Further build, pass the pointers down to the sons.
static void unpin_all_pressure_dofs(const Vector< GeneralisedElement * > &element_pt)
Unpin all pressure dofs in elements listed in vector.
RefineablePolarNavierStokesEquations()
Constructor.
virtual void unpin_elemental_pressure_dofs()=0
Unpin all pressure dofs in the element.
Refineable version of Polar Taylor Hood elements. These classes can be written in total generality.
void unpin_elemental_pressure_dofs()
Unpin all pressure dofs.
void rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: empty.
unsigned nvertex_node() const
Number of vertex nodes in the element.
unsigned ninterpolating_node_1d(const int &value_id)
The number of 1d pressure nodes is 2, the number of 1d velocity nodes is the same as the number of 1d...
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: (DIM velocities + 1 pressure)
Node * get_interpolating_node_at_local_coordinate(const Vector< double > &s, const int &value_id)
The velocity nodes are the same as the geometric nodes. The pressure nodes must be calculated by usin...
Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure node.
Node * interpolating_node_pt(const unsigned &n, const int &value_id)
The velocities are isoparametric and so the "nodes" interpolating the velocities are the geometric no...
void interpolating_basis(const Vector< double > &s, Shape &psi, const int &value_id) const
The basis interpolating the pressure is given by pshape(). / The basis interpolating the velocity is ...
void pin_elemental_redundant_nodal_pressure_dofs()
Pin all nodal pressure dofs that are not required.
unsigned ninterpolating_node(const int &value_id)
The number of pressure nodes is 2^DIM. The number of velocity nodes is the same as the number of geom...
unsigned required_nvalue(const unsigned &n) const
Number of values required at local node n. In order to simplify matters, we allocate storage for pres...
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
RefineablePolarTaylorHoodElement()
Constructor.
void insert_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Add to the set paired_load_data pairs containing.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
double local_one_d_fraction_of_interpolating_node(const unsigned &n1d, const unsigned &i, const int &value_id)
The pressure nodes are the corner nodes, so when n_value==DIM, the fraction is the same as the 1d nod...
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_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes....
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...
QuadTree * quadtree_pt()
Pointer to quadtree representation of this element.
void setup_hang_for_value(const int &value_id)
Internal helper function that is used to construct the hanging node schemes for the value_id-th inter...
A class that is used to template the refineable Q elements by dimension. It's really nothing more tha...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
virtual unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
Tree * father_pt() const
Return pointer to father: NULL if it's a root node.
int son_type() const
Return son type.
Tree * son_pt(const int &son_index) const
Return pointer to the son for a given index. Note that to aid code readability specific enums have be...
TreeRoot *& root_pt()
Return pointer to root of the tree.
A slight extension to the standard template vector class so that we can include "graceful" array rang...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...