27 #ifndef OOMPH_ADV_DIFF_ELEMENTS_HEADER
28 #define OOMPH_ADV_DIFF_ELEMENTS_HEADER
33 #include <oomph-lib-config.h>
37 #include "../generic/nodes.h"
38 #include "../generic/Qelements.h"
39 #include "../generic/oomph_utilities.h"
50 template<
unsigned DIM>
114 for (
unsigned t = 0;
t < n_time;
t++)
151 const unsigned& nplot)
const
158 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
176 file_out << wind[
i] << std::endl;
186 std::stringstream error_stream;
187 error_stream <<
"Advection Diffusion Elements only store " << DIM + 1
188 <<
" fields " << std::endl;
190 OOMPH_CURRENT_FUNCTION,
191 OOMPH_EXCEPTION_LOCATION);
209 return "Advection Diffusion";
214 std::stringstream error_stream;
215 error_stream <<
"Advection Diffusion Elements only store " << DIM + 1
216 <<
" fields" << std::endl;
218 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
233 void output(std::ostream& outfile,
const unsigned& nplot);
245 void output(FILE* file_pt,
const unsigned& n_plot);
250 const unsigned& nplot,
257 std::ostream& outfile,
258 const unsigned& nplot,
262 throw OomphLibError(
"There is no time-dependent output_fct() for "
263 "Advection Diffusion elements",
264 OOMPH_CURRENT_FUNCTION,
265 OOMPH_EXCEPTION_LOCATION);
284 "No time-dependent compute_error() for Advection Diffusion elements",
285 OOMPH_CURRENT_FUNCTION,
286 OOMPH_EXCEPTION_LOCATION);
318 const double&
pe()
const
347 double& source)
const
357 (*Source_fct_pt)(x, source);
374 for (
unsigned i = 0;
i < DIM;
i++)
382 (*Wind_fct_pt)(x, wind);
390 unsigned n_node =
nnode();
397 DShape dpsidx(n_node, DIM);
403 for (
unsigned j = 0; j < DIM; j++)
409 for (
unsigned l = 0; l < n_node; l++)
412 for (
unsigned j = 0; j < DIM; j++)
414 flux[j] +=
nodal_value(l, u_nodal_index) * dpsidx(l, j);
453 residuals, jacobian, mass_matrix, 2);
461 unsigned n_node =
nnode();
473 double interpolated_u = 0.0;
476 for (
unsigned l = 0; l < n_node; l++)
478 interpolated_u +=
nodal_value(l, u_nodal_index) * psi[l];
481 return (interpolated_u);
496 const unsigned n_node =
nnode();
508 unsigned n_u_dof = 0;
509 for (
unsigned l = 0; l < n_node; l++)
520 du_ddata.resize(n_u_dof, 0.0);
521 global_eqn_number.resize(n_u_dof, 0);
525 for (
unsigned l = 0; l < n_node; l++)
533 global_eqn_number[count] = global_eqn;
535 du_ddata[count] = psi[l];
554 DShape& dtestdx)
const = 0;
563 DShape& dtestdx)
const = 0;
606 template<
unsigned DIM,
unsigned NNODE_1D>
608 :
public virtual QElement<DIM, NNODE_1D>,
647 void output(std::ostream& outfile,
const unsigned& n_plot)
662 void output(FILE* file_pt,
const unsigned& n_plot)
670 const unsigned& n_plot,
674 outfile, n_plot, exact_soln_pt);
682 const unsigned& n_plot,
687 outfile, n_plot, time, exact_soln_pt);
719 template<
unsigned DIM,
unsigned NNODE_1D>
728 double J = this->dshape_eulerian(
s, psi, dpsidx);
732 for (
unsigned i = 0;
i < NNODE_1D;
i++)
735 for (
unsigned j = 0; j < DIM; j++)
737 dtestdx(
i, j) = dpsidx(
i, j);
752 template<
unsigned DIM,
unsigned NNODE_1D>
761 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
783 template<
unsigned DIM,
unsigned NNODE_1D>
785 :
public virtual QElement<DIM - 1, NNODE_1D>
802 template<
unsigned NNODE_1D>
A class for all elements that solve the Advection Diffusion equations using isoparametric elements.
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed....
void output(FILE *file_pt)
C_style output with default number of plot points.
AdvectionDiffusionEquations()
Constructor: Initialise the Source_fct_pt and Wind_fct_pt to null and set (pointer to) Peclet number ...
double interpolated_u_adv_diff(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
double du_dt_adv_diff(const unsigned &n) const
du/dt at local node n. Uses suitably interpolated value for hanging nodes.
void output(std::ostream &outfile)
Output with default number of plot points.
virtual void get_wind_adv_diff(const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &wind) const
Get wind at (Eulerian) position x and/or local coordinate s. This function is virtual to allow overlo...
void(* AdvectionDiffusionWindFctPt)(const Vector< double > &x, Vector< double > &wind)
Function pointer to wind function fct(x,w(x)) – x is a Vector!
virtual double dshape_and_dtest_eulerian_at_knot_adv_diff(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 ...
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 void fill_in_generic_residual_contribution_adv_diff(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add the element's contribution to its residual vector only (if flag=and/or element Jacobian matrix.
double * Pe_pt
Pointer to global Peclet number.
virtual void get_source_adv_diff(const unsigned &ipt, const Vector< double > &x, double &source) const
Get source term at (Eulerian) position x. This function is virtual to allow overloading in multi-phys...
double *& pe_pt()
Pointer to Peclet number.
AdvectionDiffusionEquations(const AdvectionDiffusionEquations &dummy)=delete
Broken copy constructor.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Add the element's contribution to its residual vector and the element Jacobian matrix (wrapper)
AdvectionDiffusionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
unsigned nscalar_paraview() const
Number of scalars/fields output by this element. Reimplements broken virtual function in base class.
AdvectionDiffusionSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
static double Default_peclet_number
Static default value for the Peclet number.
virtual void dinterpolated_u_adv_diff_ddata(const Vector< double > &s, Vector< double > &du_ddata, Vector< unsigned > &global_eqn_number)
Return derivative of u at point s with respect to all data that can affect its value....
AdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
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...
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Dummy, time dependent error checker.
void operator=(const AdvectionDiffusionEquations &)=delete
Broken assignment operator.
void enable_ALE()
(Re-)enable ALE, i.e. take possible mesh motion into account when evaluating the time-derivative....
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: .
AdvectionDiffusionWindFctPt Wind_fct_pt
Pointer to wind function:
void disable_ALE()
Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!
void(* AdvectionDiffusionSourceFctPt)(const Vector< double > &x, double &f)
Function pointer to source function fct(x,f(x)) – x is a Vector!
double * PeSt_pt
Pointer to global Peclet number multiplied by Strouhal number.
virtual unsigned u_index_adv_diff() const
Return the index at which the unknown value is stored. The default value, 0, is appropriate for singl...
AdvectionDiffusionWindFctPt wind_fct_pt() const
Access function: Pointer to wind function. Const version.
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 double dshape_and_dtest_eulerian_adv_diff(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...
unsigned self_test()
Self-test: Return 0 for OK.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
const double & pe_st() const
Peclet number multiplied by Strouhal number.
const double & pe() const
Peclet number.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
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.
double *& pe_st_pt()
Pointer to Peclet number multipled by Strouha number.
AdvectionDiffusionSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
virtual void output_fct(std::ostream &outfile, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,u_exact or x,y,z,u_exact at nplot^DIM plot points (dummy time-dependent versio...
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
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.
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...
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.
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...
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...
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.
An OomphLibError object which should be thrown when an run-time error is encountered....
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
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 ...
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.
QAdvectionDiffusionElement()
Constructor: Call constructors for QElement and Advection Diffusion 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.
unsigned required_nvalue(const unsigned &n) const
Required # of ‘values’ (pinned or dofs) at node n.
void output(FILE *file_pt)
C-style output function: x,y,u or x,y,z,u.
QAdvectionDiffusionElement(const QAdvectionDiffusionElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
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.
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
double dshape_and_dtest_eulerian_adv_diff(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.
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
void operator=(const QAdvectionDiffusionElement< DIM, NNODE_1D > &)=delete
Broken assignment operator.
double dshape_and_dtest_eulerian_at_knot_adv_diff(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. at integration point ipt....
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
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...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
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).
//////////////////////////////////////////////////////////////////// ////////////////////////////////...