28 #ifndef OOMPH_SPHERICAL_ADV_DIFF_ELEMENTS_HEADER
29 #define OOMPH_SPHERICAL_ADV_DIFF_ELEMENTS_HEADER
34 #include <oomph-lib-config.h>
38 #include "../generic/nodes.h"
39 #include "../generic/Qelements.h"
40 #include "../generic/refineable_elements.h"
41 #include "../generic/oomph_utilities.h"
115 for (
unsigned t = 0;
t < n_time;
t++)
138 void output(std::ostream& outfile,
const unsigned& nplot);
150 void output(FILE* file_pt,
const unsigned& n_plot);
155 const unsigned& nplot,
194 inline const double&
pe()
const
223 double& source)
const
233 (*Source_fct_pt)(x, source);
250 for (
unsigned i = 0;
i < 3;
i++)
258 (*Wind_fct_pt)(x, wind);
267 const unsigned n_node =
nnode();
280 for (
unsigned j = 0; j < 2; j++)
286 for (
unsigned l = 0; l < n_node; l++)
288 const double u_value = this->
nodal_value(l, u_nodal_index);
291 flux[0] += u_value * dpsidx(l, 0);
292 flux[1] += u_value * dpsidx(l, 1) / r;
329 residuals, jacobian, mass_matrix, 2);
338 const unsigned n_node =
nnode();
350 double interpolated_u = 0.0;
353 for (
unsigned l = 0; l < n_node; l++)
355 interpolated_u +=
nodal_value(l, u_nodal_index) * psi[l];
358 return (interpolated_u);
373 const unsigned n_node =
nnode();
385 unsigned n_u_dof = 0;
386 for (
unsigned l = 0; l < n_node; l++)
397 du_ddata.resize(n_u_dof, 0.0);
398 global_eqn_number.resize(n_u_dof, 0);
402 for (
unsigned l = 0; l < n_node; l++)
410 global_eqn_number[count] = global_eqn;
412 du_ddata[count] = psi[l];
431 DShape& dtestdx)
const = 0;
440 DShape& dtestdx)
const = 0;
482 template<
unsigned NNODE_1D>
484 :
public virtual QElement<2, NNODE_1D>,
524 void output(std::ostream& outfile,
const unsigned& n_plot)
539 void output(FILE* file_pt,
const unsigned& n_plot)
547 const unsigned& n_plot,
551 outfile, n_plot, exact_soln_pt);
585 template<
unsigned NNODE_1D>
594 double J = this->dshape_eulerian(
s, psi, dpsidx);
598 for (
unsigned i = 0;
i < NNODE_1D;
i++)
601 for (
unsigned j = 0; j < 2; j++)
603 dtestdx(
i, j) = dpsidx(
i, j);
619 template<
unsigned NNODE_1D>
628 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
642 template<
unsigned NNODE_1D>
644 :
public virtual QElement<1, NNODE_1D>
665 template<
class ELEMENT>
692 "SphericalAdvectionDiffusionFluxElement",
693 OOMPH_CURRENT_FUNCTION,
694 OOMPH_EXCEPTION_LOCATION);
734 residuals, jacobian, 1);
744 const unsigned&
i)
const
758 void output(std::ostream& outfile,
const unsigned& nplot)
773 unsigned n_node =
nnode();
779 for (
unsigned i = 0;
i < n_node;
i++)
797 unsigned n_node =
nnode();
803 for (
unsigned i = 0;
i < n_node;
i++)
824 (*Beta_fct_pt)(x, beta);
840 (*Alpha_fct_pt)(x, alpha);
873 template<
class ELEMENT>
876 const int& face_index)
888 ELEMENT* elem_pt =
dynamic_cast<ELEMENT*
>(bulk_el_pt);
891 if (elem_pt->dim() == 3)
900 throw OomphLibError(
"This flux element will not work correctly if "
901 "nodes are hanging\n",
902 OOMPH_CURRENT_FUNCTION,
903 OOMPH_EXCEPTION_LOCATION);
929 "Bulk element must inherit from SphericalAdvectionDiffusionEquations.";
931 "Nodes are two dimensional, but cannot cast the bulk element to\n";
932 error_string +=
"SphericalAdvectionDiffusionEquations<2>\n.";
934 "If you desire this functionality, you must implement it yourself\n";
937 error_string, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
952 template<
class ELEMENT>
958 const unsigned n_node = nnode();
961 const unsigned u_index_spherical_adv_diff = U_index_adv_diff;
964 Shape psif(n_node), testf(n_node);
967 const unsigned n_intpt = integral_pt()->nweight();
974 int local_eqn = 0, local_unknown = 0;
978 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
981 for (
unsigned i = 0;
i < 1;
i++)
983 s[
i] = integral_pt()->knot(ipt,
i);
987 double w = integral_pt()->weight(ipt);
991 double J = shape_and_test(
s, psif, testf);
998 double interpolated_u = 0.0;
1002 for (
unsigned l = 0; l < n_node; l++)
1005 double u_value = raw_nodal_value(l, u_index_spherical_adv_diff);
1006 interpolated_u += u_value * psif(l);
1008 for (
unsigned i = 0;
i < 2;
i++)
1010 interpolated_x[
i] += nodal_position(l,
i) * psif(l);
1016 get_beta(interpolated_x, beta);
1020 get_alpha(interpolated_x, alpha);
1025 interpolated_x[0] * interpolated_x[0] * sin(interpolated_x[1]);
1030 for (
unsigned l = 0; l < n_node; l++)
1033 local_eqn = nodal_local_eqn(l, u_index_spherical_adv_diff);
1038 residuals[local_eqn] -=
1039 dS * (beta - alpha * interpolated_u) * testf(l) *
W;
1043 if ((flag) && (alpha != 0.0))
1046 for (
unsigned l2 = 0; l2 < n_node; l2++)
1049 local_unknown = nodal_local_eqn(l2, u_index_spherical_adv_diff);
1052 if (local_unknown >= 0)
1054 jacobian(local_eqn, local_unknown) +=
1055 dS * alpha * psif[l2] * testf[l] *
W;
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.
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
In a FaceElement, the "global" intrinsic coordinate of the element along the boundary,...
double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s....
double J_eulerian_at_knot(const unsigned &ipt) const
Return the Jacobian of the mapping from local to global coordinates at the ipt-th integration point O...
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 void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing.
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...
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 .
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....
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Return the geometric shape function at the ipt-th integration point.
bool has_hanging_nodes() const
Return boolean to indicate if any of the element's nodes are geometrically hanging.
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(FILE *file_pt)
C-style output function: r,z,u.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: r,z,u at n_plot^2 plot points.
QSphericalAdvectionDiffusionElement(const QSphericalAdvectionDiffusionElement< NNODE_1D > &dummy)=delete
Broken copy constructor.
void operator=(const QSphericalAdvectionDiffusionElement< NNODE_1D > &)=delete
Broken assignment operator.
double dshape_and_dtest_eulerian_spherical_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.
QSphericalAdvectionDiffusionElement()
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: r,z,u at n_plot^2 plot points.
double dshape_and_dtest_eulerian_at_knot_spherical_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....
unsigned required_nvalue(const unsigned &n) const
Required # of ‘values’ (pinned or dofs) at node n.
void output(std::ostream &outfile)
Output function: r,z,u.
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for an exact solution: r,z,u_exact at n_plot^2 plot points.
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
A class for all elements that solve the Advection Diffusion equations in a spherical polar coordinate...
unsigned self_test()
Self-test: Return 0 for OK.
void disable_ALE()
Disable ALE – empty overload to suppress warning. ALE isn't implemented anyway.
virtual void get_source_spherical_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...
SphericalAdvectionDiffusionWindFctPt wind_fct_pt() const
Access function: Pointer to wind function. Const version.
double interpolated_u_spherical_adv_diff(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
virtual double dshape_and_dtest_eulerian_at_knot_spherical_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 output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: r,z,u_exact at nplot^2 plot points.
const double & pe() const
Peclet number.
double * PeSt_pt
Pointer to global Peclet number multiplied by Strouhal number.
void output(std::ostream &outfile)
Output with default number of plot points.
double du_dt_spherical_adv_diff(const unsigned &n) const
du/dt at local node n. Uses suitably interpolated value for hanging nodes.
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux:
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
SphericalAdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
void output(FILE *file_pt)
C_style output with default number of plot points.
SphericalAdvectionDiffusionWindFctPt Wind_fct_pt
Pointer to wind function:
SphericalAdvectionDiffusionEquations(const SphericalAdvectionDiffusionEquations &dummy)=delete
Broken copy constructor.
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 residual vector and the element Jacobian matrix (wrapper) and m...
double *& pe_st_pt()
Pointer to Peclet number multipled by Strouha number.
const double & pe_st() const
Peclet number multiplied by Strouhal number.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
SphericalAdvectionDiffusionSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
virtual unsigned u_index_spherical_adv_diff() const
Return the index at which the unknown value is stored. The default value, 0, is appropriate for singl...
SphericalAdvectionDiffusionSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
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)
void(* SphericalAdvectionDiffusionSourceFctPt)(const Vector< double > &x, double &f)
Function pointer to source function fct(x,f(x)) – x is a Vector!
static double Default_peclet_number
Static default value for the Peclet number.
double * Pe_pt
Pointer to global Peclet number.
virtual void fill_in_generic_residual_contribution_spherical_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 Peclet number.
virtual double dshape_and_dtest_eulerian_spherical_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...
void(* SphericalAdvectionDiffusionWindFctPt)(const Vector< double > &x, Vector< double > &wind)
Function pointer to wind function fct(x,w(x)) – x is a Vector!
SphericalAdvectionDiffusionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
void operator=(const SphericalAdvectionDiffusionEquations &)=delete
Broken assignment operator.
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....
SphericalAdvectionDiffusionEquations()
Constructor: Initialise the Source_fct_pt and Wind_fct_pt to null and set (pointer to) Peclet number ...
virtual void get_wind_spherical_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...
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
unsigned U_index_adv_diff
The index at which the unknown is stored at the nodes.
SphericalAdvectionDiffusionPrescribedAlphaFctPt Alpha_fct_pt
Function pointer to the (global) prescribed-alpha function.
void get_alpha(const Vector< double > &x, double &alpha)
Function to calculate the prescribed alpha at a given spatial position.
void(* SphericalAdvectionDiffusionPrescribedBetaFctPt)(const Vector< double > &x, double &beta)
Function pointer to the prescribed-beta function fct(x,beta(x)) – x is a Vector!
double shape_and_test_at_knot(const unsigned &ipt, Shape &psi, Shape &test) const
Function to compute the shape and test functions and to return the Jacobian of mapping between local ...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Add the element's contribution to its residual vector and its Jacobian matrix.
SphericalAdvectionDiffusionPrescribedBetaFctPt & beta_fct_pt()
Access function for the prescribed-beta function pointer.
void get_beta(const Vector< double > &x, double &beta)
Function to calculate the prescribed beta at a given spatial position.
void fill_in_generic_residual_contribution_spherical_adv_diff_flux(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Add the element's contribution to its residual vector. flag=1(or 0): do (or don't) compute the Jacobi...
void output(std::ostream &outfile, const unsigned &nplot)
Output function – forward to broken version in FiniteElement until somebody decides what exactly they...
void output(std::ostream &outfile)
Output function – forward to broken version in FiniteElement until somebody decides what exactly they...
void(* SphericalAdvectionDiffusionPrescribedAlphaFctPt)(const Vector< double > &x, double &alpha)
Function pointer to the prescribed-alpha function fct(x,alpha(x)) – x is a Vector!
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Specify the value of nodal zeta from the face geometry The "global" intrinsic coordinate of the eleme...
SphericalAdvectionDiffusionPrescribedAlphaFctPt & alpha_fct_pt()
Access function for the prescribed-alpha function pointer.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
void operator=(const SphericalAdvectionDiffusionFluxElement &)=delete
Broken assignment operator.
double shape_and_test(const Vector< double > &s, Shape &psi, Shape &test) const
Function to compute the shape and test functions and to return the Jacobian of mapping between local ...
SphericalAdvectionDiffusionFluxElement(const SphericalAdvectionDiffusionFluxElement &dummy)=delete
Broken copy constructor.
SphericalAdvectionDiffusionPrescribedBetaFctPt Beta_fct_pt
Function pointer to the (global) prescribed-beta function.
SphericalAdvectionDiffusionFluxElement()
Broken empty constructor.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
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.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...