31 #ifndef OOMPH_ADV_DIFF_ELEMENTS_HEADER 32 #define OOMPH_ADV_DIFF_ELEMENTS_HEADER 37 #include <oomph-lib-config.h> 41 #include "../generic/nodes.h" 42 #include "../generic/Qelements.h" 43 #include "../generic/oomph_utilities.h" 58 template <
unsigned DIM>
124 const unsigned n_time = time_stepper_pt->
ntstorage();
126 for(
unsigned t=0;
t<n_time;
t++)
162 const unsigned& nplot)
const 169 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
188 file_out << wind[
i] << std::endl;
198 std::stringstream error_stream;
200 <<
"Advection Diffusion Elements only store " << DIM+1 <<
" fields " 204 OOMPH_CURRENT_FUNCTION,
205 OOMPH_EXCEPTION_LOCATION);
223 return "Advection Diffusion";
228 std::stringstream error_stream;
230 <<
"Advection Diffusion Elements only store " << DIM+1 <<
" fields" 234 OOMPH_CURRENT_FUNCTION,
235 OOMPH_EXCEPTION_LOCATION);
250 void output(std::ostream &outfile,
const unsigned &nplot);
262 void output(FILE* file_pt,
const unsigned &n_plot);
266 void output_fct(std::ostream &outfile,
const unsigned &nplot,
273 virtual void output_fct(std::ostream &outfile,
const unsigned &nplot,
278 "There is no time-dependent output_fct() for Advection Diffusion elements",
279 OOMPH_CURRENT_FUNCTION,
280 OOMPH_EXCEPTION_LOCATION);
287 exact_soln_pt,
double& error,
double& norm);
294 const double& time,
double& error,
double& norm)
297 "No time-dependent compute_error() for Advection Diffusion elements",
298 OOMPH_CURRENT_FUNCTION,
299 OOMPH_EXCEPTION_LOCATION);
336 double& source)
const 343 (*Source_fct_pt)(x,source);
360 for(
unsigned i=0;
i<DIM;
i++) {wind[
i]= 0.0;}
365 (*Wind_fct_pt)(x,wind);
373 unsigned n_node =
nnode();
380 DShape dpsidx(n_node,DIM);
386 for(
unsigned j=0;j<DIM;j++) {flux[j] = 0.0;}
389 for(
unsigned l=0;l<n_node;l++)
392 for(
unsigned j=0;j<DIM;j++)
394 flux[j] +=
nodal_value(l,u_nodal_index)*dpsidx(l,j);
430 jacobian,mass_matrix,2);
438 unsigned n_node =
nnode();
450 double interpolated_u = 0.0;
453 for(
unsigned l=0;l<n_node;l++)
455 interpolated_u +=
nodal_value(l,u_nodal_index)*psi[l];
458 return(interpolated_u);
472 const unsigned n_node =
nnode();
485 for(
unsigned l=0;l<n_node;l++)
489 if (global_eqn >=0) {++n_u_dof;}
493 du_ddata.resize(n_u_dof,0.0);
494 global_eqn_number.resize(n_u_dof,0);
498 for(
unsigned l=0;l<n_node;l++)
506 global_eqn_number[count] = global_eqn;
508 du_ddata[count] = psi[l];
583 template <
unsigned DIM,
unsigned NNODE_1D>
619 {
return Initial_Nvalue;}
628 void output(std::ostream &outfile,
const unsigned &n_plot)
641 void output(FILE* file_pt,
const unsigned &n_plot)
648 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
657 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
663 output_fct(outfile,n_plot,time,exact_soln_pt);
696 template<
unsigned DIM,
unsigned NNODE_1D>
709 for(
unsigned i=0;
i<NNODE_1D;
i++)
712 for(
unsigned j=0;j<DIM;j++)
714 dtestdx(
i,j) = dpsidx(
i,j);
730 template<
unsigned DIM,
unsigned NNODE_1D>
763 template<
unsigned DIM,
unsigned NNODE_1D>
765 public virtual QElement<DIM-1,NNODE_1D>
786 template<
unsigned NNODE_1D>
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...
std::string scalar_name_paraview(const unsigned &i) const
Name of the i-th scalar field. Default implementation returns V1 for the first one, V2 for the second etc. Can (should!) be overloaded with more meaningful names in specific elements.
unsigned nscalar_paraview() const
Number of scalars/fields output by this element. Reimplements.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
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 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-...
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
AdvectionDiffusionSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
AdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
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...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
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...
QAdvectionDiffusionElement elements are linear/quadrilateral/brick-shaped Advection Diffusion element...
A general Finite Element class.
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.
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
void disable_ALE()
Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!
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...
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...
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
double * Pe_pt
Pointer to global Peclet number.
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.
void output(FILE *file_pt)
C-style output function: x,y,u or x,y,z,u.
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...
A class for all elements that solve the Advection Diffusion equations using isoparametric elements...
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. In addition, return the global equation numbers corresponding to the data. This is virtual so that it can be overloaded in the refineable version.
const double & pe_st() const
Peclet number multiplied by Strouhal number.
AdvectionDiffusionWindFctPt Wind_fct_pt
Pointer to wind function:
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
double *& pe_pt()
Pointer to Peclet number.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
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.
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.
QAdvectionDiffusionElement(const QAdvectionDiffusionElement< DIM, NNODE_1D > &dummy)
Broken copy constructor.
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...
unsigned required_nvalue(const unsigned &n) const
Required # of `values' (pinned or dofs) at node n.
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...
static double Default_peclet_number
Static default value for the 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...
AdvectionDiffusionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
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() const
Access function: Pointer to wind function. Const version.
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
AdvectionDiffusionEquations(const AdvectionDiffusionEquations &dummy)
Broken copy constructor.
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...
double du_dt_adv_diff(const unsigned &n) const
du/dt at local node n.
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.
void operator=(const AdvectionDiffusionEquations &)
Broken assignment operator.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
void output(std::ostream &outfile)
Output with default number of plot points.
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...
void output(FILE *file_pt)
C_style output with default number of plot points.
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
unsigned self_test()
Self-test: Return 0 for OK.
void(* AdvectionDiffusionSourceFctPt)(const Vector< double > &x, double &f)
Function pointer to source function fct(x,f(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 ...
void(* AdvectionDiffusionWindFctPt)(const Vector< double > &x, Vector< double > &wind)
Function pointer to wind function fct(x,w(x)) – x is a Vector!
AdvectionDiffusionEquations()
Constructor: Initialise the Source_fct_pt and Wind_fct_pt to null and set (pointer to) Peclet number ...
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Dummy, time dependent error checker.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
AdvectionDiffusionSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
double *& pe_st_pt()
Pointer to Peclet number multipled by Strouha number.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: .
QAdvectionDiffusionElement()
Constructor: Call constructors for QElement and Advection Diffusion equations.
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.
bool is_steady() const
Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-depen...
double interpolated_u_adv_diff(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
double * PeSt_pt
Pointer to global Peclet number multiplied by Strouhal number.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
const double & pe() const
Peclet number.
unsigned nnode() const
Return the number of nodes.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
void operator=(const QAdvectionDiffusionElement< DIM, NNODE_1D > &)
Broken assignment operator.
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...
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
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)...
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. Return Jacobian.