88 #ifndef OOMPH_POLAR_NAVIER_STOKES
89 #define OOMPH_POLAR_NAVIER_STOKES
93 #include <oomph-lib-config.h>
97 #include "../generic/Qelements.h"
184 DShape& dtestdx)
const = 0;
194 DShape& dtestdx)
const = 0;
203 Shape& test)
const = 0;
215 for (
unsigned i = 0;
i < 2;
i++)
223 (*Body_force_fct_pt)(time, x, result);
266 const double&
re()
const
380 virtual double u_pnst(
const unsigned& n,
const unsigned&
i)
const = 0;
386 const unsigned&
i)
const = 0;
414 for (
unsigned t = 0;
t < n_time;
t++)
425 virtual double p_pnst(
const unsigned& n_p)
const = 0;
428 virtual void fix_pressure(
const unsigned& p_dof,
const double& p_value) = 0;
493 void output(std::ostream& outfile,
const unsigned& nplot);
505 void output(FILE* file_pt,
const unsigned& nplot);
519 void full_output(std::ostream& outfile,
const unsigned& nplot);
526 const unsigned& nplot,
533 const unsigned& nplot,
540 const unsigned& nplot,
650 residuals, jacobian, mass_matrix, 2);
666 unsigned n_node =
nnode();
672 for (
unsigned i = 0;
i < 2;
i++)
677 for (
unsigned l = 0; l < n_node; l++)
688 unsigned n_node =
nnode();
695 double interpolated_u = 0.0;
697 for (
unsigned l = 0; l < n_node; l++)
699 interpolated_u +=
u_pnst(l,
i) * psi[l];
702 return (interpolated_u);
716 double interpolated_p = 0.0;
718 for (
unsigned l = 0; l < n_pres; l++)
720 interpolated_p +=
p_pnst(l) * psi[l];
723 return (interpolated_p);
733 const unsigned& j)
const
736 unsigned n_node =
nnode();
740 DShape dpsifdx(n_node, 2);
746 double interpolated_dudx = 0.0;
751 for (
unsigned l = 0; l < n_node; l++)
753 interpolated_dudx +=
u_pnst(l,
i) * dpsifdx(l, j);
756 return (interpolated_dudx);
829 double u_pnst(
const unsigned& n,
const unsigned&
i)
const
837 double u_pnst(
const unsigned&
t,
const unsigned& n,
const unsigned&
i)
const
845 double p_pnst(
const unsigned& i_internal)
const
868 void get_load_data(std::set<std::pair<Data*, unsigned>>& paired_load_data);
877 void output(std::ostream& outfile,
const unsigned& Nplot)
890 void output(FILE* file_pt,
const unsigned& Nplot)
932 for (
unsigned i = 0;
i < 9;
i++)
935 dtestdx(
i, 0) = dpsidx(
i, 0);
936 dtestdx(
i, 1) = dpsidx(
i, 1);
960 for (
unsigned i = 0;
i < 9;
i++)
963 dtestdx(
i, 0) = dpsidx(
i, 0);
964 dtestdx(
i, 1) = dpsidx(
i, 1);
990 for (
unsigned i = 0;
i < 3;
i++) test[
i] = psi[
i];
1076 return this->
node_pt(Pconv[n_p]);
1081 double u_pnst(
const unsigned& n,
const unsigned&
i)
const
1089 double u_pnst(
const unsigned&
t,
const unsigned& n,
const unsigned&
i)
const
1121 void get_load_data(std::set<std::pair<Data*, unsigned>>& paired_load_data);
1130 void output(std::ostream& outfile,
const unsigned& Nplot)
1142 void output(FILE* file_pt,
const unsigned& Nplot)
1167 for (
unsigned i = 0;
i < 9;
i++)
1170 dtestdx(
i, 0) = dpsidx(
i, 0);
1171 dtestdx(
i, 1) = dpsidx(
i, 1);
1185 const unsigned& ipt,
1195 for (
unsigned i = 0;
i < 9;
i++)
1198 dtestdx(
i, 0) = dpsidx(
i, 0);
1199 dtestdx(
i, 1) = dpsidx(
i, 1);
1215 double psi1[2], psi2[2];
1222 for (
unsigned i = 0;
i < 2;
i++)
1224 for (
unsigned j = 0; j < 2; j++)
1227 psi[2 *
i + j] = psi2[
i] * psi1[j];
1244 for (
unsigned i = 0;
i < 4;
i++) test[
i] = psi[
i];
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
A class that represents a collection of data; each Data object may contain many different individual ...
void pin(const unsigned &i)
Pin the i-th stored variable.
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...
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
A general Finite Element class.
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 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...
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.
unsigned nnode() const
Return the number of nodes.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as .
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(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
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 ...
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
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.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
/////////////////////////////////////////////////////////////////////////// /////////////////////////...
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 output(FILE *file_pt, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
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.
int p_local_eqn(const unsigned &n)
Return the local equation numbers for the pressure values.
PolarCrouzeixRaviartElement()
Constructor, there are DIM+1 internal values (for the pressure)
void pshape_pnst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
unsigned npres_pnst() const
Return number of pressure values.
virtual unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at local node n.
void output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
void get_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Add to the set paired_load_data pairs of pointers to data objects and unsigned integers that index th...
unsigned P_pnst_internal_index
Internal index that indicates at which internal data the pressure is stored.
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....
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...
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...
double p_pnst(const unsigned &i_internal) const
Return the pressure values at internal dof i_internal (Discontinous pressure interpolation – no need ...
void output(std::ostream &outfile, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
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(std::ostream &outfile)
Redirect output to NavierStokesEquations output.
static const unsigned Initial_Nvalue[]
Static array of ints to hold required number of variables at 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....
A class for elements that solve the polar Navier–Stokes equations, This contains the generic maths – ...
PolarNavierStokesEquations()
Constructor: NULL the body force and source function.
double dissipation() const
Return integral of dissipation over element.
double *& density_ratio_pt()
Pointer to Density ratio.
double interpolated_u_pnst(const Vector< double > &s, const unsigned &i) const
Return FE interpolated velocity u[i] at local coordinate s.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute the element's residual Vector.
double *& re_invfr_pt()
Pointer to global inverse Froude number.
virtual void pshape_pnst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
NavierStokesBodyForceFctPt & body_force_fct_pt()
Access function for the body-force pointer.
double kin_energy() const
Get integral of kinetic energy over element.
static double Default_Physical_Constant_Value
Static default value for the physical constants (all initialised to zero)
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...
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...
const Vector< double > & g() const
Vector of gravitational components.
virtual void pshape_pnst(const Vector< double > &s, Shape &psi, Shape &test) const =0
Compute the pressure shape and test functions at local coordinate s.
Vector< double > * G_pt
Pointer to global gravity Vector.
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
const double & viscosity_ratio() const
Viscosity ratio for element: Element's viscosity relative to the viscosity used in the definition of ...
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...
const double & re_invfr() const
Global inverse Froude number.
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.
NavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
static double Default_Physical_Ratio_Value
Static default value for the physical ratios (all are initialised to one)
const double & alpha() const
Alpha.
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 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.
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....
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Strain-rate tensor: Now returns polar strain.
double get_source_fct(double time, const Vector< double > &x)
Calculate the source fct at given time and Eulerian position.
double *& alpha_pt()
Pointer to Alpha.
void output(std::ostream &outfile)
Output functionget_vels(const Vector<double>& x_to_get, Vector<double>& vels): x,y,...
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....
virtual int p_nodal_index_pnst()
Which nodal value represents the pressure? (Default: negative, indicating that pressure is not based ...
void get_body_force(double time, const Vector< double > &x, Vector< double > &result)
Calculate the body force at a 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...
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.
NavierStokesSourceFctPt & source_fct_pt()
Access function for the source-function pointer.
double * Re_pt
Pointer to global Reynolds number.
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley number)
static int Pressure_not_stored_at_node
Static "magic" number that indicates that the pressure is not stored at a node.
double(* NavierStokesSourceFctPt)(const double &time, const Vector< double > &x)
Function pointer to source function fct(t,x) x is a Vector!
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...
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)
void output(FILE *file_pt)
C-style output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points.
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)
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....
const double & re() const
Reynolds 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.
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
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.
virtual double u_pnst(const unsigned &t, const unsigned &n, const unsigned &i) const =0
Velocity i at local node n at timestep t (t=0: present; t>0: previous). Uses suitably interpolated va...
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 Jacobi...
double pressure_integral() const
Integral of pressure over element.
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!
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...
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.
const double & density_ratio() const
Density ratio for element: Element's density relative to the viscosity used in the definition of the ...
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...
NavierStokesSourceFctPt source_fct_pt() const
Access function for the source-function pointer. Const version.
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....
double * Alpha_pt
Pointer to the angle alpha.
virtual unsigned npres_pnst() const =0
Function to return number of pressure degrees of freedom.
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
//////////////////////////////////////////////////////////////// My own work: /// Return FE interpola...
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.
double p_pnst(const unsigned &n_p) const
Access function for the pressure values at local pressure node n_p (const version)
void get_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Add to the set paired_load_data pairs of pointers to data objects and unsigned integers that index th...
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.
static const unsigned Pconv[]
Static array of ints to hold conversion from pressure node numbers to actual node numbers.
void output(FILE *file_pt, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
static const unsigned Initial_Nvalue[]
Static array of ints to hold number of variables at node.
unsigned npres_pnst() const
Return number of pressure values.
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...
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...
Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure 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 local coordinate s (tak...
void output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
int p_local_eqn(const unsigned &n)
Return the local equation numbers for the pressure values.
void output(std::ostream &outfile, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
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...
PolarTaylorHoodElement()
Constructor, no internal data points.
void output(std::ostream &outfile)
Redirect output to NavierStokesEquations output.
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_pnst()
Which nodal value represents the pressure?
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
////////////////////////////////////////////////////////////////////// //////////////////////////////...
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
std::string type() const
Return string that indicates the type of the timestepper (e.g. "BDF", "Newmark", etc....
void shape< 2 >(const double &s, double *Psi)
1D shape functions specialised to linear order (2 Nodes)
//////////////////////////////////////////////////////////////////// ////////////////////////////////...