92 #ifndef OOMPH_POLAR_NAVIER_STOKES 93 #define OOMPH_POLAR_NAVIER_STOKES 97 #include <oomph-lib-config.h> 101 #include "../generic/Qelements.h" 212 if(Body_force_fct_pt == 0)
215 for(
unsigned i=0;
i<2;
i++) {result[
i] = 0.0;}
220 (*Body_force_fct_pt)(time,x,result);
229 if (Source_fct_pt == 0) {
return 0;}
231 else {
return (*Source_fct_pt)(time,x);}
320 virtual double u_pnst(
const unsigned &n,
const unsigned &
i)
const=0;
324 virtual double u_pnst(
const unsigned &
t,
const unsigned &n,
325 const unsigned &i)
const=0;
337 double du_dt_pnst(
const unsigned &n,
const unsigned &i)
const 343 unsigned n_time = time_stepper_pt->
ntstorage();
348 if (time_stepper_pt->
type()!=
"Steady")
350 for(
unsigned t=0;t<n_time;t++)
361 virtual double p_pnst(
const unsigned &n_p)
const=0;
364 virtual void fix_pressure(
const unsigned &p_dof,
const double &p_value)=0;
417 void output(std::ostream &outfile,
const unsigned &nplot);
429 void output(FILE* file_pt,
const unsigned &nplot);
443 void full_output(std::ostream &outfile,
const unsigned &nplot);
449 void output_veloc(std::ostream &outfile,
const unsigned &nplot,
455 void output_fct(std::ostream &outfile,
const unsigned &nplot,
461 void output_fct(std::ostream &outfile,
const unsigned &nplot,
472 double& error,
double& norm);
480 double& error,
double& norm);
575 unsigned n_node =
nnode();
581 for (
unsigned i=0;i<2;i++)
586 for(
unsigned l=0;l<n_node;l++)
588 veloc[
i] +=
u_pnst(l,i)*psi[l];
597 unsigned n_node =
nnode();
604 double interpolated_u = 0.0;
606 for(
unsigned l=0;l<n_node;l++)
608 interpolated_u +=
u_pnst(l,i)*psi[l];
611 return(interpolated_u);
625 double interpolated_p = 0.0;
627 for(
unsigned l=0;l<n_pres;l++)
629 interpolated_p +=
p_pnst(l)*psi[l];
632 return(interpolated_p);
643 unsigned n_node =
nnode();
653 double interpolated_dudx = 0.0;
658 for(
unsigned l=0;l<n_node;l++)
660 interpolated_dudx +=
u_pnst(l,i)*dpsifdx(l,j);
663 return(interpolated_dudx);
684 static const unsigned Initial_Nvalue[];
732 double u_pnst(
const unsigned &n,
const unsigned &
i)
const 738 double u_pnst(
const unsigned &
t,
const unsigned &n,
const unsigned &
i)
745 double p_pnst(
const unsigned &i_internal)
const 762 void get_load_data(std::set<std::pair<Data*,unsigned> > &paired_load_data);
768 void output(std::ostream &outfile,
const unsigned &Nplot)
776 void output(FILE* file_pt,
const unsigned &Nplot)
811 for(
unsigned i=0;
i<9;
i++)
814 dtestdx(
i,0) = dpsidx(
i,0);
815 dtestdx(
i,1) = dpsidx(
i,1);
829 const unsigned &ipt,
Shape &psi,
837 for(
unsigned i=0;
i<9;
i++)
840 dtestdx(
i,0) = dpsidx(
i,0);
841 dtestdx(
i,1) = dpsidx(
i,1);
866 for(
unsigned i=0;
i<3;
i++) test[
i] = psi[
i];
893 static const unsigned Initial_Nvalue[];
899 static const unsigned Pconv[];
934 {
return Initial_Nvalue[n];}
941 {
return this->
node_pt(Pconv[n_p]);}
945 double u_pnst(
const unsigned &n,
const unsigned &
i)
const 951 double u_pnst(
const unsigned &
t,
const unsigned &n,
952 const unsigned &
i)
const {
return this->
nodal_value(t,n,i);}
975 void get_load_data(std::set<std::pair<Data*,unsigned> > &paired_load_data);
981 void output(std::ostream &outfile,
const unsigned &Nplot)
988 void output(FILE* file_pt,
const unsigned &Nplot)
1012 for(
unsigned i=0;
i<9;
i++)
1015 dtestdx(
i,0) = dpsidx(
i,0);
1016 dtestdx(
i,1) = dpsidx(
i,1);
1037 for(
unsigned i=0;
i<9;
i++)
1040 dtestdx(
i,0) = dpsidx(
i,0);
1041 dtestdx(
i,1) = dpsidx(
i,1);
1057 double psi1[2], psi2[2];
1064 for(
unsigned i=0;
i<2;
i++)
1066 for(
unsigned j=0;j<2;j++)
1069 psi[2*
i + j] = psi2[
i]*psi1[j];
1085 for(
unsigned i=0;
i<4;
i++) test[
i] = psi[
i];
PolarCrouzeixRaviartElement()
Constructor, there are DIM+1 internal values (for the pressure)
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 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.
double * Density_Ratio_pt
Pointer to the density ratio (relative to the density used in the definition of the Reynolds number) ...
virtual double dshape_and_dtest_eulerian_pnst(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...
const double & density_ratio() const
Density ratio for element: Element's density relative to the viscosity used in the definition of the ...
void output(std::ostream &outfile, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
void output(FILE *file_pt, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure node.
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...
NavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
double interpolated_u_pnst(const Vector< double > &s, const unsigned &i) const
Return FE interpolated velocity u[i] at local coordinate s.
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley number)
virtual unsigned required_nvalue(const unsigned &n) const
Number of values that must be stored at local node n by the element. The default is 0...
static int Pressure_not_stored_at_node
Static "magic" number that indicates that the pressure is not stored at a node.
double dshape_and_dtest_eulerian_at_knot_pnst(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...
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
Compute the element's residual Vector and the jacobian matrix Plus the mass matrix especially for eig...
NavierStokesSourceFctPt source_fct_pt() const
Access function for the source-function pointer. Const version.
unsigned P_pnst_internal_index
virtual unsigned npres_pnst() const =0
Function to return number of pressure degrees of freedom.
void output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
void interpolated_u_pnst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
void output(FILE *file_pt, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
double * value_pt(const unsigned &i) const
Return the pointer to the i-the stored value. Typically this is required when direct access to the st...
static double Default_Physical_Constant_Value
Static default value for the physical constants (all initialised to zero)
void get_body_force(double time, const Vector< double > &x, Vector< double > &result)
Calculate the body force at a given time and Eulerian position.
unsigned npres_pnst() const
Return number of 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...
A general Finite Element class.
double u_pnst(const unsigned &n, const unsigned &i) const
Return the velocity component u[i] at local node n. Uses suitably interpolated value for hanging node...
void output(std::ostream &outfile)
Redirect output to NavierStokesEquations output.
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
double(* NavierStokesSourceFctPt)(const double &time, const Vector< double > &x)
Function pointer to source function fct(t,x) x is a Vector!
const double & alpha() const
Alpha.
double p_pnst(const unsigned &n_p) const
Access function for the pressure values at local pressure node n_p (const version) ...
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
virtual void pshape_pnst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
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...
int p_local_eqn(const unsigned &n)
Return the local equation numbers for the pressure values.
const double & viscosity_ratio() const
Viscosity ratio for element: Element's viscosity relative to the viscosity used in the definition of ...
virtual double p_pnst(const unsigned &n_p) const =0
Pressure at local pressure "node" n_p Uses suitably interpolated value for hanging nodes...
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...
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.
void pshape_pnst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
NavierStokesSourceFctPt Source_fct_pt
Pointer to volumetric source function.
const double & re_invfr() const
Global inverse Froude number.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
virtual void fill_in_generic_residual_contribution(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...
double * Alpha_pt
Pointer to the angle alpha.
double *& alpha_pt()
Pointer to Alpha.
void get_traction(const Vector< double > &s, const Vector< double > &N, Vector< double > &traction)
Compute traction (on the viscous scale) at local coordinate s for outer unit normal N...
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
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.
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.
double u_pnst(const unsigned &n, const unsigned &i) const
Return the velocity component u[i] at local node n. Uses suitably interpolated value for hanging node...
void output(std::ostream &outfile)
Redirect output to NavierStokesEquations output.
double * ReInvFr_pt
Pointer to global Reynolds number x inverse Froude number (= Bond number / Capillary number) ...
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...
void output(FILE *file_pt)
C-style output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points...
void output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
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...
double u_pnst(const unsigned &t, const unsigned &n, const unsigned &i) const
Return the velocity component u[i] at local node n at timestep t (t=0: present; t>0: previous timeste...
void get_load(const Vector< double > &s, const Vector< double > &xi, const Vector< double > &x, const Vector< double > &N, Vector< double > &load)
The potential loading on an external SolidElement is always provided by the traction function...
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.
static double Default_Physical_Ratio_Value
Static default value for the physical ratios (all are initialised to one)
double dissipation() const
Return integral of dissipation over element.
virtual int p_nodal_index_pnst()
Which nodal value represents the pressure?
A class that represents a collection of data; each Data object may contain many different individual ...
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
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.
double * Re_pt
Pointer to global Reynolds number.
const Vector< double > & g() const
Vector of gravitational components.
double pressure_integral() const
Integral of pressure over element.
unsigned npres_pnst() const
Return number of pressure values.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Vector< double > * G_pt
Pointer to global gravity Vector.
Vector< double > *& g_pt()
Pointer to Vector of gravitational components.
void output(std::ostream &outfile, const unsigned &Nplot)
Redirect output to NavierStokesEquations 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...
void strain_rate_by_r(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Function to return polar strain multiplied by r.
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
PolarNavierStokesEquations()
Constructor: NULL the body force and source function.
double du_dt_pnst(const unsigned &n, const unsigned &i) const
i-th component of du/dt at local node n. Uses suitably interpolated value for hanging nodes...
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
const double & re() const
Reynolds number.
PolarTaylorHoodElement()
Constructor, no internal data points.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Compute the element's residual Vector and the jacobian matrix Virtual function can be overloaded by h...
double get_source_fct(double time, const Vector< double > &x)
Calculate the source fct at given time and Eulerian position.
virtual double dshape_and_dtest_eulerian_at_knot_pnst(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...
std::string type() const
Return string that indicates the type of the timestepper (e.g. "BDF", "Newmark", etc.)
void output(std::ostream &outfile)
Output functionget_vels(const Vector<double>& x_to_get, Vector<double>& vels): x,y,[z],u,v,[w],p in tecplot format. Default number of plot points.
virtual int p_local_eqn(const unsigned &n)=0
Access function for the local equation number information for the pressure. p_local_eqn[n] = local eq...
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.
NavierStokesBodyForceFctPt body_force_fct_pt() const
Access function for the body-force pointer. Const version.
double interpolated_dudx_pnst(const Vector< double > &s, const unsigned &i, const unsigned &j) const
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute the element's residual Vector.
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
double p_pnst(const unsigned &i_internal) const
Return the pressure values at internal dof i_internal (Discontinous pressure interpolation – no need...
void(* NavierStokesBodyForceFctPt)(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!
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 ...
double dshape_and_dtest_eulerian_pnst(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...
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 *& re_invfr_pt()
Pointer to global inverse Froude number.
double dshape_and_dtest_eulerian_pnst(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...
void pshape_pnst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
virtual double u_pnst(const unsigned &n, const unsigned &i) const =0
Velocity i at local node n. Uses suitably interpolated value for hanging nodes.
double dshape_and_dtest_eulerian_at_knot_pnst(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...
NavierStokesBodyForceFctPt & body_force_fct_pt()
Access function for the body-force pointer.
unsigned nnode() const
Return the number of nodes.
int p_local_eqn(const unsigned &n)
Return the local equation numbers for the pressure values.
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.
double kin_energy() const
Get integral of kinetic energy over element.
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...
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
double *& density_ratio_pt()
Pointer to Density ratio.
double u_pnst(const unsigned &t, const unsigned &n, const unsigned &i) const
Return the velocity component u[i] at local node n at timestep t (t=0: present; t>0: previous timeste...
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Strain-rate tensor: Now returns polar strain.
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)