28#ifndef OOMPH_SCALAR_ADVECTION_ELEMENTS_HEADER
29#define OOMPH_SCALAR_ADVECTION_ELEMENTS_HEADER
33#include <oomph-lib-config.h>
46 template<
unsigned DIM>
78 for (
unsigned i = 0;
i <
DIM;
i++)
86 (*Wind_fct_pt)(x, wind);
162 for (
unsigned i = 0;
i <
DIM;
i++)
179 for (
unsigned i = 0;
i <
DIM;
i++)
192 norm[
i] += interpolated_u[
i] * interpolated_u[
i] * W;
199 template<
unsigned DIM,
unsigned NNODE_1D>
249 void output(FILE* file_pt)
251 ScalarAdvectionEquations<NFLUX,DIM>::output(file_pt);
256 void output(FILE* file_pt, const unsigned &n_plot)
258 ScalarAdvectionEquations<NFLUX,DIM>::output(file_pt,n_plot);
263 void output_fct(std::ostream &outfile, const unsigned &n_plot,
264 FiniteElement::SteadyExactSolutionFctPt
267 ScalarAdvectionEquations<NFLUX,DIM>::
268 output_fct(outfile,n_plot,exact_soln_pt);}
274 void output_fct(std::ostream &outfile, const unsigned &n_plot,
276 FiniteElement::UnsteadyExactSolutionFctPt
279 ScalarAdvectionEquations<NFLUX,DIM>::
280 output_fct(outfile,n_plot,time,exact_soln_pt);
313 template<
unsigned DIM,
unsigned NNODE_1D>
339 template<
unsigned DIM,
unsigned NNODE_1D>
370 template<
unsigned DIM,
unsigned NNODE_1D>
384 template<
class ELEMENT>
420 ->get_wind_scalar_adv(
ipt,
s, x,
Wind);
424 for (
unsigned i = 0;
i <
dim;
i++)
452 template<
unsigned DIM,
unsigned NNODE_1D>
461 template<
unsigned NNODE_1D>
494 Face_element_pt.resize(2);
516 this->add_flux_contributions_to_residuals(
residuals, jacobian,
flag);
529 if (nexternal_data() > 0)
533 <<
"Cannot use a discontinuous formulation for the mass matrix when\n"
534 <<
"there are external data.\n "
535 <<
"Do not call Problem::enable_discontinuous_formulation()\n";
543 const unsigned n_dof = this->ndof();
547 for (
unsigned n = 0;
n <
n_dof;
n++)
553 if (Mass_matrix_reuse_is_enabled && Mass_matrix_has_been_computed)
556 this->fill_in_contribution_to_residuals(
minv_res);
565 this->fill_in_contribution_to_mass_matrix(
minv_res, M);
568 Inverse_mass_diagonal.clear();
569 for (
unsigned n = 0;
n <
n_dof;
n++)
571 Inverse_mass_diagonal.push_back(1.0 / M(
n,
n));
575 Mass_matrix_has_been_computed =
true;
578 for (
unsigned n = 0;
n <
n_dof;
n++)
589 template<
unsigned NNODE_1D>
601 template<
unsigned NNODE_1D>
631 Face_element_pt.resize(4);
655 this->add_flux_contributions_to_residuals(
residuals, jacobian,
flag);
663 template<
unsigned NNODE_1D>
675 template<
unsigned DIM,
unsigned NNODE_1D>
719 void output(FILE* file_pt)
721 ScalarAdvectionEquations<NFLUX,DIM>::output(file_pt);
726 void output(FILE* file_pt, const unsigned &n_plot)
728 ScalarAdvectionEquations<NFLUX,DIM>::output(file_pt,n_plot);
733 void output_fct(std::ostream &outfile, const unsigned &n_plot,
734 FiniteElement::SteadyExactSolutionFctPt
737 ScalarAdvectionEquations<NFLUX,DIM>::
738 output_fct(outfile,n_plot,exact_soln_pt);}
744 void output_fct(std::ostream &outfile, const unsigned &n_plot,
746 FiniteElement::UnsteadyExactSolutionFctPt
749 ScalarAdvectionEquations<NFLUX,DIM>::
750 output_fct(outfile,n_plot,time,exact_soln_pt);
783 template<
unsigned DIM,
unsigned NNODE_1D>
809 template<
unsigned DIM,
unsigned NNODE_1D>
840 template<
unsigned DIM,
unsigned NNODE_1D>
842 :
public virtual QElement<DIM - 1, NNODE_1D>
854 template<
unsigned DIM,
unsigned NNODE_1D>
863 template<
unsigned NNODE_1D>
894 Face_element_pt.resize(2);
918 this->add_flux_contributions_to_residuals(
residuals, jacobian,
flag);
926 template<
unsigned NNODE_1D>
938 template<
unsigned NNODE_1D>
968 Face_element_pt.resize(4);
996 this->add_flux_contributions_to_residuals(
residuals, jacobian,
flag);
1004 template<
unsigned NNODE_1D>
1006 :
public virtual QElement<1, NNODE_1D>
A Base class for DGElements.
Base class for Discontinuous Galerkin Faces. These are responsible for calculating the normal fluxes ...
~DGScalarAdvectionElement()
DGScalarAdvectionElement()
unsigned required_nflux()
Set the number of flux components.
void calculate_element_averages(double *&average_value)
Calculate the averages in the element.
void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
unsigned required_nflux()
Set the number of flux components.
~DGScalarAdvectionElement()
void calculate_element_averages(double *&average_value)
Calculate the averages in the element.
DGScalarAdvectionElement()
General DGScalarAdvectionClass. Establish the template parameters.
FaceElement for Discontinuous Galerkin Problems.
DGScalarAdvectionFaceElement(FiniteElement *const &element_pt, const int &face_index)
Constructor.
unsigned required_nflux()
Set the number of flux components.
void numerical_flux(const Vector< double > &n_out, const Vector< double > &u_int, const Vector< double > &u_ext, Vector< double > &flux)
Calculate the normal flux, so this is the dot product of the numerical flux with n_in.
unsigned required_nflux()
Set the number of flux components.
DGSpectralScalarAdvectionElement()
Vector< double > Inverse_mass_diagonal
void calculate_element_averages(double *&average_value)
Calculate the averages in the element.
~DGSpectralScalarAdvectionElement()
void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
void get_inverse_mass_matrix_times_residuals(Vector< double > &minv_res)
Function that returns the current value of the residuals multiplied by the inverse mass matrix (virtu...
unsigned required_nflux()
Set the number of flux components.
DGSpectralScalarAdvectionElement()
void calculate_element_averages(double *&average_value)
Calculate the averages in the element.
void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
~DGSpectralScalarAdvectionElement()
General DGScalarAdvectionClass. Establish the template parameters.
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement.
FaceGeometry class definition: This policy class is used to allow construction of face elements that ...
A general Finite Element class.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
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 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 double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
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.
double nodal_position(const unsigned &n, const unsigned &i) const
Return the i-th coordinate at local node n. If the node is hanging, the appropriate interpolation is ...
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 build_face_element(const int &face_index, FaceElement *face_element_pt)
Function for building a lower dimensional FaceElement on the specified face of the FiniteElement....
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
Base class for the flux transport equations templated by the dimension DIM. The equations that are so...
virtual void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
void calculate_element_averages(double *&average_values)
Compute the average values of the fluxes.
void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
An OomphLibError object which should be thrown when an run-time error is encountered....
Point element has just a single node and a single shape function which is identically equal to one.
Non-spectral version of the classes.
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.
QScalarAdvectionElement(const QScalarAdvectionElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
double dshape_and_dtest_eulerian_flux_transport(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.
double dshape_and_dtest_eulerian_at_knot_flux_transport(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....
QScalarAdvectionElement()
Constructor: Call constructors for QElement and Advection Diffusion equations.
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
General QLegendreElement class.
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.
QSpectralScalarAdvectionElement()
Constructor: Call constructors for QElement and Advection Diffusion equations.
double dshape_and_dtest_eulerian_flux_transport(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.
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
QSpectralScalarAdvectionElement(const QSpectralScalarAdvectionElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
double dshape_and_dtest_eulerian_at_knot_flux_transport(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....
Base class for advection equations.
ScalarAdvectionWindFctPt Wind_fct_pt
Function pointer to the wind function.
unsigned required_nvalue(const unsigned &n) const
The number of unknowns at each node is the number of values.
ScalarAdvectionWindFctPt wind_fct_pt() const
Access function: Pointer to wind function. Const version.
ScalarAdvectionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
unsigned nflux() const
A single flux is interpolated.
virtual void get_wind_scalar_adv(const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &wind) const
Return the wind at a given position.
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt initial_condition_pt, const double &t, Vector< double > &error, Vector< double > &norm)
Compute the error and norm of solution integrated over the element Does not plot the error in the out...
ScalarAdvectionEquations()
Constructor.
void dflux_du(const Vector< double > &u, RankThreeTensor< double > &df_du)
Return the flux derivatives as a function of the unknowns.
void flux(const Vector< double > &u, DenseMatrix< double > &f)
Return the flux as a function of the unknown.
void(* ScalarAdvectionWindFctPt)(const Vector< double > &x, Vector< double > &wind)
Typedef for a wind function as a possible function of position.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
TAdvectionDiffusionReactionElement()
Constructor: Call constructors for TElement and AdvectionDiffusionReaction equations.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).