30 #ifndef OOMPH_POROELASTICITY_ELEMENTS_HEADER 31 #define OOMPH_POROELASTICITY_ELEMENTS_HEADER 35 #include <oomph-lib-config.h> 38 #include "../generic/elements.h" 39 #include "../generic/shape.h" 41 #include "elasticity_tensor.h" 49 template <
unsigned DIM>
136 for(
unsigned i=0;
i<n;
i++)
143 (*Force_solid_fct_pt)(time,x,b);
158 for(
unsigned i=0;
i<n;
i++)
165 (*Force_fluid_fct_pt)(time,x,b);
182 (*Mass_source_fct_pt)(time,x,b);
190 const double E(
const unsigned &
i,
const unsigned &j,
191 const unsigned &k,
const unsigned &l)
const 208 virtual unsigned u_index(
const unsigned &n)
const = 0;
217 virtual unsigned q_edge_index(
const unsigned &n)
const = 0;
227 virtual double q_edge(
const unsigned &n)
const = 0;
231 virtual double q_edge(
const unsigned &
t,
const unsigned &n)
const = 0;
234 virtual double q_internal(
const unsigned &n)
const = 0;
238 virtual double q_internal(
const unsigned &t,
const unsigned &n)
const = 0;
241 virtual unsigned nq_basis()
const = 0;
248 Shape &q_basis)
const = 0;
252 Shape &div_q_basis_ds)
const = 0;
256 Shape &q_basis)
const 258 const unsigned n_node = this->
nnode();
259 Shape psi(n_node,DIM);
260 const unsigned n_q_basis = this->
nq_basis();
261 Shape q_basis_local(n_q_basis,DIM);
271 const unsigned &n)
const = 0;
282 virtual int p_local_eqn(
const unsigned &n)
const = 0;
285 virtual double p_value(
unsigned &n)
const = 0;
288 virtual unsigned np_basis()
const = 0;
292 Shape &p_basis)
const = 0;
295 virtual void pin_p_value(
const unsigned &n,
const double &p) = 0;
303 const Shape &q_basis_local,
306 Shape &q_basis)
const;
311 const Shape &q_basis_local,
313 Shape &q_basis)
const 315 const unsigned n_node = this->
nnode();
339 unsigned n_node =
nnode();
347 for(
unsigned i=0;
i<DIM;
i++)
350 unsigned u_nodal_index =
u_index(
i);
356 for(
unsigned l=0;l<n_node;l++)
365 const unsigned &
i)
const 368 unsigned n_node =
nnode();
377 unsigned u_nodal_index =
u_index(i);
383 for(
unsigned l=0;l<n_node;l++)
385 interpolated_u +=
nodal_value(l,u_nodal_index)*psi[l];
388 return(interpolated_u);
398 Shape q_basis(n_q_basis,DIM);
401 for(
unsigned i=0;
i<DIM;
i++)
404 for(
unsigned l=0;l<n_q_basis_edge;l++)
408 for(
unsigned l=n_q_basis_edge;l<n_q_basis;l++)
417 const unsigned i)
const 422 Shape q_basis(n_q_basis,DIM);
426 for(
unsigned l=0;l<n_q_basis_edge;l++)
428 q_i +=
q_edge(l)*q_basis(l,i);
430 for(
unsigned l=n_q_basis_edge;l<n_q_basis;l++)
432 q_i +=
q_internal(l-n_q_basis_edge)*q_basis(l,i);
445 unsigned n_node=
nnode();
446 const unsigned n_q_basis =
nq_basis();
450 Shape div_q_basis_ds(n_q_basis);
470 for(
unsigned l=0;l<n_q_basis_edge;l++)
472 div_q+=1.0/det*div_q_basis_ds(l)*
q_edge(l);
476 for(
unsigned l=n_q_basis_edge;l<n_q_basis;l++)
478 div_q+=1.0/det*div_q_basis_ds(l)*
q_internal(l-n_q_basis_edge);
503 Shape p_basis(n_p_basis);
512 for(
unsigned l=0;l<n_p_basis;l++)
533 const unsigned &
i)
const 545 const unsigned u_nodal_index=
u_index(i);
548 const unsigned n_time=time_stepper_pt->
ntstorage();
551 for(
unsigned t=0;t<n_time;t++)
563 const unsigned &
i)
const 575 const unsigned u_nodal_index=
u_index(i);
578 const unsigned n_time=time_stepper_pt->
ntstorage();
581 for(
unsigned t=0;t<n_time;t++)
606 const unsigned n_time=time_stepper_pt->
ntstorage();
609 for(
unsigned t=0;t<n_time;t++)
637 const unsigned n_time=time_stepper_pt->
ntstorage();
640 for(
unsigned t=0;t<n_time;t++)
672 void output(std::ostream &outfile,
const unsigned &nplot);
677 const unsigned &nplot,
683 const unsigned &nplot,
717 Shape &div_q_basis_ds,
718 Shape &div_q_test_ds)
const = 0;
733 Shape &div_q_basis_ds,
734 Shape &div_q_test_ds)
const = 0;
void interpolated_q(const Vector< double > &s, Vector< double > &u) const
Calculate the FE representation of q.
SourceFctPt Force_fluid_fct_pt
Pointer to fluid source function.
virtual int p_local_eqn(const unsigned &n) const =0
Return the equation number of the n-th pressure degree of freedom.
static double Default_k_inv_value
Static default value for 1/k.
void interpolated_p(const Vector< double > &s, double &p) const
Calculate the FE representation of p.
void(* SourceFctPt)(const double &time, const Vector< double > &x, Vector< double > &f)
Source function pointer typedef.
virtual double q_edge(const unsigned &n) const =0
Return the values of the edge (flux) degrees of freedom.
virtual double shape_basis_test_local_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsi, Shape &u_basis, Shape &u_test, DShape &du_basis_dx, DShape &du_test_dx, Shape &q_basis, Shape &q_test, Shape &p_basis, Shape &p_test, Shape &div_q_basis_ds, Shape &div_q_test_ds) const =0
Returns the geometric basis, and the q, p and divergence basis functions and test functions at integr...
void output(std::ostream &outfile)
Output with default number of plot points.
virtual double p_value(unsigned &n) const =0
Return the nth pressure value.
double interpolated_q(const Vector< double > &s, const unsigned i) const
Calculate the FE representation of the i-th component of q.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Fill in the Jacobian matrix for the Newton method.
virtual unsigned required_nvalue(const unsigned &n) const =0
Number of values required at node n.
MassSourceFctPt mass_source_fct_pt() const
Access function: Pointer to mass source function (const version)
const double & alpha() const
Access function for alpha.
void force_fluid(const double &time, const Vector< double > &x, Vector< double > &b) const
Indirect access to the fluid forcing function - returns 0 if no forcing function has been set...
virtual void fill_in_generic_residual_contribution(Vector< double > &residuals, DenseMatrix< double > &jacobian, bool flag)
Fill in residuals and, if flag==true, jacobian.
A general Finite Element class.
virtual unsigned nedge_gauss_point() const =0
Returns the number of gauss points along each edge of the element.
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
static double Default_porosity_value
Static default value for the porosity.
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output FE representation of exact soln: x,y,u1,u2,div_q,p at Nplot^DIM plot points.
virtual unsigned nq_basis_edge() const =0
Return the number of edge basis functions for q.
void get_q_basis(const Vector< double > &s, Shape &q_basis) const
Returns the transformed basis at local coordinate s.
void interpolated_u(const Vector< double > &s, Vector< double > &disp) const
Calculate the FE representation of u.
void(* MassSourceFctPt)(const double &time, const Vector< double > &x, double &f)
Mass source function pointer typedef.
double dq_internal_dt(const unsigned &n) const
dq_internal/dt for the n-th internal degree of freedom
SourceFctPt force_fluid_fct_pt() const
Access function: Pointer to fluid force function (const version)
double interpolated_u(const Vector< double > &s, const unsigned &i) const
Calculate the FE representation of the i-th component of u.
double dq_edge_dt(const unsigned &n) const
dq_edge/dt for the n-th edge degree of freedom
double interpolated_p(const Vector< double > &s) const
Calculate the FE representation of p and return it.
virtual void scale_basis(Shape &basis) const =0
Scale the edge basis to allow arbitrary edge mappings.
const double & density_ratio() const
Access function for the density ratio.
double transform_basis(const Vector< double > &s, const Shape &q_basis_local, Shape &psi, Shape &q_basis) const
Performs a div-conserving transformation of the vector basis functions from the reference element to ...
virtual int q_internal_local_eqn(const unsigned &n) const =0
Return the equation number of the n-th internal (moment) degree of freedom.
virtual double local_to_eulerian_mapping(const DShape &dpsids, DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Calculate the mapping from local to Eulerian coordinates, given the derivatives of the shape function...
unsigned self_test()
Self-test: Check inversion of element & do self-test for GeneralisedElement. Return 0 if OK...
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
SourceFctPt & force_solid_fct_pt()
Access function: Pointer to solid force function.
SourceFctPt & force_fluid_fct_pt()
Access function: Pointer to fluid force function.
virtual unsigned u_index(const unsigned &n) const =0
Return the nodal index of the n-th solid displacement unknown.
virtual int q_edge_local_eqn(const unsigned &n) const =0
Return the equation number of the n-th edge (flux) degree of freedom.
virtual double shape_basis_test_local(const Vector< double > &s, Shape &psi, DShape &dpsi, Shape &u_basis, Shape &u_test, DShape &du_basis_dx, DShape &du_test_dx, Shape &q_basis, Shape &q_test, Shape &p_basis, Shape &p_test, Shape &div_q_basis_ds, Shape &div_q_test_ds) const =0
Returns the geometric basis, and the q, p and divergence basis functions and test functions at local ...
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
void force_solid(const double &time, const Vector< double > &x, Vector< double > &b) const
Indirect access to the solid force function - returns 0 if no forcing function has been set...
MassSourceFctPt Mass_source_fct_pt
Pointer to the mass source function.
static double Default_alpha_value
Static default value for alpha.
MassSourceFctPt & mass_source_fct_pt()
Access function: Pointer to mass source function.
void set_q_internal_timestepper(TimeStepper *const time_stepper_pt)
Set the timestepper of the q internal data object.
SourceFctPt force_solid_fct_pt() const
Access function: Pointer to solid force function (const version)
virtual void pin_p_value(const unsigned &n, const double &p)=0
Pin the nth pressure value.
double * Porosity_pt
Porosity.
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
virtual void get_p_basis(const Vector< double > &s, Shape &p_basis) const =0
Return the pressure basis.
void set_time_stepper(TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
Set a new timestepper by resizing the appropriate storage. If already assigned the equation numbering...
virtual void pin_q_internal_value(const unsigned &n)=0
Pin the nth internal q value.
virtual void dshape_local(const Vector< double > &s, Shape &psi, DShape &dpsids) const
Function to compute the geometric shape functions and derivatives w.r.t. local coordinates at local c...
double * Lambda_sq_pt
Timescale ratio (non-dim. density)
ElasticityTensor *& elasticity_tensor_pt()
Return the pointer to the elasticity_tensor.
virtual unsigned q_internal_index() const =0
Return the index of the internal data where the q_internal degrees of freedom are stored...
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
double du_dt(const unsigned &n, const unsigned &i) const
du/dt at local node n
Class implementing the generic maths of the poroelasticity equations: linear elasticity coupled with ...
virtual double edge_gauss_point(const unsigned &edge, const unsigned &n) const =0
Returns the nth gauss point along an edge.
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...
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
virtual void edge_gauss_point_global(const unsigned &edge, const unsigned &n, Vector< double > &x) const =0
Returns the global coordinates of the nth gauss point along an edge.
void interpolated_div_q(const Vector< double > &s, double &div_q) const
Calculate the FE representation of div u.
static double Default_lambda_sq_value
Static default value for timescale ratio (1.0 – for natural scaling)
SourceFctPt Force_solid_fct_pt
Pointer to solid source function.
const double & lambda_sq() const
Access function for timescale ratio (nondim density)
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
const double E(const unsigned &i, const unsigned &j, const unsigned &k, const unsigned &l) const
Access function to the entries in the elasticity tensor.
virtual double q_internal(const unsigned &n) const =0
Return the values of the internal (moment) degrees of freedom.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
void get_stress(const Vector< double > &s, DenseMatrix< double > &sigma) const
Return the Cauchy stress tensor, as calculated from the elasticity tensor at specified local coordina...
double interpolated_div_q(const Vector< double > &s)
Calculate the FE representation of div q and return it.
double *& lambda_sq_pt()
Access function for pointer to timescale ratio (nondim density)
double * Density_ratio_pt
Density ratio.
double *& density_ratio_pt()
Access function for pointer to the density ratio.
virtual unsigned q_edge_node_number(const unsigned &n) const =0
Return the number of the node where the nth edge unknown is stored.
double *& alpha_pt()
Access function for pointer to alpha.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Fill in contribution to residuals for the Darcy equations.
bool is_steady() const
Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-depen...
const double & porosity() const
Access function for the porosity.
ElasticityTensor * Elasticity_tensor_pt
Pointer to the elasticity tensor.
PoroelasticityEquations()
Constructor.
double d2u_dt2(const unsigned &n, const unsigned &i) const
d^2u/dt^2 at local node n
virtual void get_div_q_basis_local(const Vector< double > &s, Shape &div_q_basis_ds) const =0
Returns the local form of the q basis and dbasis/ds at local coordinate s.
virtual void get_q_basis_local(const Vector< double > &s, Shape &q_basis) const =0
Returns the local form of the q basis at local coordinate s.
unsigned nnode() const
Return the number of nodes.
double transform_basis(const Vector< double > &s, const Shape &q_basis_local, Shape &psi, DShape &dpsi, Shape &q_basis) const
Performs a div-conserving transformation of the vector basis functions from the reference element to ...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
virtual unsigned nq_basis() const =0
Return the total number of computational basis functions for q.
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
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...
const double & k_inv() const
Access function for the nondim inverse permeability.
double *& k_inv_pt()
Access function for pointer to the nondim inverse permeability.
static double Default_density_ratio_value
Static default value for the density ratio.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
virtual unsigned np_basis() const =0
Return the total number of pressure basis functions.
virtual unsigned q_edge_index(const unsigned &n) const =0
Return the nodal index at which the nth edge unknown is stored.
double *& porosity_pt()
Access function for pointer to the porosity.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
Compute the error between the FE solution and the exact solution using the H(div) norm for q and L^2 ...
void get_strain(const Vector< double > &s, DenseMatrix< double > &strain) const
Return the strain tensor.
void mass_source(const double &time, const Vector< double > &x, double &b) const
Indirect access to the mass source function - returns 0 if no mass source function has been set...