28 #ifndef OOMPH_GENERALISED_NEWTONIAN_NAVIER_STOKES_ELEMENTS_HEADER
29 #define OOMPH_GENERALISED_NEWTONIAN_NAVIER_STOKES_ELEMENTS_HEADER
33 #include <oomph-lib-config.h>
38 #include "../generic/Qelements.h"
39 #include "../generic/fsi.h"
40 #include "../generic/projection.h"
41 #include "../generic/generalised_newtonian_constitutive_models.h"
79 std::map<
Data*, std::vector<int>>& eqn_number_backup) = 0;
89 const unsigned& which_one = 0) = 0;
116 template<
unsigned DIM>
211 DShape& dtestdx)
const = 0;
221 DShape& dtestdx)
const = 0;
243 DShape& dptestdx)
const = 0;
260 for (
unsigned i = 0;
i < DIM;
i++)
268 (*Body_force_fct_pt)(time, x, result);
296 for (
unsigned i = 0;
i < DIM;
i++)
300 for (
unsigned j = 0; j < DIM; j++)
302 d_body_force_dx(j,
i) =
303 (body_force_pls[j] - body_force[j]) / eps_fd;
354 double source_pls = 0.0;
356 for (
unsigned i = 0;
i < DIM;
i++)
360 gradient[
i] = (source_pls - source) / eps_fd;
386 double*
const& parameter_pt,
430 const double&
re()
const
555 Shape& test)
const = 0;
562 double u_nst(
const unsigned& n,
const unsigned&
i)
const
569 double u_nst(
const unsigned&
t,
const unsigned& n,
const unsigned&
i)
const
606 const unsigned u_nodal_index = this->
u_index_nst(i);
611 for (
unsigned t = 0;
t < n_time;
t++)
639 virtual double p_nst(
const unsigned& n_p)
const = 0;
642 virtual double p_nst(
const unsigned&
t,
const unsigned& n_p)
const = 0;
645 virtual void fix_pressure(
const unsigned& p_dof,
const double& p_value) = 0;
661 double& max_invariant,
662 double& min_viscosity,
663 double& max_viscosity)
const;
752 const unsigned& which_one = 0);
765 const unsigned& nplot)
const
773 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
794 std::stringstream error_stream;
795 error_stream <<
"These Navier Stokes elements only store " << DIM + 1
797 <<
"but i is currently " <<
i << std::endl;
799 OOMPH_CURRENT_FUNCTION,
800 OOMPH_EXCEPTION_LOCATION);
824 std::stringstream error_stream;
825 error_stream <<
"These Navier Stokes elements only store " << DIM + 1
827 <<
"but i is currently " <<
i << std::endl;
829 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
845 void output(std::ostream& outfile,
const unsigned& nplot);
857 void output(FILE* file_pt,
const unsigned& nplot);
871 void full_output(std::ostream& outfile,
const unsigned& nplot);
878 const unsigned& nplot,
890 const unsigned& nplot,
897 const unsigned& nplot,
953 residuals, jacobian, mass_matrix, 2);
973 double*
const& parameter_pt,
989 double*
const& parameter_pt,
996 parameter_pt, dres_dparam, djac_dparam, dmass_matrix_dparam, 2);
1002 std::map<
Data*, std::vector<int>>& eqn_number_backup)
1007 for (
unsigned j = 0; j < nint; j++)
1010 if (eqn_number_backup[data_pt].
size() == 0)
1012 unsigned nvalue = data_pt->
nvalue();
1013 eqn_number_backup[data_pt].resize(nvalue);
1014 for (
unsigned i = 0;
i < nvalue;
i++)
1017 eqn_number_backup[data_pt][
i] = data_pt->
eqn_number(
i);
1026 unsigned nnod = this->
nnode();
1027 for (
unsigned j = 0; j < nnod; j++)
1030 if (eqn_number_backup[nod_pt].
size() == 0)
1032 unsigned nvalue = nod_pt->
nvalue();
1033 eqn_number_backup[nod_pt].resize(nvalue);
1034 for (
unsigned i = 0;
i < nvalue;
i++)
1061 if (solid_nod_pt != 0)
1064 if (eqn_number_backup[solid_posn_data_pt].
size() == 0)
1066 unsigned nvalue = solid_posn_data_pt->
nvalue();
1067 eqn_number_backup[solid_posn_data_pt].resize(nvalue);
1068 for (
unsigned i = 0;
i < nvalue;
i++)
1071 eqn_number_backup[solid_posn_data_pt][
i] =
1075 solid_posn_data_pt->
pin(
i);
1097 unsigned n_node =
nnode();
1103 for (
unsigned i = 0;
i < DIM;
i++)
1110 for (
unsigned l = 0; l < n_node; l++)
1121 unsigned n_node =
nnode();
1131 double interpolated_u = 0.0;
1133 for (
unsigned l = 0; l < n_node; l++)
1135 interpolated_u +=
nodal_value(l, u_nodal_index) * psi[l];
1138 return (interpolated_u);
1145 const unsigned&
i)
const
1148 unsigned n_node =
nnode();
1160 double interpolated_u = 0.0;
1162 for (
unsigned l = 0; l < n_node; l++)
1164 interpolated_u +=
nodal_value(
t, l, u_nodal_index) * psi[l];
1167 return (interpolated_u);
1181 unsigned n_node =
nnode();
1191 unsigned n_u_dof = 0;
1192 for (
unsigned l = 0; l < n_node; l++)
1196 if (global_eqn >= 0)
1203 du_ddata.resize(n_u_dof, 0.0);
1204 global_eqn_number.resize(n_u_dof, 0);
1209 for (
unsigned l = 0; l < n_node; l++)
1213 if (global_eqn >= 0)
1216 global_eqn_number[count] = global_eqn;
1218 du_ddata[count] = psi[l];
1237 double interpolated_p = 0.0;
1239 for (
unsigned l = 0; l < n_pres; l++)
1241 interpolated_p +=
p_nst(l) * psi[l];
1244 return (interpolated_p);
1259 double interpolated_p = 0.0;
1261 for (
unsigned l = 0; l < n_pres; l++)
1263 interpolated_p +=
p_nst(
t, l) * psi[l];
1266 return (interpolated_p);
1275 unsigned dim =
s.size();
1278 data.resize(2 *
dim + 1);
1281 for (
unsigned i = 0;
i <
dim;
i++)
1301 template<
unsigned DIM>
1338 const unsigned& ipt,
1389 double p_nst(
const unsigned&
t,
const unsigned&
i)
const
1423 std::set<std::pair<Data*, unsigned>>& paired_load_data);
1434 std::set<std::pair<Data*, unsigned>>& paired_pressure_data);
1444 void output(std::ostream& outfile,
const unsigned& nplot)
1457 void output(FILE* file_pt,
const unsigned& nplot)
1495 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const;
1505 template<
unsigned DIM>
1506 inline double GeneralisedNewtonianQCrouzeixRaviartElement<
1514 double J = this->dshape_eulerian(
s, psi, dpsidx);
1527 template<
unsigned DIM>
1529 DIM>::dshape_and_dtest_eulerian_at_knot_nst(
const unsigned& ipt,
1536 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
1557 const unsigned& ipt,
1567 const double J = this->dshape_eulerian_at_knot(
1568 ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
1572 for (
unsigned i = 0;
i < 9;
i++)
1576 for (
unsigned k = 0; k < 2; k++)
1578 dtestdx(
i, k) = dpsidx(
i, k);
1580 for (
unsigned p = 0; p < 2; p++)
1582 for (
unsigned q = 0; q < 9; q++)
1584 d_dtestdx_dX(p, q,
i, k) = d_dpsidx_dX(p, q,
i, k);
1607 const unsigned& ipt,
1617 const double J = this->dshape_eulerian_at_knot(
1618 ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
1622 for (
unsigned i = 0;
i < 27;
i++)
1626 for (
unsigned k = 0; k < 3; k++)
1628 dtestdx(
i, k) = dpsidx(
i, k);
1630 for (
unsigned p = 0; p < 3; p++)
1632 for (
unsigned q = 0; q < 27; q++)
1634 d_dtestdx_dX(p, q,
i, k) = d_dpsidx_dX(p, q,
i, k);
1677 dppsidx(0, 0) = 0.0;
1678 dppsidx(1, 0) = 1.0;
1679 dppsidx(2, 0) = 0.0;
1681 dppsidx(0, 1) = 0.0;
1682 dppsidx(1, 1) = 0.0;
1683 dppsidx(2, 1) = 1.0;
1689 dshape_local(
s, psi, dpsi);
1695 const double det = local_to_eulerian_mapping(dpsi, inverse_jacobian);
1699 transform_derivatives(inverse_jacobian, dppsidx);
1713 template<
unsigned DIM>
1718 this->pshape_nst(
s, psi);
1758 dppsidx(0, 0) = 0.0;
1759 dppsidx(1, 0) = 1.0;
1760 dppsidx(2, 0) = 0.0;
1761 dppsidx(3, 0) = 0.0;
1763 dppsidx(0, 1) = 0.0;
1764 dppsidx(1, 1) = 0.0;
1765 dppsidx(2, 1) = 1.0;
1766 dppsidx(3, 1) = 0.0;
1768 dppsidx(0, 2) = 0.0;
1769 dppsidx(1, 2) = 0.0;
1770 dppsidx(2, 2) = 0.0;
1771 dppsidx(3, 2) = 1.0;
1777 dshape_local(
s, psi, dpsi);
1783 const double det = local_to_eulerian_mapping(dpsi, inverse_jacobian);
1787 transform_derivatives(inverse_jacobian, dppsidx);
1856 template<
unsigned DIM>
1892 const unsigned& ipt,
1937 return static_cast<int>(DIM);
1955 double p_nst(
const unsigned&
t,
const unsigned& n_p)
const
1963 return static_cast<unsigned>(pow(2.0,
static_cast<int>(DIM)));
1983 std::set<std::pair<Data*, unsigned>>& paired_load_data);
1995 std::set<std::pair<Data*, unsigned>>& paired_pressure_data);
2005 void output(std::ostream& outfile,
const unsigned& nplot)
2017 void output(FILE* file_pt,
const unsigned& nplot)
2037 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const;
2047 template<
unsigned DIM>
2048 inline double GeneralisedNewtonianQTaylorHoodElement<
2056 double J = this->dshape_eulerian(
s, psi, dpsidx);
2072 template<
unsigned DIM>
2074 DIM>::dshape_and_dtest_eulerian_at_knot_nst(
const unsigned& ipt,
2081 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
2106 double psi1[2], psi2[2];
2107 double dpsi1[2], dpsi2[2];
2117 for (
unsigned i = 0;
i < 2;
i++)
2119 for (
unsigned j = 0; j < 2; j++)
2122 ppsi[2 *
i + j] = psi2[
i] * psi1[j];
2123 dppsidx(2 *
i + j, 0) = psi2[
i] * dpsi1[j];
2124 dppsidx(2 *
i + j, 1) = dpsi2[
i] * psi1[j];
2132 dshape_local(
s, psi, dpsi);
2138 const double det = local_to_eulerian_mapping(dpsi, inverse_jacobian);
2142 transform_derivatives(inverse_jacobian, dppsidx);
2165 const unsigned& ipt,
2175 const double J = this->dshape_eulerian_at_knot(
2176 ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
2180 for (
unsigned i = 0;
i < 9;
i++)
2184 for (
unsigned k = 0; k < 2; k++)
2186 dtestdx(
i, k) = dpsidx(
i, k);
2188 for (
unsigned p = 0; p < 2; p++)
2190 for (
unsigned q = 0; q < 9; q++)
2192 d_dtestdx_dX(p, q,
i, k) = d_dpsidx_dX(p, q,
i, k);
2215 const unsigned& ipt,
2225 const double J = this->dshape_eulerian_at_knot(
2226 ipt, psi, dpsidx, djacobian_dX, d_dpsidx_dX);
2230 for (
unsigned i = 0;
i < 27;
i++)
2234 for (
unsigned k = 0; k < 3; k++)
2236 dtestdx(
i, k) = dpsidx(
i, k);
2238 for (
unsigned p = 0; p < 3; p++)
2240 for (
unsigned q = 0; q < 27; q++)
2242 d_dtestdx_dX(p, q,
i, k) = d_dpsidx_dX(p, q,
i, k);
2262 double psi1[2], psi2[2];
2269 for (
unsigned i = 0;
i < 2;
i++)
2271 for (
unsigned j = 0; j < 2; j++)
2274 psi[2 *
i + j] = psi2[
i] * psi1[j];
2294 double psi1[2], psi2[2], psi3[2];
2295 double dpsi1[2], dpsi2[2], dpsi3[2];
2307 for (
unsigned i = 0;
i < 2;
i++)
2309 for (
unsigned j = 0; j < 2; j++)
2311 for (
unsigned k = 0; k < 2; k++)
2314 ppsi[4 *
i + 2 * j + k] = psi3[
i] * psi2[j] * psi1[k];
2315 dppsidx(4 *
i + 2 * j + k, 0) = psi3[
i] * psi2[j] * dpsi1[k];
2316 dppsidx(4 *
i + 2 * j + k, 1) = psi3[
i] * dpsi2[j] * psi1[k];
2317 dppsidx(4 *
i + 2 * j + k, 2) = dpsi3[
i] * psi2[j] * psi1[k];
2326 dshape_local(
s, psi, dpsi);
2332 const double det = local_to_eulerian_mapping(dpsi, inverse_jacobian);
2336 transform_derivatives(inverse_jacobian, dppsidx);
2355 double psi1[2], psi2[2], psi3[2];
2364 for (
unsigned i = 0;
i < 2;
i++)
2366 for (
unsigned j = 0; j < 2; j++)
2368 for (
unsigned k = 0; k < 2; k++)
2371 psi[4 *
i + 2 * j + k] = psi3[
i] * psi2[j] * psi1[k];
2381 template<
unsigned DIM>
2386 this->pshape_nst(
s, psi);
2447 template<
class TAYLOR_HOOD_ELEMENT>
2469 if (fld < this->
dim())
2472 unsigned nnod = this->
nnode();
2473 for (
unsigned j = 0; j < nnod; j++)
2476 data_values.push_back(std::make_pair(this->
node_pt(j), fld));
2483 unsigned Pconv_size = this->
dim() + 1;
2484 for (
unsigned j = 0; j < Pconv_size; j++)
2487 unsigned vertex_index = this->Pconv[j];
2488 data_values.push_back(
2489 std::make_pair(this->
node_pt(vertex_index), fld));
2501 return this->
dim() + 1;
2510 if (fld == this->
dim())
2534 unsigned n_dim = this->
dim();
2535 unsigned n_node = this->
nnode();
2540 this->pshape_nst(
s, psi);
2542 Shape psif(n_node), testf(n_node);
2543 DShape dpsifdx(n_node, n_dim), dtestfdx(n_node, n_dim);
2546 double J = this->dshape_and_dtest_eulerian_nst(
2547 s, psif, dpsifdx, testf, dtestfdx);
2552 Shape testf(n_node);
2553 DShape dpsifdx(n_node, n_dim), dtestfdx(n_node, n_dim);
2557 this->dshape_and_dtest_eulerian_nst(
s, psi, dpsifdx, testf, dtestfdx);
2566 const unsigned& fld,
2569 unsigned n_dim = this->
dim();
2570 unsigned n_node = this->
nnode();
2575 return this->interpolated_p_nst(
t,
s);
2581 unsigned u_nodal_index = this->u_index_nst(fld);
2587 this->
shape(s, psi);
2590 double interpolated_u = 0.0;
2593 for (
unsigned l = 0; l < n_node; l++)
2595 interpolated_u += this->
nodal_value(t, l, u_nodal_index) * psi[l];
2597 return interpolated_u;
2605 if (fld == this->
dim())
2607 return this->npres_nst();
2611 return this->
nnode();
2619 if (fld == this->
dim())
2621 return this->p_local_eqn(j);
2625 const unsigned u_nodal_index = this->u_index_nst(fld);
2636 template<
class ELEMENT>
2649 template<
class ELEMENT>
2662 template<
class CROUZEIX_RAVIART_ELEMENT>
2683 if (fld < this->
dim())
2686 const unsigned n_node = this->
nnode();
2687 for (
unsigned n = 0; n < n_node; n++)
2690 data_values.push_back(std::make_pair(this->
node_pt(n), fld));
2697 const unsigned n_press = this->npres_nst();
2699 for (
unsigned j = 0; j < n_press; j++)
2701 data_values.push_back(std::make_pair(
2714 return this->
dim() + 1;
2723 if (fld == this->
dim())
2747 unsigned n_dim = this->
dim();
2748 unsigned n_node = this->
nnode();
2753 this->pshape_nst(
s, psi);
2755 Shape psif(n_node), testf(n_node);
2756 DShape dpsifdx(n_node, n_dim), dtestfdx(n_node, n_dim);
2759 double J = this->dshape_and_dtest_eulerian_nst(
2760 s, psif, dpsifdx, testf, dtestfdx);
2765 Shape testf(n_node);
2766 DShape dpsifdx(n_node, n_dim), dtestfdx(n_node, n_dim);
2770 this->dshape_and_dtest_eulerian_nst(
s, psi, dpsifdx, testf, dtestfdx);
2779 const unsigned& fld,
2782 unsigned n_dim = this->
dim();
2787 return this->interpolated_p_nst(
s);
2792 return this->interpolated_u_nst(
t,
s, fld);
2800 if (fld == this->
dim())
2802 return this->npres_nst();
2806 return this->
nnode();
2814 if (fld == this->
dim())
2816 return this->p_local_eqn(j);
2820 const unsigned u_nodal_index = this->u_index_nst(fld);
2831 template<
class ELEMENT>
2845 template<
class ELEMENT>
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 ...
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
void pin(const unsigned &i)
Pin the i-th stored variable.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
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...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
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 ...
unsigned ntstorage() const
Return total number of doubles stored per value to record time history of each value (one for steady ...
/////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
A general Finite Element class.
virtual unsigned nplot_points_paraview(const unsigned &nplot) const
Return the number of actual plot points for paraview plot with parameter nplot. Broken virtual; can b...
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...
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
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...
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
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 dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
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 .
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
static double Default_fd_jacobian_step
Double used for the default finite difference step in elemental jacobian calculations.
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...
unsigned ninternal_data() const
Return the number of internal data objects.
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.
A Base class defining the generalise Newtonian constitutive relation.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
virtual double dpshape_and_dptest_eulerian_nst(const Vector< double > &s, Shape &ppsi, DShape &dppsidx, Shape &ptest, DShape &dptestdx) const =0
Compute the pressure shape and test functions and derivatives w.r.t. global coords at local coordinat...
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!
virtual void dinterpolated_u_nst_ddata(const Vector< double > &s, const unsigned &i, Vector< double > &du_ddata, Vector< unsigned > &global_eqn_number)
Compute the derivatives of the i-th component of velocity at point s with respect to all data that ca...
static double Default_Physical_Constant_Value
Static default value for the physical constants (all initialised to zero)
double * ReInvFr_pt
Pointer to global Reynolds number x inverse Froude number (= Bond number / Capillary number)
virtual double get_source_nst(const double &time, const unsigned &ipt, const Vector< double > &x)
Calculate the source fct at given time and Eulerian position.
static bool Pre_multiply_by_viscosity_ratio
Static boolean telling us whether we pre-multiply the pressure and continuity by the viscosity ratio.
void output(FILE *file_pt)
C-style output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points.
NavierStokesBodyForceFctPt body_force_fct_pt() const
Access function for the body-force pointer. Const version.
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
Add the element's contribution to its residuals vector, jacobian matrix and mass matrix.
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....
unsigned n_u_nst() const
Return the number of velocity components Used in FluidInterfaceElements.
double * Viscosity_Ratio_pt
Pointer to the viscosity ratio (relative to the viscosity used in the definition of the Reynolds numb...
bool Use_extrapolated_strainrate_to_compute_second_invariant
virtual void extrapolated_strain_rate(const unsigned &ipt, DenseMatrix< double > &strain_rate) const
Extrapolated strain-rate tensor: 1/2 (du_i/dx_j + du_j/dx_i) based on the previous time steps evaluat...
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.
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed....
virtual void get_body_force_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...
GeneralisedNewtonianConstitutiveEquation< DIM > * Constitutive_eqn_pt
Pointer to the generalised Newtonian constitutive equation.
void output(std::ostream &outfile)
Output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points.
virtual void fill_in_generic_residual_contribution_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...
std::string scalar_name_paraview(const unsigned &i) const
Name of the i-th scalar field. Default implementation returns V1 for the first one,...
virtual double dshape_and_dtest_eulerian_at_knot_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...
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
void max_and_min_invariant_and_viscosity(double &min_invariant, double &max_invariant, double &min_viscosity, double &max_viscosity) const
Get max. and min. strain rate invariant and visocosity over all integration points in element.
virtual 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 =0
Shape/test functions and derivs w.r.t. to global coords at integration point ipt; return Jacobian of ...
unsigned nscalar_paraview() const
Number of scalars/fields output by this element. Reimplements broken virtual function in base class.
virtual double dshape_and_dtest_eulerian_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....
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....
virtual void get_body_force_gradient_nst(const double &time, const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, DenseMatrix< double > &d_body_force_dx)
Get gradient of body force term at (Eulerian) position x. This function is virtual to allow overloadi...
virtual void get_dresidual_dnodal_coordinates(RankThreeTensor< double > &dresidual_dnodal_coordinates)
Compute derivatives of elemental residual vector with respect to nodal coordinates....
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)
const double & viscosity_ratio() const
Viscosity ratio for element: Element's viscosity relative to the viscosity used in the definition of ...
void enable_ALE()
(Re-)enable ALE, i.e. take possible mesh motion into account when evaluating the time-derivative....
void fill_in_contribution_to_dresiduals_dparameter(double *const ¶meter_pt, Vector< double > &dres_dparam)
Compute the element's residual Vector.
double pressure_integral() const
Integral of pressure over element.
const Vector< double > & g() const
Vector of gravitational components.
virtual void extrapolated_strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Extrapolated strain-rate tensor: 1/2 (du_i/dx_j + du_j/dx_i) based on the previous time steps evaluat...
double * Density_Ratio_pt
Pointer to the density ratio (relative to the density used in the definition of the Reynolds 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....
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...
virtual unsigned u_index_nst(const unsigned &i) const
Return the index at which the i-th unknown velocity component is stored. The default value,...
double du_dt_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.
GeneralisedNewtonianConstitutiveEquation< DIM > *& constitutive_eqn_pt()
Access function for the constitutive equation pointer.
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)
NavierStokesSourceFctPt source_fct_pt() const
Access function for the source-function pointer. Const version.
double dissipation() const
Return integral of dissipation over element.
double u_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_ns...
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,...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute the element's residual Vector.
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 ...
void use_current_strainrate_to_compute_second_invariant()
Switch to fully implict evaluation of non-Newtonian const eqn.
double(* NavierStokesSourceFctPt)(const double &time, const Vector< double > &x)
Function pointer to source function fct(t,x) x is a Vector!
double *& density_ratio_pt()
Pointer to Density ratio.
virtual double p_nst(const unsigned &t, const unsigned &n_p) const =0
Pressure at local pressure "node" n_p at time level t.
virtual void pshape_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
void get_vorticity(const Vector< double > &s, Vector< double > &vorticity) const
Compute the vorticity vector at local coordinate s.
void point_output_data(const Vector< double > &s, Vector< double > &data)
Output solution in data vector at local cordinates s: x,y [,z], u,v,[w], p.
void use_extrapolated_strainrate_to_compute_second_invariant()
Use extrapolation for non-Newtonian const eqn.
double interpolated_p_nst(const unsigned &t, const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s at time level t.
double(* NavierStokesPressureAdvDiffSourceFctPt)(const Vector< double > &x)
Function pointer to source function fct(x) for the pressure advection diffusion equation (only used d...
void fill_in_contribution_to_djacobian_dparameter(double *const ¶meter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam)
Compute the element's residual Vector and the jacobian matrix Virtual function can be overloaded by h...
double d_kin_energy_dt() const
Get integral of time derivative of kinetic energy over element.
GeneralisedNewtonianNavierStokesEquations()
Constructor: NULL the body force and source function and make sure the ALE terms are included by defa...
double *& re_invfr_pt()
Pointer to global inverse Froude number.
void pin_all_non_pressure_dofs(std::map< Data *, std::vector< int >> &eqn_number_backup)
Pin all non-pressure dofs and backup eqn numbers.
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley number)
void interpolated_u_nst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
void fill_in_contribution_to_djacobian_and_dmass_matrix_dparameter(double *const ¶meter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam)
Add the element's contribution to its residuals vector, jacobian matrix and mass matrix.
void scalar_value_paraview(std::ofstream &file_out, const unsigned &i, const unsigned &nplot) const
Write values of the i-th scalar field at the plot points. Needs to be implemented for each new specif...
static int Pressure_not_stored_at_node
Static "magic" number that indicates that the pressure is not stored at a node.
double interpolated_u_nst(const Vector< double > &s, const unsigned &i) const
Return FE interpolated velocity u[i] at local coordinate s.
NavierStokesBodyForceFctPt & body_force_fct_pt()
Access function for the body-force pointer.
NavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
Vector< double > *& g_pt()
Pointer to Vector of gravitational components.
virtual int p_nodal_index_nst() const
Return the index at which the pressure is stored if it is stored at the nodes. If not stored at the n...
double u_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...
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
NavierStokesSourceFctPt & source_fct_pt()
Access function for the source-function pointer.
virtual void fill_in_generic_dresidual_contribution_nst(double *const ¶meter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam, unsigned flag)
Compute the derivatives of the residuals for the Navier–Stokes equations with respect to a parameter ...
virtual void get_source_gradient_nst(const double &time, const unsigned &ipt, const Vector< double > &x, Vector< double > &gradient)
Get gradient of source term at (Eulerian) position x. This function is virtual to allow overloading i...
NavierStokesSourceFctPt Source_fct_pt
Pointer to volumetric source function.
double kin_energy() const
Get integral of kinetic energy over element.
virtual unsigned npres_nst() const =0
Function to return number of pressure degrees of freedom.
double *& viscosity_ratio_pt()
Pointer to Viscosity Ratio.
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...
const double & density_ratio() const
Density ratio for element: Element's density relative to the viscosity used in the definition of the ...
double *& re_pt()
Pointer to Reynolds number.
double * Re_pt
Pointer to global Reynolds number.
double interpolated_u_nst(const unsigned &t, const Vector< double > &s, const unsigned &i) const
Return FE interpolated velocity u[i] at local coordinate s at time level t (t=0: present; t>0: histor...
double * ReSt_pt
Pointer to global Reynolds number x Strouhal number (=Womersley)
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
virtual double p_nst(const unsigned &n_p) const =0
Pressure at local pressure "node" n_p Uses suitably interpolated value for hanging nodes.
virtual double interpolated_p_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
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....
Vector< double > * G_pt
Pointer to global gravity Vector.
const double & re() const
Reynolds number.
void disable_ALE()
Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!
void fill_in_contribution_to_hessian_vector_products(Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
Compute the hessian tensor vector products required to perform continuation of bifurcations analytica...
virtual void pshape_nst(const Vector< double > &s, Shape &psi, Shape &test) const =0
Compute the pressure shape and test functions at local coordinate s.
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 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)
Redirect output to NavierStokesEquations output.
unsigned P_nst_internal_index
Internal index that indicates at which internal data 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...
void output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
void identify_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Add to the set paired_load_data pairs containing.
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...
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, const unsigned &nplot)
Redirect output to NavierStokesEquations output.
double p_nst(const unsigned &i) const
Return the i-th pressure value (Discontinous pressure interpolation – no need to cater for hanging no...
void output(FILE *file_pt, const unsigned &nplot)
Redirect output to NavierStokesEquations output.
virtual unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at local node n.
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 ndof_types() const
The number of "DOF types" that degrees of freedom in this element are sub-divided into: Velocity and ...
double p_nst(const unsigned &t, const unsigned &i) const
Return the i-th pressure value (Discontinous pressure interpolation – no need to cater for hanging no...
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 pshape_nst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
static const unsigned Initial_Nvalue[]
Static array of ints to hold required number of variables at nodes.
int p_local_eqn(const unsigned &n) const
Return the local equation numbers for the pressure values.
GeneralisedNewtonianQCrouzeixRaviartElement()
Constructor, there are DIM+1 internal values (for the pressure)
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 ...
void identify_pressure_data(std::set< std::pair< Data *, unsigned >> &paired_pressure_data)
Add to the set paired_pressure_data pairs containing.
unsigned npres_nst() const
Return number of pressure values.
/////////////////////////////////////////////////////////////////////////
GeneralisedNewtonianQTaylorHoodElement()
Constructor, no internal data points.
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...
virtual int p_nodal_index_nst() const
Set the value at which the pressure is stored in the nodes.
unsigned ndof_types() const
Returns the number of "DOF types" that degrees of freedom in this element are sub-divided into: Veloc...
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 identify_pressure_data(std::set< std::pair< Data *, unsigned >> &paired_pressure_data)
Add to the set paired_pressure_data pairs containing.
void pshape_nst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
void output(FILE *file_pt, const unsigned &nplot)
Redirect output to NavierStokesEquations output.
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 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
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.
int p_local_eqn(const unsigned &n) const
Return the local equation numbers for the pressure values.
void output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
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.
double p_nst(const unsigned &n_p) const
Access function for the pressure values at local pressure node n_p (const version)
void output(std::ostream &outfile)
Redirect output to NavierStokesEquations output.
void output(std::ostream &outfile, const unsigned &nplot)
Redirect output to NavierStokesEquations output.
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...
static const unsigned Initial_Nvalue[]
Static array of ints to hold number of variables at node.
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 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...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
virtual void get_pressure_and_velocity_mass_matrix_diagonal(Vector< double > &press_mass_diag, Vector< double > &veloc_mass_diag, const unsigned &which_one=0)=0
Compute the diagonal of the velocity/pressure mass matrices. If which one=0, both are computed,...
virtual int p_nodal_index_nst() const =0
Return the index at which the pressure is stored if it is stored at the nodes. If not stored at the n...
virtual void pin_all_non_pressure_dofs(std::map< Data *, std::vector< int >> &eqn_number_backup)=0
Pin all non-pressure dofs and backup eqn numbers of all Data.
GeneralisedNewtonianTemplateFreeNavierStokesEquationsBase()
Constructor (empty)
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...
virtual ~GeneralisedNewtonianTemplateFreeNavierStokesEquationsBase()
Virtual destructor (empty)
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
A GeneralisedNewtonianConstitutiveEquation class defining a Newtonian fluid.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
An OomphLibError object which should be thrown when an run-time error is encountered....
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Wrapper class for projectable elements. Adds "projectability" to the underlying ELEMENT.
Crouzeix Raviart upgraded to become projectable.
unsigned nhistory_values_for_coordinate_projection()
Number of positional history values. (Note: count includes current value!)
double get_field(const unsigned &t, const unsigned &fld, const Vector< double > &s)
Return interpolated field fld at local coordinate s, at time level t (t=0: present; t>0: history valu...
int local_equation(const unsigned &fld, const unsigned &j)
Return local equation number of value j in field fld.
ProjectableGeneralisedNewtonianCrouzeixRaviartElement()
Constructor [this was only required explicitly from gcc 4.5.2 onwards...].
unsigned nfields_for_projection()
Number of fields to be projected: dim+1, corresponding to velocity components and pressure.
Vector< std::pair< Data *, unsigned > > data_values_of_field(const unsigned &fld)
Specify the values associated with field fld. The information is returned in a vector of pairs which ...
unsigned nhistory_values_for_projection(const unsigned &fld)
Number of history values to be stored for fld-th field. Whatever the timestepper has set up for the v...
double jacobian_and_shape_of_field(const unsigned &fld, const Vector< double > &s, Shape &psi)
Return Jacobian of mapping and shape functions of field fld at local coordinate s.
unsigned nvalue_of_field(const unsigned &fld)
Return number of values in field fld.
///////////////////////////////////////////////////////////////// ///////////////////////////////////...
unsigned nhistory_values_for_coordinate_projection()
Number of positional history values (Note: count includes current value!)
double jacobian_and_shape_of_field(const unsigned &fld, const Vector< double > &s, Shape &psi)
Return Jacobian of mapping and shape functions of field fld at local coordinate s.
unsigned nfields_for_projection()
Number of fields to be projected: dim+1, corresponding to velocity components and pressure.
Vector< std::pair< Data *, unsigned > > data_values_of_field(const unsigned &fld)
Specify the values associated with field fld. The information is returned in a vector of pairs which ...
unsigned nvalue_of_field(const unsigned &fld)
Return number of values in field fld.
unsigned nhistory_values_for_projection(const unsigned &fld)
Number of history values to be stored for fld-th field. Whatever the timestepper has set up for the v...
ProjectableGeneralisedNewtonianTaylorHoodElement()
Constructor [this was only required explicitly from gcc 4.5.2 onwards...].
double get_field(const unsigned &t, const unsigned &fld, const Vector< double > &s)
Return interpolated field fld at local coordinate s, at time level t (t=0: present; t>0: history valu...
int local_equation(const unsigned &fld, const unsigned &j)
Return local equation number of value j in field fld.
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
A Class for nodes that deform elastically (i.e. position is an unknown in the problem)....
Data *const & variable_position_pt() const
Pointer to variable_position data (const version)
////////////////////////////////////////////////////////////////////// //////////////////////////////...
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.
bool is_steady() const
Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-depen...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
void dshape< 2 >(const double &s, double *DPsi)
Derivatives of 1D shape functions specialised to linear order (2 Nodes)
void shape< 2 >(const double &s, double *Psi)
1D shape functions specialised to linear order (2 Nodes)
std::string to_string(T object, unsigned float_precision=8)
Conversion function that should work for anything with operator<< defined (at least all basic types).
//////////////////////////////////////////////////////////////////// ////////////////////////////////...