32 #ifndef OOMPH_REFINEABLE_LINEARISED_NAVIER_STOKES_ELEMENTS_HEADER 33 #define OOMPH_REFINEABLE_LINEARISED_NAVIER_STOKES_ELEMENTS_HEADER 37 #include <oomph-lib-config.h> 41 #include "../generic/refineable_quad_element.h" 42 #include "../generic/error_estimator.h" 82 return 2* (DIM+((DIM*DIM)-DIM)/2);
90 unsigned num_entries=2*(DIM+((DIM*DIM)-DIM)/2);
91 if (flux.size()!=num_entries)
93 std::ostringstream error_message;
94 error_message <<
"The flux vector has the wrong number of entries, " 95 << flux.size() <<
", whereas it should be " 96 << num_entries << std::endl;
99 "RefineableLinearisedNavierStokesEquations::get_Z2_flux()",
100 OOMPH_EXCEPTION_LOCATION);
115 for(
unsigned i=0;
i<DIM;
i++)
117 flux[icount]=real_strainrate(
i,
i);
122 for(
unsigned i=0;
i<DIM;
i++)
124 for(
unsigned j=
i+1;j<DIM;j++)
126 flux[icount]=real_strainrate(
i,j);
132 for(
unsigned i=0;
i<DIM;
i++)
134 flux[icount]=imag_strainrate(
i,
i);
139 for(
unsigned i=0;
i<DIM;
i++)
141 for(
unsigned j=
i+1;j<DIM;j++)
143 flux[icount]=imag_strainrate(
i,j);
154 cast_father_element_pt
165 this->
Re_pt = cast_father_element_pt->
re_pt();
196 const unsigned n_element=element_pt.size();
197 for(
unsigned e=0;
e<n_element;
e++)
210 const unsigned n_element = element_pt.size();
211 for(
unsigned e=0;
e<n_element;
e++)
256 for(
unsigned l=0;l<n_pres;l++)
259 for(
unsigned i=0;
i<2;
i++)
282 using namespace QuadTreeNames;
294 for(
unsigned ison=0;ison<4;ison++)
297 for(
unsigned i=0;
i<2;
i++)
300 av_press[
i] += quadtree_pt()->son_pt(ison)->object_pt()->
306 for(
unsigned i=0;
i<2;
i++)
315 for(
unsigned i=0;
i<2;
i++)
325 slope1[
i] = quadtree_pt()->son_pt(
SE)->object_pt()->
327 quadtree_pt()->son_pt(
SW)->object_pt()->
330 slope2[
i] = quadtree_pt()->son_pt(
NE)->object_pt()->
332 quadtree_pt()->son_pt(
NW)->object_pt()->
337 set_value(1,0.5*(slope1[i]+slope2[i]));
347 slope1[
i] = quadtree_pt()->son_pt(
NE)->object_pt()->
349 quadtree_pt()->son_pt(
SE)->object_pt()->
352 slope2[
i] = quadtree_pt()->son_pt(
NW)->object_pt()->
354 quadtree_pt()->son_pt(
SW)->object_pt()->
359 set_value(2,0.5*(slope1[i]+slope2[i]));
385 const unsigned n_values = 4*DIM;
388 values.resize(n_values,0.0);
391 for(
unsigned i=0;
i<n_values;
i++)
410 values.resize(4*DIM);
413 for(
unsigned i=0;
i<4*DIM;
i++) { values[
i]=0.0; }
416 const unsigned n_node =
nnode();
423 for(
unsigned i=0;
i<(4*DIM);
i++)
427 for(
unsigned l=0;l<n_node;l++)
447 using namespace QuadTreeNames;
450 int son_type=quadtree_pt()->son_type();
454 quadtree_pt()->father_pt()->object_pt();
467 else if(son_type==
SE)
473 else if(son_type==
NE)
480 else if(son_type==
NW)
499 for(
unsigned i=0;
i<2;
i++)
507 set_value(0,press[i]);
511 set_value(1,0.5*cast_father_el_pt
516 set_value(2,0.5*cast_father_el_pt
538 public virtual FaceGeometry<LinearisedQCrouzeixRaviartElement>
555 <FaceGeometry<LinearisedQCrouzeixRaviartElement> >
584 {
return this->
node_pt(this->Pconv[n_p]); }
590 const unsigned n_node = this->
nnode();
594 for(
unsigned i=0;
i<2;
i++)
600 for(
unsigned n=0;n<n_node;n++)
610 const unsigned n_node = this->
nnode();
614 for(
unsigned i=0;
i<2;
i++)
620 for(
unsigned n=0;n<n_node;n++)
627 for(
unsigned l=0;l<n_pres;l++)
630 for(
unsigned i=0;
i<2;
i++)
681 const unsigned n_values = 2*(DIM+1);
684 values.resize(n_values,0.0);
687 for(
unsigned i=0;
i<(2*DIM);
i++)
693 for(
unsigned i=0;
i<2;
i++)
708 values.resize(2*(DIM+1));
711 for(
unsigned i=0;
i<2*(DIM+1);
i++) { values[
i]=0.0; }
714 const unsigned n_node =
nnode();
721 for(
unsigned i=0;
i<(2*DIM);
i++)
725 for(
unsigned l=0;l<n_node;l++)
733 for(
unsigned i=0;
i<2;
i++)
744 for(
unsigned i=0;
i<2;
i++)
746 this->setup_hang_for_value((2*DIM)+
i);
759 if(n_value==(2*DIM) || n_value==((2*DIM)+1))
761 return this->
node_pt(this->Pconv[n]);
765 else {
return this->
node_pt(n); }
774 if(n_value==(2*DIM) || n_value==((2*DIM)+1))
794 if(n_value==static_cast<int>(2*DIM)
795 || n_value==static_cast<int>((2*DIM)+1))
798 unsigned total_index = 0;
800 const unsigned NNODE_1D = 2;
805 for(
unsigned i=0;
i<2;
i++)
808 if(s[
i]==-1.0) { index[
i] = 0; }
812 else if(s[
i] == 1.0) { index[
i] = NNODE_1D-1; }
818 double float_index = 0.5*(1.0 + s[
i])*(NNODE_1D-1);
819 index[
i] = int(float_index);
822 double excess = float_index - index[
i];
832 total_index += index[
i]*
833 static_cast<unsigned>(pow(static_cast<float>(NNODE_1D),
834 static_cast<int>(
i)));
837 return this->
node_pt(this->Pconv[total_index]);
851 if(n_value==(2*DIM) || n_value==((2*DIM)+1)) {
return 2; }
859 if(n_value==(2*DIM) || n_value==((2*DIM)+1)) {
return 4; }
860 else {
return this->
nnode(); }
867 const int &n_value)
const 869 if(n_value==(2*DIM) || n_value==((2*DIM)+1))
873 else {
return this->
shape(s,psi); }
892 public virtual FaceGeometry<LinearisedQTaylorHoodElement>
908 <LinearisedQTaylorHoodElement> >
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
void unpin(const unsigned &i)
Unpin the i-th stored variable.
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: 8 (6 velocities + 2 pressures)
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 ...
Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure node.
void set_eigenfunction_normalisation_element(LinearisedNavierStokesEigenfunctionNormalisationElement *const &normalisation_el_pt)
the boolean flag check_nodal_data is set to false.
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.
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.
double * Density_Ratio_pt
Pointer to the density ratio (relative to the density used in the definition of the Reynolds number) ...
void pin_elemental_redundant_nodal_pressure_dofs()
Unpin the proper nodal pressure dofs.
static void unpin_all_pressure_dofs(const Vector< GeneralisedElement *> &element_pt)
Unpin all pressure dofs in elements listed in Vector.
void unpin_elemental_pressure_dofs()
Unpin all pressure dofs.
void get_interpolated_values(const unsigned &t, const Vector< double > &s, Vector< double > &values)
Get all function values [U^C,U^S,...,P^S] at previous timestep t (t=0: present; t>0: previous timeste...
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 *& viscosity_ratio_pt()
Pointer to the viscosity ratio.
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...
RefineableLinearisedNavierStokesEquations()
Empty Constructor.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
void rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: Reconstruct pressure from the (merged) sons.
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.
double * Re_pt
Pointer to global Reynolds number.
unsigned nvertex_node() const
Number of vertex nodes in the element.
double *& re_pt()
Pointer to Reynolds number.
double interpolated_p_linearised_nst(const Vector< double > &s, const unsigned &i) const
Return the i-th component of the FE interpolated pressure p[i] at local coordinate s...
RefineableLinearisedQTaylorHoodElement()
Constructor:
void pin(const unsigned &i)
Pin the i-th stored variable.
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley 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...
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...
unsigned ncont_interpolated_values() const
Number of continuously interpolated values: 4*DIM (velocities)
void rebuild_from_sons(Mesh *&mesh_pt)
Rebuild from sons: empty.
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
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...
void further_setup_hanging_nodes()
Perform additional hanging node procedures for variables that are not interpolated by all nodes...
virtual unsigned u_index_linearised_nst(const unsigned &i) const
Return the index at which the i-th unknown velocity component is stored. The default value...
virtual unsigned nvertex_node() const
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.
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==6 or 7, the fraction is the same as the 1d ...
virtual unsigned npres_linearised_nst() const =0
Return the number of pressure degrees of freedom associated with a single pressure component in the e...
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate, const unsigned &real) const
Strain-rate tensor: where (in that order)
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
static const double Node_location_tolerance
Default value for the tolerance to be used when locating nodes via local coordinates.
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 the viscosity ratio (relative to the viscosity used in the definition of the Reynolds numb...
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...
double *& density_ratio_pt()
Pointer to the density ratio.
virtual void pshape_linearised_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
virtual void pin_elemental_redundant_nodal_pressure_dofs()
Pin unused nodal pressure dofs (empty by default, because by default pressure dofs are not associated...
double interpolated_u_linearised_nst(const Vector< double > &s, const unsigned &i) const
Compute the element's residual Vector and the jacobian matrix. Virtual function can be overloaded by ...
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 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.
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 nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overloa...
void further_build()
Further build: pass the pointers down to the sons.
virtual void unpin_elemental_pressure_dofs()=0
Unpin all pressure dofs in the element.
virtual int p_index_linearised_nst(const unsigned &i) const
Which nodal value represents the pressure?
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...
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...
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...
RefineableLinearisedQCrouzeixRaviartElement()
Constructor.
Refineable version of linearised axisymmetric quadratic Crouzeix-Raviart elements.
Refineable version of the linearised axisymmetric Navier–Stokes equations.
A class for elements that solve the linearised version of the unsteady Navier–Stokes equations in cy...
void unpin_elemental_pressure_dofs()
Unpin all the internal pressure freedoms.
unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at node n. Bumped up to 8 so we don't have to worry if a h...
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...
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 ...
Refineable version of linearised axisymmetric quadratic Taylor-Hood elements.
unsigned nnode() const
Return the number of nodes.
LinearisedNavierStokesEigenfunctionNormalisationElement * normalisation_element_pt()
Pointer to normalisation element.
void fill_in_generic_residual_contribution_linearised_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...
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...
double * ReSt_pt
Pointer to global Reynolds number x Strouhal number (=Womersley)
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when the time-derivatives are computed...