37 #ifndef OOMPH_REFINEABLE_POLAR_NAVIER_STOKES_HEADER 38 #define OOMPH_REFINEABLE_POLAR_NAVIER_STOKES_HEADER 42 #include <oomph-lib-config.h> 47 #include "../generic/refineable_quad_element.h" 48 #include "../generic/error_estimator.h" 101 unsigned n_element = element_pt.size();
102 for(
unsigned e=0;
e<n_element;
e++)
115 unsigned n_element = element_pt.size();
116 for(
unsigned e=0;
e<n_element;
e++)
136 unsigned num_entries=3;
137 if (flux.size()!=num_entries)
139 std::ostringstream error_message;
140 error_message <<
"The flux vector has the wrong number of entries, " 141 << flux.size() <<
", whereas it should be " 142 << num_entries << std::endl;
144 OOMPH_CURRENT_FUNCTION,
145 OOMPH_EXCEPTION_LOCATION);
158 for(
unsigned i=0;
i<2;
i++)
160 flux[icount]=strainrate(
i,
i);
165 for(
unsigned i=0;
i<2;
i++)
167 for(
unsigned j=
i+1;j<2;j++)
169 flux[icount]=strainrate(
i,j);
188 this->
Re_pt = cast_father_element_pt->
re_pt();
194 this->
G_pt = cast_father_element_pt->
g_pt();
233 {
return this->
node_pt(this->Pconv[n_p]);}
240 unsigned n_node = this->
nnode();
242 for(
unsigned n=0;n<n_node;n++)
252 unsigned n_node = this->
nnode();
254 for(
unsigned n=0;n<n_node;n++) {this->
node_pt(n)->
pin(p_index);}
258 for(
unsigned l=0;l<n_pres;l++)
304 values.resize(3,0.0);
327 unsigned N_prev_time = root_el_pt->
node_pt(0)->
332 std::ostringstream error_message;
334 <<
"The value of t in get_interpolated_values(...), " 336 <<
"is greater than the number of previous stored timesteps";
340 OOMPH_CURRENT_FUNCTION,
341 OOMPH_EXCEPTION_LOCATION);
349 for(
unsigned i=0;
i<2+1;
i++) {values[
i]=0.0;}
352 unsigned n_node = this->
nnode();
359 for(
unsigned i=0;
i<2;
i++)
363 for(
unsigned l=0;l<n_node;l++)
365 values[
i] += this->
nodal_value(t,l,u_nodal_index)*psif[l];
393 else {
return this->
node_pt(n);}
425 unsigned total_index=0;
427 unsigned NNODE_1D = 2;
431 for(
unsigned i=0;
i<2;
i++)
441 index[
i] = NNODE_1D-1;
447 double float_index = 0.5*(1.0 + s[
i])*(NNODE_1D-1);
448 index[
i] = int(float_index);
451 double excess = float_index - index[
i];
461 total_index += index[
i]*
462 static_cast<unsigned>(pow(static_cast<float>(NNODE_1D),
463 static_cast<int>(
i)));
480 if(value_id==2) {
return 2;}
489 {
return static_cast<unsigned>(pow(2.0,static_cast<int>(2)));}
490 else {
return this->
nnode();}
497 const int &value_id)
const 500 else {
return this->
shape(s,psi);}
520 unsigned n_node = this->
nnode();
521 for(
unsigned n=0;n<n_node;n++)
533 for (
unsigned j=0;j<nmaster;j++)
539 for(
unsigned i=0;
i<2;
i++)
541 paired_load_data.insert(std::make_pair(master_nod_pt,u_index[
i]));
550 for(
unsigned i=0;
i<2;
i++)
552 paired_load_data.insert(std::make_pair(this->
node_pt(n),u_index[
i]));
562 for(
unsigned l=0;l<n_pres;l++)
574 unsigned nmaster = hang_info_pt->
nmaster();
577 for(
unsigned m=0;m<nmaster;m++)
581 paired_load_data.insert(
590 paired_load_data.insert(std::make_pair(pres_node_pt,p_index));
632 for(
unsigned l=0;l<n_pres;l++)
673 values.resize(2,0.0);
699 unsigned N_prev_time = root_el_pt->
node_pt(0)->
704 std::ostringstream error_message;
706 <<
"The value of t in get_interpolated_values(...), " 708 <<
"is greater than the number of previous stored timesteps";
712 OOMPH_CURRENT_FUNCTION,
713 OOMPH_EXCEPTION_LOCATION);
721 for(
unsigned i=0;
i<2;
i++) {values[
i]=0.0;}
724 unsigned n_node = this->
nnode();
731 for(
unsigned i=0;
i<2;
i++)
735 for(
unsigned l=0;l<n_node;l++)
737 values[
i] += this->
nodal_value(t,l,u_nodal_index)*psif[l];
770 unsigned n_node = this->
nnode();
771 for(
unsigned n=0;n<n_node;n++)
783 for (
unsigned j=0;j<nmaster;j++)
789 for(
unsigned i=0;
i<2;
i++)
791 paired_load_data.insert(std::make_pair(master_nod_pt,u_index[
i]));
800 for(
unsigned i=0;
i<2;
i++)
802 paired_load_data.insert(std::make_pair(this->
node_pt(n),u_index[
i]));
810 for(
unsigned l=0;l<n_pres;l++)
814 paired_load_data.insert(
828 public virtual FaceGeometry<PolarCrouzeixRaviartElement >
841 using namespace QuadTreeNames;
853 for (
unsigned ison=0;ison<4;ison++)
858 av_press += quadtree_pt()->son_pt(ison)->object_pt()->
875 quadtree_pt()->son_pt(
SE)->object_pt()->
877 quadtree_pt()->son_pt(
SW)->object_pt()->
881 quadtree_pt()->son_pt(
NE)->object_pt()->
883 quadtree_pt()->son_pt(
NW)->object_pt()->
889 set_value(1,0.5*(slope1+slope2));
902 quadtree_pt()->son_pt(
NE)->object_pt()
903 ->internal_data_pt(this->P_pnst_internal_index)->value(0) -
904 quadtree_pt()->son_pt(
SE)->object_pt()
905 ->internal_data_pt(this->P_pnst_internal_index)->value(0);
908 quadtree_pt()->son_pt(
NW)->object_pt()
909 ->internal_data_pt(this->P_pnst_internal_index)->value(0) -
910 quadtree_pt()->son_pt(
SW)->object_pt()
911 ->internal_data_pt(this->P_pnst_internal_index)->value(0);
916 set_value(2,0.5*(slope1+slope2));
930 using namespace QuadTreeNames;
933 int son_type=quadtree_pt()->son_type();
949 else if (son_type==
SE)
955 else if (son_type==
NE)
962 else if (son_type==
NW)
978 for(
unsigned i=1;
i<3;
i++)
980 double half_father_slope = 0.5*cast_father_element_pt->
984 set_value(
i,half_father_slope);
double * Density_Ratio_pt
Pointer to the density ratio (relative to the density used in the definition of the Reynolds number) ...
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 ...
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 unpin_elemental_pressure_dofs()
Unpin all internal pressure dofs.
RefineablePolarTaylorHoodElement()
Constructor.
void insert_load_data(std::set< std::pair< Data *, unsigned > > &paired_load_data)
Add to the set paired_load_data pairs containing.
NavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley number)
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
virtual RefineableElement * father_element_pt() const
Return a pointer to the father element.
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 unsigned npres_pnst() const =0
Function to return number of pressure degrees of freedom.
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 rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: empty.
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
void interpolated_u_pnst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
void insert_load_data(std::set< std::pair< Data *, unsigned > > &paired_load_data)
Add to the set paired_load_data pairs containing.
void unpin_elemental_pressure_dofs()
Unpin all pressure dofs.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
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)...
Refineable version of Crouzeix Raviart elements. Generic class definitions.
void rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: Reconstruct pressure from the (merged) sons This must be specialised for each dime...
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
unsigned nmaster() const
Return the number of master nodes.
virtual void pshape_pnst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes...
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
bool is_hanging() const
Test whether the node is geometrically hanging.
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...
unsigned nvertex_node() const
Number of vertex nodes in the element.
double * Viscosity_Ratio_pt
Pointer to the viscosity ratio (relative to the viscosity used in the definition of the Reynolds numb...
double * ReSt_pt
Pointer to global Reynolds number x Strouhal number (=Womersley)
double *& re_pt()
Pointer to Reynolds number.
void pin(const unsigned &i)
Pin the i-th stored variable.
NavierStokesSourceFctPt Source_fct_pt
Pointer to volumetric source function.
virtual void pin_elemental_redundant_nodal_pressure_dofs()
Pin unused nodal pressure dofs (empty by default, because.
void pin_elemental_redundant_nodal_pressure_dofs()
Pin all nodal pressure dofs that are not required.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
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...
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...
double * Alpha_pt
Pointer to the angle alpha.
double *& alpha_pt()
Pointer to Alpha.
virtual int p_nodal_index_pnst()
Which nodal value represents the pressure? (Default: negative, indicating that pressure is not based ...
NavierStokesSourceFctPt & source_fct_pt()
Access function for the source-function pointer.
double * ReInvFr_pt
Pointer to global Reynolds number x inverse Froude number (= Bond number / Capillary number) ...
virtual unsigned nvertex_node() const
Tree * tree_pt()
Access function: Pointer to quadtree representation of this element.
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.
virtual unsigned u_index_pnst(const unsigned &i) const
Return the index at which the i-th unknown velocity component.
void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes...
virtual void unpin_elemental_pressure_dofs()=0
Unpin all pressure dofs in the element.
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...
double * Re_pt
Pointer to global Reynolds number.
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: (DIM velocities + 1 pressure)
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Vector< double > * G_pt
Pointer to global gravity Vector.
static const double Node_location_tolerance
Default value for the tolerance to be used when locating nodes via local coordinates.
RefineablePolarNavierStokesEquations()
Constructor.
Vector< double > *& g_pt()
Pointer to Vector of gravitational components.
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...
static void unpin_all_pressure_dofs(const Vector< GeneralisedElement *> &element_pt)
Unpin all pressure dofs in elements listed in vector.
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...
void strain_rate_by_r(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Function to return polar strain multiplied by r.
Class that contains data for hanging nodes.
virtual void rebuild_from_sons(Mesh *&mesh_pt)=0
Rebuild the element, e.g. set internal values in line with those of the sons that have now merged...
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
RefineablePolarCrouzeixRaviartElement()
Constructor.
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 get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Upper triangular entries in strain rate tensor. ...
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overloa...
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...
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure node.
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...
double *& re_invfr_pt()
Pointer to global inverse Froude number.
RefineableElement * object_pt() const
Return the pointer to the object (RefineableElement) represented by the tree.
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 ...
NavierStokesBodyForceFctPt & body_force_fct_pt()
Access function for the body-force pointer.
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: DIM (velocities)
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 unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
unsigned nnode() const
Return the number of nodes.
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 interpolated_p_pnst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
double *& viscosity_ratio_pt()
Pointer to Viscosity Ratio.
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 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...
TreeRoot *& root_pt()
Return pointer to root of the tree.
double *& density_ratio_pt()
Pointer to Density ratio.
unsigned nvertex_node() const
Number of vertex nodes in the element.
void further_build()
Further build, pass the pointers down to the sons.
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...