32 #ifndef OOMPH_SPHERICAL_ADV_DIFF_ELEMENTS_HEADER 33 #define OOMPH_SPHERICAL_ADV_DIFF_ELEMENTS_HEADER 38 #include <oomph-lib-config.h> 42 #include "../generic/nodes.h" 43 #include "../generic/Qelements.h" 44 #include "../generic/refineable_elements.h" 45 #include "../generic/oomph_utilities.h" 129 const unsigned n_time = time_stepper_pt->
ntstorage();
131 for(
unsigned t=0;
t<n_time;
t++)
153 void output(std::ostream &outfile,
const unsigned &nplot);
165 void output(FILE* file_pt,
const unsigned &n_plot);
170 const unsigned &nplot,
177 exact_soln_pt,
double& error,
202 inline const double &
pe()
const {
return *
Pe_pt;}
219 double& source)
const 229 (*Source_fct_pt)(x,source);
246 for(
unsigned i=0;
i<3;
i++)
254 (*Wind_fct_pt)(x,wind);
266 const unsigned n_node =
nnode();
279 for(
unsigned j=0;j<2;j++) {flux[j] = 0.0;}
282 for(
unsigned l=0;l<n_node;l++)
284 const double u_value = this->
nodal_value(l,u_nodal_index);
287 flux[0] += u_value*dpsidx(l,0);
288 flux[1] += u_value*dpsidx(l,1)/r;
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];
485 template <
unsigned NNODE_1D>
522 return Initial_Nvalue;
534 void output(std::ostream &outfile,
const unsigned &n_plot)
549 void output(FILE* file_pt,
const unsigned &n_plot)
557 const unsigned &n_plot,
594 template<
unsigned NNODE_1D>
607 for(
unsigned i=0;
i<NNODE_1D;
i++)
610 for(
unsigned j=0;j<2;j++)
612 dtestdx(
i,j) = dpsidx(
i,j);
629 template<
unsigned NNODE_1D>
652 template<
unsigned NNODE_1D>
682 template <
class ELEMENT>
693 typedef void (*SphericalAdvectionDiffusionPrescribedBetaFctPt)(
699 typedef void (*SphericalAdvectionDiffusionPrescribedAlphaFctPt)(
707 const int &face_index);
714 "Don't call empty constructor for SphericalAdvectionDiffusionFluxElement",
715 OOMPH_CURRENT_FUNCTION,
716 OOMPH_EXCEPTION_LOCATION);
750 fill_in_generic_residual_contribution_spherical_adv_diff_flux(
762 fill_in_generic_residual_contribution_spherical_adv_diff_flux(residuals,
773 const unsigned &
i)
const 785 void output(std::ostream &outfile,
const unsigned &nplot)
801 unsigned n_node =
nnode();
807 for(
unsigned i=0;
i<n_node;
i++)
825 unsigned n_node =
nnode();
831 for(
unsigned i=0;
i<n_node;
i++)
852 (*Beta_fct_pt)(x,beta);
861 if(Alpha_fct_pt == 0)
868 (*Alpha_fct_pt)(x,alpha);
877 void fill_in_generic_residual_contribution_spherical_adv_diff_flux(
904 template<
class ELEMENT>
907 const int &face_index) :
919 ELEMENT* elem_pt =
dynamic_cast<ELEMENT*
>(bulk_el_pt);
922 if(elem_pt->dim()==3)
931 "This flux element will not work correctly if nodes are hanging\n",
932 OOMPH_CURRENT_FUNCTION,
933 OOMPH_EXCEPTION_LOCATION);
959 "Bulk element must inherit from SphericalAdvectionDiffusionEquations.";
961 "Nodes are two dimensional, but cannot cast the bulk element to\n";
962 error_string +=
"SphericalAdvectionDiffusionEquations<2>\n.";
964 "If you desire this functionality, you must implement it yourself\n";
968 OOMPH_CURRENT_FUNCTION,
969 OOMPH_EXCEPTION_LOCATION);
988 template<
class ELEMENT>
996 const unsigned n_node =
nnode();
1002 Shape psif(n_node), testf(n_node);
1012 int local_eqn=0, local_unknown=0;
1016 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
1020 for(
unsigned i=0;
i<1;
i++)
1037 double interpolated_u=0.0;
1041 for(
unsigned l=0;l<n_node;l++)
1045 interpolated_u += u_value*psif(l);
1047 for(
unsigned i=0;
i<2;
i++)
1063 double dS = interpolated_x[0]*interpolated_x[0]*sin(interpolated_x[1]);
1068 for(
unsigned l=0;l<n_node;l++)
1076 residuals[local_eqn] -= dS*(beta - alpha*interpolated_u)*testf(l)*
W;
1080 if ( (flag) && (alpha!=0.0) )
1083 for(
unsigned l2=0;l2<n_node;l2++)
1089 if(local_unknown >= 0)
1091 jacobian(local_eqn,local_unknown) +=
1092 dS*alpha*psif[l2]*testf[l]*
W;
QSphericalAdvectionDiffusionElement(const QSphericalAdvectionDiffusionElement< NNODE_1D > &dummy)
Broken copy constructor.
bool has_hanging_nodes() const
Return boolean to indicate if any of the element's nodes are geometrically hanging.
double raw_nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n but do NOT take hanging nodes into account.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
QSphericalAdvectionDiffusionElement()
Constructor: Call constructors for QElement and Advection Diffusion equations.
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.
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 get_alpha(const Vector< double > &x, double &alpha)
Function to calculate the prescribed alpha at a given spatial position.
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing...
void output(std::ostream &outfile)
Output with default number of plot points.
const double & pe() const
Peclet number.
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 ...
SphericalAdvectionDiffusionPrescribedAlphaFctPt Alpha_fct_pt
Function pointer to the (global) prescribed-alpha function.
SphericalAdvectionDiffusionSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
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.
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...
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: .
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 the element Jacobian matrix (wrapper) ...
double * PeSt_pt
Pointer to global Peclet number multiplied by Strouhal number.
void operator=(const SphericalAdvectionDiffusionEquations &)
Broken assignment operator.
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...
A general Finite Element class.
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, when viewed as part of a compound geometric object is specified using the boundary coordinate defined by the mesh. Note: Boundary coordinates will have been set up when creating the underlying mesh, and their values will have been stored at the nodes.
double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s. Overloaded to get information from bulk...
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...
void(* SphericalAdvectionDiffusionWindFctPt)(const Vector< double > &x, Vector< double > &wind)
Function pointer to wind function fct(x,w(x)) – x is a Vector!
virtual 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...
long & eqn_number(const unsigned &i)
Return the equation number of the i-th stored variable.
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 ...
static double Default_peclet_number
Static default value for the Peclet number.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
void output(std::ostream &outfile)
Output function – forward to broken version in FiniteElement until somebody decides what exactly the...
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. Return Jacobian.
SphericalAdvectionDiffusionWindFctPt wind_fct_pt() const
Access function: Pointer to wind function. Const version.
SphericalAdvectionDiffusionPrescribedBetaFctPt Beta_fct_pt
Function pointer to the (global) prescribed-beta function.
A class for all elements that solve the Advection Diffusion equations in a spherical polar coordinate...
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...
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
SphericalAdvectionDiffusionEquations()
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::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
unsigned required_nvalue(const unsigned &n) const
Required # of `values' (pinned or dofs) at node n.
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...
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
double du_dt_spherical_adv_diff(const unsigned &n) const
du/dt at local node n.
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Return the geometric shape function at the ipt-th integration point.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
void output(FILE *file_pt)
C_style output with default number of plot points.
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: r,z,u_exact at nplot^2 plot points.
unsigned self_test()
Self-test: Return 0 for OK.
SphericalAdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
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 ...
A class for elements that allow the imposition of an applied Robin boundary condition on the boundari...
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: r,z,u at n_plot^2 plot points.
unsigned U_index_adv_diff
The index at which the unknown is stored at the nodes.
void operator=(const SphericalAdvectionDiffusionFluxElement &)
Broken assignment operator.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
double *& pe_st_pt()
Pointer to Peclet number multipled by Strouha number.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
void output(std::ostream &outfile, const unsigned &nplot)
Output function – forward to broken version in FiniteElement until somebody decides what exactly the...
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...
QSphericalAdvectionDiffusionElement elements are linear/quadrilateral/brick-shaped Axisymmetric Advec...
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
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.
void output(std::ostream &outfile)
Output function: r,z,u.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
SphericalAdvectionDiffusionPrescribedBetaFctPt & beta_fct_pt()
Access function for the prescribed-beta function pointer.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
SphericalAdvectionDiffusionEquations(const SphericalAdvectionDiffusionEquations &dummy)
Broken copy constructor.
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 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...
SphericalAdvectionDiffusionWindFctPt Wind_fct_pt
Pointer to wind function:
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...
double interpolated_u_spherical_adv_diff(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
void get_beta(const Vector< double > &x, double &beta)
Function to calculate the prescribed beta at a given spatial position.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: r,z,u at n_plot^2 plot points.
void operator=(const QSphericalAdvectionDiffusionElement< NNODE_1D > &)
Broken assignment operator.
bool is_steady() const
Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-depen...
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.
const double & pe_st() const
Peclet number multiplied by Strouhal number.
SphericalAdvectionDiffusionFluxElement(const SphericalAdvectionDiffusionFluxElement &dummy)
Broken copy constructor.
unsigned nnode() const
Return the number of nodes.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
SphericalAdvectionDiffusionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s...
double *& pe_pt()
Pointer to Peclet number.
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...
SphericalAdvectionDiffusionPrescribedAlphaFctPt & alpha_fct_pt()
Access function for the prescribed-alpha function pointer.
void(* SphericalAdvectionDiffusionSourceFctPt)(const Vector< double > &x, double &f)
Function pointer to source function fct(x,f(x)) – x is a Vector!
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
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...
void disable_ALE()
Disable ALE – empty overload to suppress warning. ALE isn't implemented anyway.
SphericalAdvectionDiffusionSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
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 output(FILE *file_pt)
C-style output function: r,z,u.
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...
SphericalAdvectionDiffusionFluxElement()
Broken empty constructor.