28 #ifndef OOMPH_TNAVIER_STOKES_ELEMENTS_HEADER
29 #define OOMPH_TNAVIER_STOKES_ELEMENTS_HEADER
33 #include <oomph-lib-config.h>
38 #include "../generic/Telements.h"
40 #include "../generic/error_estimator.h"
59 template<
unsigned DIM>
168 double p_nst(
const unsigned&
t,
const unsigned&
i)
const
201 std::set<std::pair<Data*, unsigned>>& paired_load_data);
212 std::set<std::pair<Data*, unsigned>>& paired_pressure_data);
221 void output(std::ostream& outfile,
const unsigned& nplot)
233 void output(FILE* file_pt,
const unsigned& n_plot)
262 return DIM + (DIM * (DIM - 1)) / 2;
270 unsigned num_entries = DIM + (DIM * (DIM - 1)) / 2;
271 if (flux.size() < num_entries)
273 std::ostringstream error_message;
274 error_message <<
"The flux vector has the wrong number of entries, "
275 << flux.size() <<
", whereas it should be at least "
276 << num_entries << std::endl;
278 OOMPH_CURRENT_FUNCTION,
279 OOMPH_EXCEPTION_LOCATION);
291 for (
unsigned i = 0;
i < DIM;
i++)
293 flux[icount] = strainrate(
i,
i);
298 for (
unsigned i = 0;
i < DIM;
i++)
300 for (
unsigned j =
i + 1; j < DIM; j++)
302 flux[icount] = strainrate(
i, j);
339 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const;
349 template<
unsigned DIM>
358 double J = this->dshape_eulerian(
s, psi, dpsidx);
372 template<
unsigned DIM>
374 DIM>::dshape_and_dtest_eulerian_at_knot_nst(
const unsigned& ipt,
381 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
399 template<
unsigned DIM>
412 const double J = this->dshape_eulerian_at_knot(
413 ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
417 for (
unsigned i = 0;
i < 9;
i++)
421 for (
unsigned k = 0; k < 2; k++)
423 dtestdx(
i, k) = dpsidx(
i, k);
425 for (
unsigned p = 0; p < 2; p++)
427 for (
unsigned q = 0; q < 9; q++)
429 d_dtestdx_dX(p, q,
i, k) = d_dpsidx_dX(p, q,
i, k);
462 this->pshape_nst(
s, psi);
492 this->pshape_nst(
s, psi);
528 dshape_local(
s, psi, dpsi);
534 const double det = local_to_eulerian_mapping(dpsi, inverse_jacobian);
538 transform_derivatives(inverse_jacobian, dppsidx);
587 dshape_local(
s, psi, dpsi);
593 const double det = local_to_eulerian_mapping(dpsi, inverse_jacobian);
597 transform_derivatives(inverse_jacobian, dppsidx);
662 template<
unsigned DIM>
664 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const
667 unsigned n_node = this->nnode();
670 unsigned n_press = this->npres_nst();
673 std::pair<unsigned, unsigned> dof_lookup;
676 unsigned pressure_dof_number = DIM;
679 for (
unsigned n = 0; n < n_press; n++)
682 int local_eqn_number = this->p_local_eqn(n);
687 if (local_eqn_number >= 0)
691 dof_lookup.first = this->eqn_number(local_eqn_number);
692 dof_lookup.second = pressure_dof_number;
695 dof_lookup_list.push_front(dof_lookup);
700 for (
unsigned n = 0; n < n_node; n++)
703 unsigned nv = this->node_pt(n)->nvalue();
706 for (
unsigned v = 0; v < nv; v++)
709 int local_eqn_number = this->nodal_local_eqn(n, v);
712 if (local_eqn_number >= 0)
716 dof_lookup.first = this->eqn_number(local_eqn_number);
717 dof_lookup.second = v;
720 dof_lookup_list.push_front(dof_lookup);
736 template<
unsigned DIM>
857 double p_nst(
const unsigned& n_p)
const
864 double p_nst(
const unsigned&
t,
const unsigned& n_p)
const
872 return static_cast<int>(DIM);
904 std::set<std::pair<Data*, unsigned>>& paired_load_data);
915 std::set<std::pair<Data*, unsigned>>& paired_pressure_data);
924 void output(std::ostream& outfile,
const unsigned& nplot)
936 void output(FILE* file_pt,
const unsigned& n_plot)
965 return DIM + (DIM * (DIM - 1)) / 2;
973 unsigned num_entries = DIM + (DIM * (DIM - 1)) / 2;
974 if (flux.size() < num_entries)
976 std::ostringstream error_message;
977 error_message <<
"The flux vector has the wrong number of entries, "
978 << flux.size() <<
", whereas it should be at least "
979 << num_entries << std::endl;
981 OOMPH_CURRENT_FUNCTION,
982 OOMPH_EXCEPTION_LOCATION);
994 for (
unsigned i = 0;
i < DIM;
i++)
996 flux[icount] = strainrate(
i,
i);
1001 for (
unsigned i = 0;
i < DIM;
i++)
1003 for (
unsigned j =
i + 1; j < DIM; j++)
1005 flux[icount] = strainrate(
i, j);
1025 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const
1028 unsigned n_node = this->
nnode();
1031 std::pair<unsigned, unsigned> dof_lookup;
1034 for (
unsigned n = 0; n < n_node; n++)
1040 for (
unsigned v = 0; v < nv; v++)
1052 dof_lookup.first = this->
eqn_number(local_eqn_number);
1055 dof_lookup.second = v;
1058 dof_lookup_list.push_front(dof_lookup);
1095 template<
unsigned DIM>
1104 double J = this->dshape_eulerian(
s, psi, dpsidx);
1118 template<
unsigned DIM>
1120 const unsigned& ipt,
1127 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
1150 ppsi[2] = 1.0 -
s[0] -
s[1];
1152 dppsidx(0, 0) = 1.0;
1153 dppsidx(0, 1) = 0.0;
1155 dppsidx(1, 0) = 0.0;
1156 dppsidx(1, 1) = 1.0;
1158 dppsidx(2, 0) = -1.0;
1159 dppsidx(2, 1) = -1.0;
1168 dshape_local(
s, psi, dpsi);
1171 const double det = local_to_eulerian_mapping(dpsi, inverse_jacobian);
1175 transform_derivatives(inverse_jacobian, dppsidx);
1202 ppsi[3] = 1.0 -
s[0] -
s[1] -
s[2];
1204 dppsidx(0, 0) = 1.0;
1205 dppsidx(0, 1) = 0.0;
1206 dppsidx(0, 2) = 0.0;
1208 dppsidx(1, 0) = 0.0;
1209 dppsidx(1, 1) = 1.0;
1210 dppsidx(1, 2) = 0.0;
1212 dppsidx(2, 0) = 0.0;
1213 dppsidx(2, 1) = 0.0;
1214 dppsidx(2, 2) = 1.0;
1216 dppsidx(3, 0) = -1.0;
1217 dppsidx(3, 1) = -1.0;
1218 dppsidx(3, 2) = -1.0;
1224 dshape_local(
s, psi, dpsi);
1230 const double det = local_to_eulerian_mapping(dpsi, inverse_jacobian);
1234 transform_derivatives(inverse_jacobian, dppsidx);
1256 const unsigned& ipt,
1266 const double J = this->dshape_eulerian_at_knot(
1267 ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
1271 for (
unsigned i = 0;
i < 6;
i++)
1275 for (
unsigned k = 0; k < 2; k++)
1277 dtestdx(
i, k) = dpsidx(
i, k);
1279 for (
unsigned p = 0; p < 2; p++)
1281 for (
unsigned q = 0; q < 6; q++)
1283 d_dtestdx_dX(p, q,
i, k) = d_dpsidx_dX(p, q,
i, k);
1305 const unsigned& ipt,
1315 const double J = this->dshape_eulerian_at_knot(
1316 ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
1320 for (
unsigned i = 0;
i < 10;
i++)
1324 for (
unsigned k = 0; k < 3; k++)
1326 dtestdx(
i, k) = dpsidx(
i, k);
1328 for (
unsigned p = 0; p < 3; p++)
1330 for (
unsigned q = 0; q < 10; q++)
1332 d_dtestdx_dX(p, q,
i, k) = d_dpsidx_dX(p, q,
i, k);
1353 psi[2] = 1.0 -
s[0] -
s[1];
1367 psi[3] = 1.0 -
s[0] -
s[1] -
s[2];
1374 template<
unsigned DIM>
1380 this->pshape_nst(
s, psi);
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.
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...
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 ...
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
FaceGeometry()
Constructor: Call constructor of base.
FaceGeometry()
Constructor: Call constructor of base.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
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...
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.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
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 ...
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number.
int local_eqn_number(const unsigned long &ieqn_global) const
Return the local equation number corresponding to the ieqn_global-th global equation number....
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
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 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 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 output(std::ostream &outfile)
Output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points.
Vector< FpPressureAdvDiffRobinBCElementBase * > Pressure_advection_diffusion_robin_element_pt
Storage for FaceElements that apply Robin BC for pressure adv diff equation used in Fp preconditioner...
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
An OomphLibError object which should be thrown when an run-time error is encountered....
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
///////////////////////////////////////////////////////////////////////////
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....
unsigned npres_nst() const
Return number of pressure values.
unsigned P_nst_internal_index
Internal index that indicates at which internal datum the pressure is stored.
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Create a list of pairs for all unknowns in this element, so that the first entry in each pair contain...
double p_nst(const unsigned &i) const
Return the pressure values at internal dof i_internal (Discontinous pressure interpolation – no need ...
TCrouzeixRaviartElement()
Constructor, there are DIM+1 internal values (for the pressure)
void identify_pressure_data(std::set< std::pair< Data *, unsigned >> &paired_pressure_data)
Add to the set paired_pressure_data pairs containing.
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Upper triangular entries in strain rate tensor.
unsigned nvertex_node() const
Number of vertex nodes in the element.
double dshape_and_dtest_eulerian_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 dshape_and_dtest_eulerian_at_knot_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...
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.
void identify_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 unsignedegers that index the va...
int p_local_eqn(const unsigned &n) const
Return the local equation numbers for the pressure values.
double dpshape_and_dptest_eulerian_nst(const Vector< double > &s, Shape &ppsi, DShape &dppsidx, Shape &ptest, DShape &dptestdx) const
Pressure shape and test functions and their derivs w.r.t. to global coords at local coordinate s (tak...
void unpin_all_internal_pressure_dofs()
Unpin all internal pressure dofs.
void output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as unenriched shape functions.
void output(std::ostream &outfile, const unsigned &nplot)
Redirect output to NavierStokesEquations output.
void build_fp_press_adv_diff_robin_bc_element(const unsigned &face_index)
Build FaceElements that apply the Robin boundary condition to the pressure advection diffusion proble...
double p_nst(const unsigned &t, const unsigned &i) const
Return the pressure values at internal dof i_internal (Discontinous pressure interpolation – no need ...
void pshape_nst(const Vector< double > &s, Shape &psi, Shape &test) const
Pressure shape and test functions at local coordinte s.
virtual unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
void pshape_nst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
void output(FILE *file_pt, const unsigned &n_plot)
Redirect output to NavierStokesEquations output.
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
TCrouzeixRaviartElement(const TCrouzeixRaviartElement< DIM > &dummy)=delete
Broken copy constructor.
unsigned ndof_types() const
The number of "DOF types" that degrees of freedom in this element are sub-divided into: Velocity and ...
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....
///////////////////////////////////////////////////////////////////////// ///////////////////////////...
unsigned p_index_nst()
Which nodal value represents the pressure?
void pin_all_nodal_pressure_dofs()
Pin all nodal pressure dofs.
TTaylorHoodElement()
Constructor, no internal data points.
static const unsigned TEMPLATE_PARAMETER_DIM
Publicly exposed template parameter.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
double dshape_and_dtest_eulerian_at_knot_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...
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
void identify_pressure_data(std::set< std::pair< Data *, unsigned >> &paired_pressure_data)
Add to the set paired_pressure_data pairs containing.
void unpin_proper_nodal_pressure_dofs()
Unpin the proper nodal pressure dofs.
static const unsigned Initial_Nvalue[]
Static array of ints to hold number of variables at node.
void unpin_all_nodal_pressure_dofs()
Unpin all pressure dofs.
void build_fp_press_adv_diff_robin_bc_element(const unsigned &face_index)
Build FaceElements that apply the Robin boundary condition to the pressure advection diffusion proble...
void output(std::ostream &outfile, const unsigned &nplot)
Redirect output to NavierStokesEquations output.
double dshape_and_dtest_eulerian_at_knot_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, RankFourTensor< double > &d_dpsidx_dX, Shape &test, DShape &dtestdx, RankFourTensor< double > &d_dtestdx_dX, DenseMatrix< double > &djacobian_dX) const
Shape/test functions and derivs w.r.t. to global coords at integration point ipt; return Jacobian of ...
virtual unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Upper triangular entries in strain rate tensor.
void pshape_nst(const Vector< double > &s, Shape &psi) const
Test whether the pressure dof p_dof hanging or not?
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Create a list of pairs for all unknowns in this element, so that the first entry in each pair contain...
virtual double dpshape_and_dptest_eulerian_nst(const Vector< double > &s, Shape &ppsi, DShape &dppsidx, Shape &ptest, DShape &dptestdx) const
Compute the pressure shape and test functions and derivatives w.r.t. global coords at local coordinat...
unsigned nvertex_node() const
Number of vertex nodes in the element.
static const unsigned TEMPLATE_PARAMETER_NNODE_1D
Publicly exposed template parameter.
double p_nst(const unsigned &t, const unsigned &n_p) const
Access function for the pressure values at local pressure node n_p (const version)
double p_nst(const unsigned &n_p) const
Access function for the pressure values at local pressure node n_p (const version)
unsigned ndof_types() const
The number of "DOF types" that degrees of freedom in this element are sub-divided into: Velocity and ...
void output(FILE *file_pt, const unsigned &n_plot)
Redirect output to NavierStokesEquations output.
int p_nodal_index_nst() const
Set the value at which the pressure is stored in the nodes.
TTaylorHoodElement(const TTaylorHoodElement< DIM > &dummy)=delete
Broken copy constructor.
void output(std::ostream &outfile)
Redirect output to NavierStokesEquations output.
int p_local_eqn(const unsigned &n) const
Pointer to n_p-th pressure node.
static const unsigned Pconv[]
Static array of ints to hold conversion from pressure node numbers to actual node numbers.
void identify_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Add to the set paired_load_data pairs containing.
unsigned npres_nst() const
Return number of pressure values.
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 output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
double dshape_and_dtest_eulerian_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...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...