31 #ifndef OOMPH_UNSTEADY_HEAT_ELEMENTS_HEADER 32 #define OOMPH_UNSTEADY_HEAT_ELEMENTS_HEADER 36 #include <oomph-lib-config.h> 41 #include "../generic/projection.h" 42 #include "../generic/nodes.h" 43 #include "../generic/Qelements.h" 44 #include "../generic/oomph_utilities.h" 77 template <
unsigned DIM>
97 Alpha_pt = &Default_alpha_parameter;
98 Beta_pt = &Default_beta_parameter;
141 const unsigned u_nodal_index = u_index_ust_heat();
144 const unsigned n_time = time_stepper_pt->
ntstorage();
147 for(
unsigned t=0;
t<n_time;
t++)
185 void output(std::ostream &outfile,
const unsigned &nplot);
197 void output(FILE* file_pt,
const unsigned &n_plot);
201 void output_fct(std::ostream &outfile,
const unsigned &nplot,
209 void output_fct(std::ostream &outfile,
const unsigned &nplot,
219 double& error,
double& norm);
226 const double& time,
double& error,
double& norm);
242 double& source)
const 249 (*Source_fct_pt)(
t,x,source);
254 const double &
alpha()
const {
return *Alpha_pt;}
261 const double &
beta()
const {
return *Beta_pt;}
270 unsigned n_node =
nnode();
273 unsigned u_nodal_index = u_index_ust_heat();
277 DShape dpsidx(n_node,DIM);
283 for(
unsigned j=0;j<DIM;j++) {flux[j] = 0.0;}
286 for(
unsigned l=0;l<n_node;l++)
289 for(
unsigned j=0;j<DIM;j++)
291 flux[j] +=
nodal_value(l,u_nodal_index)*dpsidx(l,j);
302 fill_in_generic_residual_contribution_ust_heat(
312 fill_in_generic_residual_contribution_ust_heat(residuals,jacobian,1);
320 unsigned n_node =
nnode();
323 unsigned u_nodal_index = u_index_ust_heat();
332 double interpolated_u = 0.0;
335 for(
unsigned l=0;l<n_node;l++)
337 interpolated_u +=
nodal_value(l,u_nodal_index)*psi[l];
340 return(interpolated_u);
350 unsigned n_node =
nnode();
353 unsigned u_nodal_index = u_index_ust_heat();
362 double interpolated_u = 0.0;
365 for(
unsigned l=0;l<n_node;l++)
367 interpolated_u +=
nodal_value(t,l,u_nodal_index)*psi[l];
370 return(interpolated_u);
378 unsigned n_node =
nnode();
387 double interpolated_dudt = 0.0;
390 for(
unsigned l=0;l<n_node;l++)
392 interpolated_dudt += du_dt_ust_heat(l)*psi[l];
395 return(interpolated_dudt);
407 virtual double dshape_and_dtest_eulerian_ust_heat(
const Vector<double> &
s,
416 virtual double dshape_and_dtest_eulerian_at_knot_ust_heat(
426 virtual void fill_in_generic_residual_contribution_ust_heat(
471 template <
unsigned DIM,
unsigned NNODE_1D>
504 {
return Initial_Nvalue;}
514 void output(std::ostream &outfile,
const unsigned &n_plot)
526 void output(FILE* file_pt,
const unsigned &n_plot)
532 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
542 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
552 inline double dshape_and_dtest_eulerian_ust_heat(
const Vector<double> &
s,
561 inline double dshape_and_dtest_eulerian_at_knot_ust_heat(
const unsigned &ipt,
580 template<
unsigned DIM,
unsigned NNODE_1D>
593 for(
unsigned i=0;
i<NNODE_1D;
i++)
596 for(
unsigned j=0;j<DIM;j++)
598 dtestdx(
i,j) = dpsidx(
i,j);
613 template<
unsigned DIM,
unsigned NNODE_1D>
646 template<
unsigned DIM,
unsigned NNODE_1D>
648 public virtual QElement<DIM-1,NNODE_1D>
667 template<
unsigned NNODE_1D>
690 template<
class UNSTEADY_HEAT_ELEMENT>
711 std::stringstream error_stream;
713 <<
"UnsteadyHeat elements only store a single field so fld must be 0 rather" 714 <<
" than " << fld << std::endl;
717 OOMPH_CURRENT_FUNCTION,
718 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;
752 <<
"UnsteadyHeat elements only store a single field so fld must be 0 rather" 753 <<
" than " << fld << std::endl;
756 OOMPH_CURRENT_FUNCTION,
757 OOMPH_EXCEPTION_LOCATION);
779 std::stringstream error_stream;
781 <<
"UnsteadyHeat elements only store a single field so fld must be 0 rather" 782 <<
" than " << fld << std::endl;
785 OOMPH_CURRENT_FUNCTION,
786 OOMPH_EXCEPTION_LOCATION);
789 unsigned n_dim=this->
dim();
790 unsigned n_node=this->
nnode();
792 DShape dpsidx(n_node,n_dim), dtestdx(n_node,n_dim);
793 double J=this->dshape_and_dtest_eulerian_ust_heat(s,psi,dpsidx,
809 std::stringstream error_stream;
811 <<
"UnsteadyHeat elements only store a single field so fld must be 0 rather" 812 <<
" than " << fld << std::endl;
815 OOMPH_CURRENT_FUNCTION,
816 OOMPH_EXCEPTION_LOCATION);
820 unsigned u_nodal_index = this->u_index_ust_heat();
823 unsigned n_node=this->
nnode();
830 double interpolated_u = 0.0;
833 for(
unsigned l=0;l<n_node;l++)
835 interpolated_u += this->
nodal_value(t,l,u_nodal_index)*psi[l];
837 return interpolated_u;
849 std::stringstream error_stream;
851 <<
"UnsteadyHeat elements only store a single field so fld must be 0 rather" 852 <<
" than " << fld << std::endl;
855 OOMPH_CURRENT_FUNCTION,
856 OOMPH_EXCEPTION_LOCATION);
859 return this->
nnode();
870 std::stringstream error_stream;
872 <<
"UnsteadyHeat elements only store a single field so fld must be 0 rather" 873 <<
" than " << fld << std::endl;
876 OOMPH_CURRENT_FUNCTION,
877 OOMPH_EXCEPTION_LOCATION);
880 const unsigned u_nodal_index = this->u_index_ust_heat();
889 void output(std::ostream &outfile,
const unsigned &nplot)
891 unsigned el_dim=this->
dim();
900 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
905 for(
unsigned i=0;
i<el_dim;
i++)
909 outfile << this->interpolated_u_ust_heat(s) <<
" ";
910 outfile << this->interpolated_du_dt_ust_heat(s) <<
" ";
915 for (
unsigned t=1;
t<n_prev;
t++)
917 for(
unsigned i=0;
i<el_dim;
i++)
925 for (
unsigned t=1;
t<n_prev;
t++)
927 outfile << this->interpolated_u_ust_heat(
t,s) <<
" ";
929 outfile << std::endl;
946 template<
class ELEMENT>
959 template<
class ELEMENT>
double interpolated_u_ust_heat(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction") ...
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
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)
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 broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute element residual Vector (wrapper)
GeneralisedAxisymAdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
unsigned nvalue_of_field(const unsigned &fld)
Return number of values in field fld: One per node.
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 unsigned u_index_ust_heat() const
Broken assignment operator.
double interpolated_du_dt_ust_heat(const Vector< double > &s) const
Return FE representation of function value du/dt(s) at local coordinate s.
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 double dshape_eulerian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidx) const
Return the geometric shape functions and also first derivatives w.r.t. global coordinates at the ipt-...
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing...
double *& alpha_pt()
Pointer to Alpha parameter (thermal inertia)
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...
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.
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 ...
virtual unsigned self_test()
Self-test: Check inversion of element & do self-test for GeneralisedElement. Return 0 if OK...
A general Finite Element class.
const double & beta() const
Beta parameter (thermal conductivity)
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
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 output(FILE *file_pt)
C-style output function: x,y,u or x,y,z,u.
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
int local_equation(const unsigned &fld, const unsigned &j)
Return local equation number of value j in field fld.
unsigned nfields_for_projection()
Number of fields to be projected: Just one.
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...
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
UnsteadyHeatSourceFctPt Source_fct_pt
Pointer to source function:
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction") ...
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 du_dt_ust_heat(const unsigned &n) const
du/dt at local node n. Uses suitably interpolated value for hanging nodes.
virtual void compute_norm(double &norm)
Compute norm of solution – broken virtual can be overloaded by element writer to implement whatever ...
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: flux[i] = du/dx_i.
UnsteadyHeatEquations()
Constructor: Initialises the Source_fct_pt to null and sets flag to use ALE formulation of the equati...
UnsteadyHeatSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
QUnsteadyHeatElement()
Constructor: Call constructors for QElement and UnsteadyHeat equations.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
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 ...
double * Beta_pt
Pointer to Beta parameter (thermal conductivity)
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
static double Default_beta_parameter
Static default value for the Beta parameter (thermal conductivity): One for natural scaling...
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...
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.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
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!
void output(std::ostream &outfile)
Output with default number of plot points.
double * Alpha_pt
Pointer to Alpha parameter (thermal inertia)
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"...
QUnsteadyHeatElement(const QUnsteadyHeatElement< DIM, NNODE_1D > &dummy)
Broken copy constructor.
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...
unsigned nhistory_values_for_projection(const unsigned &fld)
Number of history values to be stored for fld-th field. (Note: count includes current value!) ...
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
virtual void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output an exact solution over the element.
UnsteadyHeat upgraded to become projectable.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Compute element residual Vector and element Jacobian matrix (wrapper)
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
static double Default_alpha_parameter
Static default value for the Alpha parameter: (thermal inertia): One for natural scaling.
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)
unsigned ntstorage() const
Return total number of doubles stored per value to record time history of each value (one for steady ...
void disable_ALE()
Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!
UnsteadyHeatSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
virtual UnsteadyHeatSourceFctPt & source_fct_pt()=0
Access function: Pointer to source function.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
void output(FILE *file_pt)
C_style output with default number of plot points.
bool is_steady() const
Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-depen...
unsigned nhistory_values_for_coordinate_projection()
Number of positional history values (Note: count includes current value!)
void enable_ALE()
(Re-)enable ALE, i.e. take possible mesh motion into account when evaluating the time-derivative. Note: By default, ALE is enabled, at the expense of possibly creating unnecessary work in problems where the mesh is, in fact, stationary.
unsigned nnode() const
Return the number of nodes.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
virtual void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Plot the error when compared against a given exact solution . Also calculates the norm of the error a...
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
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 ...
ProjectableUnsteadyHeatElement()
Constructor [this was only required explicitly from gcc 4.5.2 onwards...].
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 & alpha() const
Alpha parameter (thermal inertia)
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.
UnsteadyHeatEquations(const UnsteadyHeatEquations &dummy)
Broken copy constructor.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
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...