31 #ifndef OOMPH_STEADY_AXISYM_ADV_DIFF_ELEMENTS_HEADER 32 #define OOMPH_STEADY_AXISYM_ADV_DIFF_ELEMENTS_HEADER 37 #include <oomph-lib-config.h> 41 #include "../generic/nodes.h" 42 #include "../generic/Qelements.h" 43 #include "../generic/refineable_elements.h" 44 #include "../generic/oomph_utilities.h" 121 void output(std::ostream &outfile,
const unsigned &nplot);
133 void output(FILE* file_pt,
const unsigned &n_plot);
138 const unsigned &nplot,
145 exact_soln_pt,
double& error,
178 const double &
pe()
const 195 double& source)
const 205 (*Source_fct_pt)(x,source);
222 for(
unsigned i=0;
i<2;
i++)
230 (*Wind_fct_pt)(x,wind);
238 unsigned n_node =
nnode();
251 for(
unsigned j=0;j<2;j++)
257 for(
unsigned l=0;l<n_node;l++)
260 for(
unsigned j=0;j<2;j++)
262 flux[j] +=
nodal_value(l,u_nodal_index)*dpsidx(l,j);
297 unsigned n_node =
nnode();
309 double interpolated_u = 0.0;
312 for(
unsigned l=0;l<n_node;l++)
314 interpolated_u +=
nodal_value(l,u_nodal_index)*psi[l];
317 return(interpolated_u);
331 const unsigned n_node =
nnode();
343 unsigned n_u_dof = 0;
344 for(
unsigned l=0;l<n_node;l++)
355 du_ddata.resize(n_u_dof,0.0);
356 global_eqn_number.resize(n_u_dof,0);
360 for(
unsigned l=0;l<n_node;l++)
368 global_eqn_number[count] = global_eqn;
370 du_ddata[count] = psi[l];
439 template <
unsigned NNODE_1D>
475 return Initial_Nvalue;
487 void output(std::ostream &outfile,
const unsigned &n_plot)
502 void output(FILE* file_pt,
const unsigned &n_plot)
510 const unsigned &n_plot,
545 template<
unsigned NNODE_1D>
558 for(
unsigned i=0;
i<NNODE_1D;
i++)
561 for(
unsigned j=0;j<2;j++)
563 dtestdx(
i,j) = dpsidx(
i,j);
580 template<
unsigned NNODE_1D>
603 template<
unsigned NNODE_1D>
633 template <
class ELEMENT>
644 typedef void (*SteadyAxisymAdvectionDiffusionPrescribedBetaFctPt)(
const Vector<double>& x,
649 typedef void (*SteadyAxisymAdvectionDiffusionPrescribedAlphaFctPt)(
const Vector<double>& x,
656 const int &face_index);
663 "Don't call empty constructor for SteadyAxisymAdvectionDiffusionFluxElement",
664 OOMPH_CURRENT_FUNCTION,
665 OOMPH_EXCEPTION_LOCATION);
698 fill_in_generic_residual_contribution_adv_diff_flux(residuals,
710 fill_in_generic_residual_contribution_adv_diff_flux(residuals,
722 const unsigned &
i)
const 735 void output(std::ostream &outfile,
const unsigned &nplot)
751 unsigned n_node =
nnode();
757 for(
unsigned i=0;
i<n_node;
i++)
775 unsigned n_node =
nnode();
781 for(
unsigned i=0;
i<n_node;
i++)
802 (*Beta_fct_pt)(x,beta);
811 if(Alpha_fct_pt == 0)
818 (*Alpha_fct_pt)(x,alpha);
827 void fill_in_generic_residual_contribution_adv_diff_flux(
Vector<double> &residuals,
854 template<
class ELEMENT>
857 const int &face_index) :
870 ELEMENT* elem_pt =
dynamic_cast<ELEMENT*
>(bulk_el_pt);
872 if(elem_pt->dim()==3)
881 "This flux element will not work correctly if nodes are hanging\n",
882 OOMPH_CURRENT_FUNCTION,
883 OOMPH_EXCEPTION_LOCATION);
909 "Bulk element must inherit from SteadyAxisymAdvectionDiffusionEquations.";
911 "Nodes are two dimensional, but cannot cast the bulk element to\n";
912 error_string +=
"SteadyAxisymAdvectionDiffusionEquations<2>\n.";
914 "If you desire this functionality, you must implement it yourself\n";
918 OOMPH_CURRENT_FUNCTION,
919 OOMPH_EXCEPTION_LOCATION);
938 template<
class ELEMENT>
945 const unsigned n_node =
nnode();
951 Shape psif(n_node), testf(n_node);
961 int local_eqn=0, local_unknown=0;
965 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
969 for(
unsigned i=0;
i<1;
i++)
986 double interpolated_u=0.0;
990 for(
unsigned l=0;l<n_node;l++)
994 interpolated_u += u_value*psif(l);
996 for(
unsigned i=0;
i<2;
i++)
1011 double r = interpolated_x[0];
1016 for(
unsigned l=0;l<n_node;l++)
1024 residuals[local_eqn] -= r*(beta - alpha*interpolated_u)*testf(l)*
W;
1028 if ( (flag) && (alpha!=0.0) )
1031 for(
unsigned l2=0;l2<n_node;l2++)
1037 if(local_unknown >= 0)
1039 jacobian(local_eqn,local_unknown) +=
1040 r*alpha*psif[l2]*testf[l]*
W;
virtual void get_source_axisym_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...
const double & pe() const
Peclet number.
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.
SteadyAxisymAdvectionDiffusionEquations()
Constructor: Initialise the Source_fct_pt and Wind_fct_pt to null and set (pointer to) Peclet number ...
void(* SteadyAxisymAdvectionDiffusionSourceFctPt)(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 ...
SteadyAxisymAdvectionDiffusionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
unsigned self_test()
Self-test: Return 0 for OK.
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 void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing...
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 ...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
void output(FILE *file_pt)
C_style output with default number of plot points.
void output(std::ostream &outfile, const unsigned &nplot)
Output function – forward to broken version in FiniteElement until somebody decides what exactly the...
A class for all elements that solve the Steady Axisymmetric Advection Diffusion equations using isopa...
void get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: .
A general Finite Element class.
QSteadyAxisymAdvectionDiffusionElement()
Constructor: Call constructors for QElement and Advection Diffusion equations.
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.
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.
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...
void output(std::ostream &outfile)
Output function: r,z,u.
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.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
SteadyAxisymAdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
void(* SteadyAxisymAdvectionDiffusionWindFctPt)(const Vector< double > &x, Vector< double > &wind)
Function pointer to wind function fct(x,w(x)) – x is a Vector!
QSteadyAxisymAdvectionDiffusionElement elements are linear/quadrilateral/brick-shaped Axisymmetric Ad...
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: r,z,u at n_plot^2 plot points.
void output(std::ostream &outfile)
Output function – forward to broken version in FiniteElement until somebody decides what exactly the...
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 ...
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.
double interpolated_u_adv_diff(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
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 ...
virtual void get_wind_axisym_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 fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Add the element's contribution to its residual vector and its Jacobian matrix.
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)
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
SteadyAxisymAdvectionDiffusionEquations(const SteadyAxisymAdvectionDiffusionEquations &dummy)
Broken copy constructor.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: r,z,u at n_plot^2 plot points.
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
SteadyAxisymAdvectionDiffusionWindFctPt Wind_fct_pt
Pointer to wind function:
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.
SteadyAxisymAdvectionDiffusionFluxElement(const SteadyAxisymAdvectionDiffusionFluxElement &dummy)
Broken copy constructor.
double *& pe_pt()
Pointer to 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. In addition, return the global equation numbers corresponding to the data. This is virtual so that it can be overloaded in the refineable version.
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
SteadyAxisymAdvectionDiffusionSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
SteadyAxisymAdvectionDiffusionPrescribedAlphaFctPt Alpha_fct_pt
Function pointer to the (global) prescribed-alpha function.
void fill_in_generic_residual_contribution_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 get_beta(const Vector< double > &x, double &beta)
Function to calculate the prescribed beta at a given spatial position.
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.
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...
QSteadyAxisymAdvectionDiffusionElement(const QSteadyAxisymAdvectionDiffusionElement< NNODE_1D > &dummy)
Broken copy constructor.
SteadyAxisymAdvectionDiffusionPrescribedBetaFctPt Beta_fct_pt
Function pointer to the (global) prescribed-beta function.
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...
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
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 ...
virtual unsigned u_index_axisym_adv_diff() const
Broken assignment operator.
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) ...
static double Default_peclet_number
Static default value for the Peclet number.
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...
void get_alpha(const Vector< double > &x, double &alpha)
Function to calculate the prescribed alpha at a given spatial position.
A class for elements that allow the imposition of an applied Robin boundary condition on the boundari...
double * Pe_pt
Pointer to global Peclet number.
SteadyAxisymAdvectionDiffusionPrescribedBetaFctPt & beta_fct_pt()
Broken assignment operator.
SteadyAxisymAdvectionDiffusionFluxElement()
Broken empty constructor.
void output(FILE *file_pt)
C-style output function: r,z,u.
unsigned nnode() const
Return the number of nodes.
SteadyAxisymAdvectionDiffusionSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
SteadyAxisymAdvectionDiffusionPrescribedAlphaFctPt & alpha_fct_pt()
Access function for the prescribed-alpha function pointer.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s...
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...
SteadyAxisymAdvectionDiffusionWindFctPt wind_fct_pt() const
Access function: Pointer to wind function. Const version.
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.
void output(std::ostream &outfile)
Output with default number of plot points.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
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...
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...
unsigned U_index_adv_diff
The index at which the unknown is stored at the nodes.