32 #ifndef OOMPH_SPHERICAL_NAVIER_STOKES_ELEMENTS_HEADER 33 #define OOMPH_SPHERICAL_NAVIER_STOKES_ELEMENTS_HEADER 37 #include <oomph-lib-config.h> 42 #include "../generic/Qelements.h" 43 #include "../generic/fsi.h" 164 Shape &test)
const=0;
178 if(Body_force_fct_pt == 0)
181 for(
unsigned i=0;
i<3;
i++) {result[
i] = 0.0;}
186 (*Body_force_fct_pt)(time,x,result);
196 if (Source_fct_pt == 0) {
return 0;}
198 else {
return (*Source_fct_pt)(time,x);}
212 inline double cot(
const double &th)
const {
return(1/tan(th));}
218 ALE_is_disabled(false)
312 const unsigned &
i)
const 336 if (time_stepper_pt->
type()!=
"Steady")
342 const unsigned n_time = time_stepper_pt->
ntstorage();
344 for(
unsigned t=0;
t<n_time;
t++)
357 ALE_is_disabled=
true;
366 ALE_is_disabled=
false;
374 virtual void fix_pressure(
const unsigned &p_dof,
const double &p_value)=0;
438 const unsigned& which_one=0);
451 void output(std::ostream &outfile,
const unsigned &nplot);
463 void output(FILE* file_pt,
const unsigned &nplot);
477 void full_output(std::ostream &outfile,
const unsigned &nplot);
483 void output_veloc(std::ostream &outfile,
const unsigned &nplot,
490 const unsigned &nplot);
495 void output_fct(std::ostream &outfile,
const unsigned &nplot,
501 void output_fct(std::ostream &outfile,
const unsigned &nplot,
512 double& error,
double& norm);
520 double& error,
double& norm);
530 exact_soln_dtheta_pt,
531 double& u_error,
double& u_norm,
532 double& p_error,
double& p_norm);
543 const double Re = this->
re();
549 ans[2] = r*sin(theta);
550 ans[3] = 0.5*Re*r*r*sin(theta)*sin(theta);
558 const double Re = this->
re();
565 ans[3] = Re*r*sin(theta)*sin(theta);
573 const double Re = this->
re();
579 ans[2] = r*cos(theta);
580 ans[3] = Re*r*r*sin(theta)*cos(theta);
614 jacobian,mass_matrix,2);
621 unsigned n_node =
nnode();
627 for (
unsigned i=0;
i<3;
i++)
634 for(
unsigned l=0;l<n_node;l++)
645 unsigned n_node =
nnode();
655 double interpolated_u = 0.0;
657 for(
unsigned l=0;l<n_node;l++)
659 interpolated_u +=
nodal_value(l,u_nodal_index)*psi[l];
662 return(interpolated_u);
667 const unsigned &
i,
const unsigned &j)
const 670 unsigned n_node =
nnode();
681 double interpolated_dudx = 0.0;
683 for(
unsigned l=0;l<n_node;l++)
685 interpolated_dudx +=
nodal_value(l,u_nodal_index)*dpsidx(l,j);
688 return(interpolated_dudx);
702 double interpolated_p = 0.0;
704 for(
unsigned l=0;l<n_pres;l++)
709 return(interpolated_p);
732 static const unsigned Initial_Nvalue[];
818 &paired_pressure_data);
825 void output(std::ostream &outfile,
const unsigned &nplot)
834 void output(FILE* file_pt,
const unsigned &nplot)
865 std::list<std::pair<unsigned long,unsigned> >& dof_lookup_list)
const;
886 for(
unsigned i=0;
i<9;
i++)
889 dtestdx(
i,0) = dpsidx(
i,0);
890 dtestdx(
i,1) = dpsidx(
i,1);
903 const unsigned &ipt,
Shape &psi,
911 for(
unsigned i=0;
i<9;
i++)
914 dtestdx(
i,0) = dpsidx(
i,0);
915 dtestdx(
i,1) = dpsidx(
i,1);
943 for(
unsigned i=0;
i<3;
i++) test[
i] = psi[
i];
986 static const unsigned Initial_Nvalue[];
992 static const unsigned Pconv[];
1031 {
return Initial_Nvalue[n];}
1072 std::set<std::pair<Data*,unsigned> > &paired_pressure_data);
1079 void output(std::ostream &outfile,
const unsigned &nplot)
1086 void output(FILE* file_pt,
const unsigned &nplot)
1104 std::list<std::pair<unsigned long,unsigned> >& dof_lookup_list)
const;
1128 for(
unsigned i=0;
i<9;
i++)
1131 dtestdx(
i,0) = dpsidx(
i,0);
1132 dtestdx(
i,1) = dpsidx(
i,1);
1153 for(
unsigned i=0;
i<9;
i++)
1156 dtestdx(
i,0) = dpsidx(
i,0);
1157 dtestdx(
i,1) = dpsidx(
i,1);
1171 double psi1[2], psi2[2];
1178 for(
unsigned i=0;
i<2;
i++)
1180 for(
unsigned j=0;j<2;j++)
1183 psi[2*
i + j] = psi2[
i]*psi1[j];
1199 for(
unsigned i=0;
i<4;
i++) test[
i] = psi[
i];
void output(std::ostream &outfile)
Output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points.
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 ...
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
SphericalNavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
void interpolated_u_spherical_nst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
void output_vorticity(std::ostream &outfile, const unsigned &nplot)
Output function: x,y,[z], [omega_x,omega_y,[and/or omega_z]] in tecplot format. nplot points in each ...
virtual double p_spherical_nst(const unsigned &n_p) const =0
Pressure at local pressure "node" n_p Uses suitably interpolated value for hanging nodes...
virtual void get_body_force_spherical_nst(const double &time, const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &result)
Calculate the body force at a given time and local and/or Eulerian position. This function is virtual...
double pressure_integral() const
Integral of pressure over element.
double *& re_invfr_pt()
Pointer to global inverse Froude number.
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 fix_pressure(const unsigned &p_dof, const double &p_value)
Pin p_dof-th pressure dof and set it to value specified by p_value.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute the element's residual Vector.
const double & re() const
Reynolds number.
double p_spherical_nst(const unsigned &i) const
Return the i-th pressure value (Discontinous pressure interpolation – no need to cater for hanging n...
void output(FILE *file_pt)
C-style output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points...
virtual double dshape_eulerian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidx) const
Return the geometric shape functions and also first derivatives w.r.t. global coordinates at the ipt-...
unsigned ndof_types() const
The number of "DOF types" that degrees of freedom in this element are sub-divided into: Velocity (thr...
virtual double get_source_spherical_nst(double time, const unsigned &ipt, const Vector< double > &x)
Calculate the source fct at given time and Eulerian position.
SphericalNavierStokesSourceFctPt & source_fct_pt()
Access function for the source-function pointer.
void output(FILE *file_pt)
Redirect output to SphericalNavierStokesEquations output.
void output(std::ostream &outfile, const unsigned &nplot)
Redirect output to SphericalNavierStokesEquations output.
double dshape_and_dtest_eulerian_at_knot_spherical_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Velocity shape and test functions and their derivs w.r.t. to global coords at ipt-th integation point...
const double & re_invfr() const
Global inverse Froude number.
static double Default_Physical_Ratio_Value
Static default value for the physical ratios (all are initialised to one)
void full_output(std::ostream &outfile)
Full output function: x,y,[z],u,v,[w],p,du/dt,dv/dt,[dw/dt],dissipation in tecplot format...
void get_load(const Vector< double > &s, const Vector< double > &N, Vector< double > &load)
This implements a pure virtual function defined in the FSIFluidElement class. The function computes t...
void get_vorticity(const Vector< double > &s, Vector< double > &vorticity) const
Compute the vorticity vector at local coordinate s.
int p_local_eqn(const unsigned &n) const
Return the local equation numbers for the pressure values.
double * ReSt_pt
Pointer to global Reynolds number x Strouhal number (=Womersley)
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
const double & density_ratio() const
Density ratio for element: Element's density relative to the viscosity used in the definition of the ...
virtual double dshape_and_dtest_eulerian_at_knot_spherical_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Compute the shape functions and derivatives w.r.t. global coords at ipt-th integration point Return J...
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Validate against exact solution at given time Solution is provided via function pointer. Plot at a given number of plot points and compute L2 error and L2 norm of velocity solution over element.
virtual void identify_pressure_data(std::set< std::pair< Data *, unsigned > > &paired_pressure_data)=0
Add to the set paired_pressure_data pairs containing.
SphericalNavierStokesBodyForceFctPt body_force_fct_pt() const
Access function for the body-force pointer. Const version.
double p_spherical_nst(const unsigned &n_p) const
Access function for the pressure values at local pressure node n_p (const version) ...
virtual void identify_load_data(std::set< std::pair< Data *, unsigned > > &paired_load_data)=0
Add to the set paired_load_data pairs containing.
void pin(const unsigned &i)
Pin the i-th stored variable.
double dissipation() const
Return integral of dissipation over element.
double dshape_and_dtest_eulerian_at_knot_spherical_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Velocity shape and test functions and their derivs w.r.t. to global coords at local coordinate s (tak...
QSphericalTaylorHoodElement()
Constructor, no internal data points.
double interpolated_u_spherical_nst(const Vector< double > &s, const unsigned &i) const
Return FE interpolated velocity u[i] at local coordinate s.
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
double dshape_and_dtest_eulerian_spherical_nst(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Velocity shape and test functions and their derivs w.r.t. to global coords at local coordinate s (tak...
double *& density_ratio_pt()
Pointer to Density ratio.
void get_traction(const Vector< double > &s, const Vector< double > &N, Vector< double > &traction)
Compute traction (on the viscous scale) exerted onto the fluid at local coordinate s...
void compute_error_e(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, FiniteElement::SteadyExactSolutionFctPt exact_soln_dr_pt, FiniteElement::SteadyExactSolutionFctPt exact_soln_dtheta_pt, double &u_error, double &u_norm, double &p_error, double &p_norm)
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
SphericalNavierStokesSourceFctPt source_fct_pt() const
Access function for the source-function pointer. Const version.
virtual double dshape_and_dtest_eulerian_spherical_nst(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Compute the shape functions and derivatives w.r.t. global coords at local coordinate s...
double dshape_and_dtest_eulerian_spherical_nst(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Velocity shape and test functions and their derivs w.r.t. to global coords at local coordinate s (tak...
virtual unsigned npres_spherical_nst() const =0
Function to return number of pressure degrees of freedom.
Vector< double > actual_dth(const Vector< double > &x)
double kin_energy() const
Get integral of kinetic energy over element.
unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at local node n.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
double u_spherical_nst(const unsigned &n, const unsigned &i) const
Velocity i at local node n. Uses suitably interpolated value for hanging nodes. The use of u_index_sp...
Vector< double > actual_dr(const Vector< double > &x)
double interpolated_p_spherical_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
jacobian matrix and mass matrix
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Compute the geometric shape functions and also first derivatives w.r.t. global coordinates at local c...
unsigned ndof_types() const
The number of "DOF types" that degrees of freedom in this element are sub-divided into: Velocity (3 c...
Vector< double > * G_pt
Pointer to global gravity Vector.
unsigned npres_spherical_nst() const
Return number of pressure values.
double interpolated_dudx_spherical_nst(const Vector< double > &s, const unsigned &i, const unsigned &j) const
Return matrix entry dudx(i,j) of the FE interpolated velocity derivative at local coordinate s...
virtual void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned > > &dof_lookup_list) const
Create a list of pairs for the unknowns that this element is "in charge of" – ignore any unknowns as...
QSphericalCrouzeixRaviartElement()
Constructor, there are 3 internal values (for the pressure)
void output(std::ostream &outfile)
Redirect output to SphericalNavierStokesEquations output.
Vector< double > *& g_pt()
Pointer to Vector of gravitational components.
void full_output(std::ostream &outfile, const unsigned &nplot)
Full output function: x,y,[z],u,v,[w],p,du/dt,dv/dt,[dw/dt],dissipation in tecplot format...
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...
virtual void fill_in_generic_residual_contribution_spherical_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacob...
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
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 get_pressure_and_velocity_mass_matrix_diagonal(Vector< double > &press_mass_diag, Vector< double > &veloc_mass_diag, const unsigned &which_one=0)
Compute the diagonal of the velocity/pressure mass matrices. If which one=0, both are computed...
A class that represents a collection of data; each Data object may contain many different individual ...
SphericalNavierStokesEquations()
Constructor: NULL the body force and source function and make sure the ALE terms are included by defa...
const double & viscosity_ratio() const
Viscosity ratio for element: Element's viscosity relative to the viscosity used in the definition of ...
int p_local_eqn(const unsigned &n) const
Return the local equation numbers for the pressure values.
void output_veloc(std::ostream &outfile, const unsigned &nplot, const unsigned &t)
Output function: x,y,[z],u,v,[w] in tecplot format. nplot points in each coordinate direction at time...
virtual void pshape_spherical_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
void output(FILE *file_pt, const unsigned &nplot)
Redirect output to SphericalNavierStokesEquations output.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
double *& re_invro_pt()
Pointer to global inverse Froude number.
double * Density_Ratio_pt
Pointer to the density ratio (relative to the density used in the definition of the Reynolds number) ...
void pshape_spherical_nst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
void output(std::ostream &outfile, const unsigned &nplot)
Redirect output to SphericalNavierStokesEquations output.
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(* SphericalNavierStokesSourceFctPt)(const double &time, const Vector< double > &x)
Function pointer to source function fct(t,x) x is a Vector!
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
const double & re_invro() const
Global Reynolds number multiplied by inverse Rossby number.
unsigned npres_spherical_nst() const
Return number of pressure values.
double cot(const double &th) const
virtual unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at node n. Can be overwritten for hanging node version...
virtual unsigned u_index_spherical_nst(const unsigned &i) const
Return the index at which the i-th unknown velocity component.
std::string type() const
Return string that indicates the type of the timestepper (e.g. "BDF", "Newmark", etc.)
static int Pressure_not_stored_at_node
Static "magic" number that indicates that the pressure is not stored at a node.
double du_dt_spherical_nst(const unsigned &n, const unsigned &i) const
i-th component of du/dt at local node n. Uses suitably interpolated value for hanging nodes...
virtual void fix_pressure(const unsigned &p_dof, const double &p_value)=0
Pin p_dof-th pressure dof and set it to value specified by p_value.
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
double * ReInvFr_pt
Pointer to global Reynolds number x inverse Froude number (= Bond number / Capillary number) ...
static double Default_Physical_Constant_Value
Static default value for the physical constants (all initialised to zero)
void(* SphericalNavierStokesBodyForceFctPt)(const double &time, const Vector< double > &x, Vector< double > &body_force)
Function pointer to body force function fct(t,x,f(x)) x is a Vector!
double * Re_pt
Pointer to global Reynolds number.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
unsigned P_spherical_nst_internal_index
void output(FILE *file_pt, const unsigned &nplot)
Redirect output to SphericalNavierStokesEquations output.
virtual int p_local_eqn(const unsigned &n) const =0
Access function for the local equation number information for the pressure. p_local_eqn[n] = local eq...
const Vector< double > & g() const
Vector of gravitational components.
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Add a (pointer to an) internal data object to the element and return the index required to obtain it ...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Add the elemental contribution to the jacobian matrix. and the residuals vector. Note that this funct...
void extract_velocity(std::ostream &outfile)
void enable_ALE()
(Re-)enable ALE, i.e. take possible mesh motion into account when evaluating the time-derivative. Note: By default, ALE is enabled, at the expense of possibly creating unnecessary work in problems where the mesh is, in fact, stationary.
int p_nodal_index_spherical_nst() const
Set the value at which the pressure is stored in the nodes In this case the third index because there...
void disable_ALE()
Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!
double u_spherical_nst(const unsigned &t, const unsigned &n, const unsigned &i) const
Velocity i at local node n at timestep t (t=0: present; t>0: previous). Uses suitably interpolated va...
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.
void fix_pressure(const unsigned &p_dof, const double &p_value)
Pin p_dof-th pressure dof and set it to value specified by p_value.
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...
void output(std::ostream &outfile)
Redirect output to SphericalNavierStokesEquations output.
double * Viscosity_Ratio_pt
Pointer to the viscosity ratio (relative to the viscosity used in the definition of the Reynolds numb...
unsigned nnode() const
Return the number of nodes.
void pshape_spherical_nst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
void output(FILE *file_pt)
Redirect output to SphericalNavierStokesEquations output.
void compute_shear_stress(std::ostream &outfile)
double d_kin_energy_dt() const
Get integral of time derivative of kinetic energy over element.
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...
Vector< double > actual(const Vector< double > &x)
The FSIFluidElement class is a base class for all fluid finite elements that apply a load (traction) ...
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact solution specified via function pointer at a given number of plot points. Function prints as many components as are returned in solution Vector.
double *& viscosity_ratio_pt()
Pointer to Viscosity Ratio.
void full_output(std::ostream &outfile)
Full output function: x,y,[z],u,v,[w],p,du/dt,dv/dt,[dw/dt],dissipation in tecplot format...
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node...
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Return the local equation number corresponding to the j-th value stored at the i-th internal data...
void shape< 2 >(const double &s, double *Psi)
1D shape functions specialised to linear order (2 Nodes)