27 #ifndef OOMPH_UNSTEADY_HEAT_ELEMENTS_HEADER
28 #define OOMPH_UNSTEADY_HEAT_ELEMENTS_HEADER
32 #include <oomph-lib-config.h>
37 #include "../generic/projection.h"
38 #include "../generic/nodes.h"
39 #include "../generic/Qelements.h"
40 #include "../generic/oomph_utilities.h"
70 template<
unsigned DIM>
137 for (
unsigned t = 0;
t < n_time;
t++)
176 void output(std::ostream& outfile,
const unsigned& nplot);
188 void output(FILE* file_pt,
const unsigned& n_plot);
193 const unsigned& nplot,
200 std::ostream& outfile,
201 const unsigned& nplot,
240 double& source)
const
250 (*Source_fct_pt)(
t, x, source);
283 unsigned n_node =
nnode();
290 DShape dpsidx(n_node, DIM);
296 for (
unsigned j = 0; j < DIM; j++)
302 for (
unsigned l = 0; l < n_node; l++)
305 for (
unsigned j = 0; j < DIM; j++)
307 flux[j] +=
nodal_value(l, u_nodal_index) * dpsidx(l, j);
336 unsigned n_node =
nnode();
348 double interpolated_u = 0.0;
351 for (
unsigned l = 0; l < n_node; l++)
353 interpolated_u +=
nodal_value(l, u_nodal_index) * psi[l];
356 return (interpolated_u);
366 unsigned n_node =
nnode();
378 double interpolated_u = 0.0;
381 for (
unsigned l = 0; l < n_node; l++)
383 interpolated_u +=
nodal_value(
t, l, u_nodal_index) * psi[l];
386 return (interpolated_u);
395 unsigned n_node =
nnode();
404 double interpolated_dudt = 0.0;
407 for (
unsigned l = 0; l < n_node; l++)
412 return (interpolated_dudt);
428 DShape& dtestdx)
const = 0;
438 DShape& dtestdx)
const = 0;
479 template<
unsigned DIM,
unsigned NNODE_1D>
520 void output(std::ostream& outfile,
const unsigned& n_plot)
536 void output(FILE* file_pt,
const unsigned& n_plot)
545 const unsigned& n_plot,
556 const unsigned& n_plot,
561 outfile, n_plot, time, exact_soln_pt);
595 template<
unsigned DIM,
unsigned NNODE_1D>
604 double J = this->dshape_eulerian(
s, psi, dpsidx);
608 for (
unsigned i = 0;
i < NNODE_1D;
i++)
611 for (
unsigned j = 0; j < DIM; j++)
613 dtestdx(
i, j) = dpsidx(
i, j);
628 template<
unsigned DIM,
unsigned NNODE_1D>
637 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
659 template<
unsigned DIM,
unsigned NNODE_1D>
661 :
public virtual QElement<DIM - 1, NNODE_1D>
677 template<
unsigned NNODE_1D>
696 template<
class UNSTEADY_HEAT_ELEMENT>
713 std::stringstream error_stream;
714 error_stream <<
"UnsteadyHeat elements only store a single field so "
715 "fld must be 0 rather"
716 <<
" than " << fld << std::endl;
718 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
723 unsigned nnod = this->
nnode();
727 for (
unsigned j = 0; j < nnod; j++)
730 data_values[j] = std::make_pair(this->
node_pt(j), fld);
750 std::stringstream error_stream;
751 error_stream <<
"UnsteadyHeat elements only store a single field so "
752 "fld must be 0 rather"
753 <<
" than " << fld << std::endl;
755 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
777 std::stringstream error_stream;
778 error_stream <<
"UnsteadyHeat elements only store a single field so "
779 "fld must be 0 rather"
780 <<
" than " << fld << std::endl;
782 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
785 unsigned n_dim = this->
dim();
786 unsigned n_node = this->
nnode();
788 DShape dpsidx(n_node, n_dim), dtestdx(n_node, n_dim);
790 this->dshape_and_dtest_eulerian_ust_heat(
s, psi, dpsidx, test, dtestdx);
804 std::stringstream error_stream;
805 error_stream <<
"UnsteadyHeat elements only store a single field so "
806 "fld must be 0 rather"
807 <<
" than " << fld << std::endl;
809 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
813 unsigned u_nodal_index = this->u_index_ust_heat();
816 unsigned n_node = this->
nnode();
823 double interpolated_u = 0.0;
826 for (
unsigned l = 0; l < n_node; l++)
828 interpolated_u += this->
nodal_value(t, l, u_nodal_index) * psi[l];
830 return interpolated_u;
840 std::stringstream error_stream;
841 error_stream <<
"UnsteadyHeat elements only store a single field so "
842 "fld must be 0 rather"
843 <<
" than " << fld << std::endl;
845 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
848 return this->
nnode();
858 std::stringstream error_stream;
859 error_stream <<
"UnsteadyHeat elements only store a single field so "
860 "fld must be 0 rather"
861 <<
" than " << fld << std::endl;
863 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
866 const unsigned u_nodal_index = this->u_index_ust_heat();
873 void output(std::ostream& outfile,
const unsigned& nplot)
875 unsigned el_dim = this->
dim();
884 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
889 for (
unsigned i = 0;
i < el_dim;
i++)
893 outfile << this->interpolated_u_ust_heat(
s) <<
" ";
894 outfile << this->interpolated_du_dt_ust_heat(
s) <<
" ";
900 for (
unsigned t = 1;
t < n_prev;
t++)
902 for (
unsigned i = 0;
i < el_dim;
i++)
910 for (
unsigned t = 1;
t < n_prev;
t++)
912 outfile << this->interpolated_u_ust_heat(
t,
s) <<
" ";
914 outfile << std::endl;
928 template<
class ELEMENT>
941 template<
class ELEMENT>
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
unsigned ntstorage() const
Return total number of doubles stored per value to record time history of each value (one for steady ...
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
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 std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction")
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 .
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...
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction")
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...
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Add tecplot zone "footer" to output stream (when plotting nplot points in each "coordinate direction"...
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
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.
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
ProjectableUnsteadyHeatElement()
Constructor [this was only required explicitly from gcc 4.5.2 onwards...].
unsigned nhistory_values_for_coordinate_projection()
Number of positional history values (Note: count includes current value!)
void output(std::ostream &outfile, const unsigned &nplot)
Output FE representation of soln: x,y,u or x,y,z,u at and history values at n_plot^DIM plot points.
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: Just one.
unsigned nvalue_of_field(const unsigned &fld)
Return number of values in field fld: One per node.
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. (Note: count includes current value!...
int local_equation(const unsigned &fld, const unsigned &j)
Return local equation number of value j in field fld.
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...
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
QUnsteadyHeatElement()
Constructor: Call constructors for QElement and UnsteadyHeat equations.
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for an exact solution: x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points.
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
double dshape_and_dtest_eulerian_ust_heat(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
QUnsteadyHeatElement(const QUnsteadyHeatElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
void output(FILE *file_pt)
C-style output function: x,y,u or x,y,z,u.
double dshape_and_dtest_eulerian_at_knot_ust_heat(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape/test functions and derivs w.r.t. to global coords at integration point ipt; return Jacobian of ...
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output function for a time-dependent exact solution. x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot ...
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,y,u or x,y,z,u at n_plot^DIM plot points.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: x,y,u or x,y,z,u at n_plot^DIM plot points.
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.
bool is_steady() const
Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-depen...
Base class so that we don't need to know the dimension just to set the source function!
virtual UnsteadyHeatSourceFctPt & source_fct_pt()=0
Access function: Pointer to source function.
void(* UnsteadyHeatSourceFctPt)(const double &time, const Vector< double > &x, double &u)
Function pointer to source function fct(t,x,f(x,t)) – x is a Vector!
A class for all isoparametric elements that solve the UnsteadyHeat equations.
void compute_norm(double &norm)
Compute norm of fe solution.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: flux[i] = du/dx_i.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Compute element residual Vector and element Jacobian matrix (wrapper)
void output(std::ostream &outfile)
Output with default number of plot points.
void output(FILE *file_pt)
C_style output with default number of plot points.
void disable_ALE()
Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!
double interpolated_u_ust_heat(const unsigned &t, const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s at previous time t (t=0: presen...
void enable_ALE()
(Re-)enable ALE, i.e. take possible mesh motion into account when evaluating the time-derivative....
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute element residual Vector (wrapper)
double interpolated_u_ust_heat(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
unsigned self_test()
Self-test: Return 0 for OK.
virtual double dshape_and_dtest_eulerian_ust_heat(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Shape/test functions and derivs w.r.t. to global coords at local coord. s; return Jacobian of mapping...
UnsteadyHeatEquations()
Constructor: Initialises the Source_fct_pt to null and sets flag to use ALE formulation of the equati...
UnsteadyHeatSourceFctPt Source_fct_pt
Pointer to source function:
const double & alpha() const
Alpha parameter (thermal inertia)
static double Default_beta_parameter
Static default value for the Beta parameter (thermal conductivity): One for natural scaling.
virtual void get_source_ust_heat(const double &t, const unsigned &ipt, const Vector< double > &x, double &source) const
Get source term at continous time t and (Eulerian) position x. Virtual so it can be overloaded in der...
UnsteadyHeatSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
void(* UnsteadyHeatSourceFctPt)(const double &time, const Vector< double > &x, double &u)
Function pointer to source function fct(t,x,f(x,t)) – x is a Vector!
UnsteadyHeatSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
UnsteadyHeatEquations(const UnsteadyHeatEquations &dummy)=delete
Broken copy constructor.
virtual double dshape_and_dtest_eulerian_at_knot_ust_heat(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Shape/test functions and derivs w.r.t. to global coords at integration point ipt; return Jacobian of ...
double *& alpha_pt()
Pointer to Alpha parameter (thermal inertia)
double interpolated_du_dt_ust_heat(const Vector< double > &s) const
Return FE representation of function value du/dt(s) at local coordinate s.
const double & beta() const
Beta parameter (thermal conductivity)
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,u_exact or x,y,z,u_exact at nplot^DIM plot points.
virtual void fill_in_generic_residual_contribution_ust_heat(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
double *& beta_pt()
Pointer to Beta parameter (thermal conductivity)
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed....
double * Beta_pt
Pointer to Beta parameter (thermal conductivity)
static double Default_alpha_parameter
Static default value for the Alpha parameter: (thermal inertia): One for natural scaling.
double du_dt_ust_heat(const unsigned &n) const
du/dt at local node n. Uses suitably interpolated value for hanging nodes.
virtual unsigned u_index_ust_heat() const
Broken assignment operator.
double * Alpha_pt
Pointer to Alpha parameter (thermal inertia)
//////////////////////////////////////////////////////////////////// ////////////////////////////////...