32 #ifndef OOMPH_AXISYM_ADV_DIFF_ELEMENTS_HEADER 33 #define OOMPH_AXISYM_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" 135 const unsigned n_time = time_stepper_pt->
ntstorage();
137 for(
unsigned t=0;
t<n_time;
t++)
174 const unsigned& nplot)
const 181 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
201 file_out << wind[
i] << std::endl;
211 std::stringstream error_stream;
213 <<
"Advection Diffusion Elements only store 4 fields " << std::endl;
216 OOMPH_CURRENT_FUNCTION,
217 OOMPH_EXCEPTION_LOCATION);
235 return "Advection Diffusion";
240 std::stringstream error_stream;
242 <<
"Advection Diffusion Elements only store 4 fields " 246 OOMPH_CURRENT_FUNCTION,
247 OOMPH_EXCEPTION_LOCATION);
262 void output(std::ostream &outfile,
const unsigned &nplot);
274 void output(FILE* file_pt,
const unsigned &n_plot);
279 const unsigned &nplot,
286 exact_soln_pt,
double& error,
311 inline const double &
pe()
const {
return *
Pe_pt;}
323 inline const double &
d()
const {
return *
D_pt;}
334 double& source)
const 344 (*Source_fct_pt)(x,source);
361 for(
unsigned i=0;
i<3;
i++)
369 (*Wind_fct_pt)(x,wind);
379 const unsigned n_node =
nnode();
392 for(
unsigned j=0;j<2;j++) {flux[j] = 0.0;}
395 for(
unsigned l=0;l<n_node;l++)
397 const double u_value = this->
nodal_value(l,u_nodal_index);
399 flux[0] += u_value*dpsidx(l,0);
400 flux[1] += u_value*dpsidx(l,1);
435 const unsigned n_node =
nnode();
447 double interpolated_u = 0.0;
450 for(
unsigned l=0;l<n_node;l++)
452 interpolated_u +=
nodal_value(l,u_nodal_index)*psi[l];
455 return(interpolated_u);
470 const unsigned n_node =
nnode();
482 unsigned n_u_dof = 0;
483 for(
unsigned l=0;l<n_node;l++)
494 du_ddata.resize(n_u_dof,0.0);
495 global_eqn_number.resize(n_u_dof,0);
499 for(
unsigned l=0;l<n_node;l++)
507 global_eqn_number[count] = global_eqn;
509 du_ddata[count] = psi[l];
591 template <
unsigned NNODE_1D>
628 return Initial_Nvalue;
640 void output(std::ostream &outfile,
const unsigned &n_plot)
655 void output(FILE* file_pt,
const unsigned &n_plot)
663 const unsigned &n_plot,
700 template<
unsigned NNODE_1D>
713 for(
unsigned i=0;
i<NNODE_1D;
i++)
716 for(
unsigned j=0;j<2;j++)
718 dtestdx(
i,j) = dpsidx(
i,j);
735 template<
unsigned NNODE_1D>
758 template<
unsigned NNODE_1D>
788 template <
class ELEMENT>
799 typedef void (*AxisymAdvectionDiffusionPrescribedBetaFctPt)(
805 typedef void (*AxisymAdvectionDiffusionPrescribedAlphaFctPt)(
813 const int &face_index);
820 "Don't call empty constructor for AxisymAdvectionDiffusionFluxElement",
821 OOMPH_CURRENT_FUNCTION,
822 OOMPH_EXCEPTION_LOCATION);
856 fill_in_generic_residual_contribution_axi_adv_diff_flux(
868 fill_in_generic_residual_contribution_axi_adv_diff_flux(residuals,
879 const unsigned &
i)
const 893 void output(std::ostream &outfile,
const unsigned &nplot)
909 unsigned n_node =
nnode();
915 for(
unsigned i=0;
i<n_node;
i++)
933 unsigned n_node =
nnode();
939 for(
unsigned i=0;
i<n_node;
i++)
960 (*Beta_fct_pt)(x,beta);
969 if(Alpha_fct_pt == 0)
976 (*Alpha_fct_pt)(x,alpha);
985 void fill_in_generic_residual_contribution_axi_adv_diff_flux(
1012 template<
class ELEMENT>
1015 const int &face_index) :
1027 ELEMENT* elem_pt =
dynamic_cast<ELEMENT*
>(bulk_el_pt);
1029 if(elem_pt->dim()==3)
1038 "This flux element will not work correctly if nodes are hanging\n",
1039 OOMPH_CURRENT_FUNCTION,
1040 OOMPH_EXCEPTION_LOCATION);
1066 "Bulk element must inherit from AxisymAdvectionDiffusionEquations.";
1068 "Nodes are two dimensional, but cannot cast the bulk element to\n";
1069 error_string +=
"AxisymAdvectionDiffusionEquations<2>\n.";
1071 "If you desire this functionality, you must implement it yourself\n";
1075 OOMPH_CURRENT_FUNCTION,
1076 OOMPH_EXCEPTION_LOCATION);
1095 template<
class ELEMENT>
1103 const unsigned n_node =
nnode();
1109 Shape psif(n_node), testf(n_node);
1119 int local_eqn=0, local_unknown=0;
1123 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
1127 for(
unsigned i=0;
i<1;
i++)
1144 double interpolated_u=0.0;
1148 for(
unsigned l=0;l<n_node;l++)
1152 interpolated_u += u_value*psif(l);
1154 for(
unsigned i=0;
i<2;
i++)
1170 double dS = interpolated_x[0]*interpolated_x[0]*sin(interpolated_x[1]);
1175 for(
unsigned l=0;l<n_node;l++)
1183 residuals[local_eqn] -= dS*(beta - alpha*interpolated_u)*testf(l)*
W;
1187 if ( (flag) && (alpha!=0.0) )
1190 for(
unsigned l2=0;l2<n_node;l2++)
1196 if(local_unknown >= 0)
1198 jacobian(local_eqn,local_unknown) +=
1199 dS*alpha*psif[l2]*testf[l]*
W;
QAxisymAdvectionDiffusionElement()
Constructor: Call constructors for QElement and Advection Diffusion equations.
double *& d_pt()
Pointer to Peclet number multipled by Strouha 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.
AxisymAdvectionDiffusionFluxElement()
Broken empty constructor.
double dshape_and_dtest_eulerian_axi_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.
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.
AxisymAdvectionDiffusionFluxElement(const AxisymAdvectionDiffusionFluxElement &dummy)
Broken copy constructor.
void get_alpha(const Vector< double > &x, double &alpha)
Function to calculate the prescribed alpha at a given spatial position.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
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, const unsigned &n_plot)
Output function: r,z,u at n_plot^2 plot points.
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 disable_ALE()
Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!
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...
bool ALE_is_disabled
Boolean flag to indicate whether AlE formulation is disable.
QAxisymAdvectionDiffusionElement(const QAxisymAdvectionDiffusionElement< NNODE_1D > &dummy)
Broken copy constructor.
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
double *& pe_st_pt()
Pointer to Peclet number multipled by Strouha number.
AxisymAdvectionDiffusionPrescribedAlphaFctPt Alpha_fct_pt
Function pointer to the (global) prescribed-alpha function.
AxisymAdvectionDiffusionEquations(const AxisymAdvectionDiffusionEquations &dummy)
Broken copy constructor.
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
void output(std::ostream &outfile)
Output function: r,z,u.
A general Finite Element class.
void output(std::ostream &outfile, const unsigned &nplot)
Output function – forward to broken version in FiniteElement until somebody decides what exactly the...
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 fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
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 double dshape_and_dtest_eulerian_axi_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...
virtual double dshape_and_dtest_eulerian_at_knot_axi_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 ...
const double & pe_st() const
Peclet number multiplied by Strouhal number.
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 dshape_and_dtest_eulerian_at_knot_axi_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 * Pe_pt
Pointer to global Peclet number.
unsigned self_test()
Self-test: Return 0 for OK.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
virtual void get_wind_axi_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...
AxisymAdvectionDiffusionWindFctPt Wind_fct_pt
Pointer to wind function:
virtual void fill_in_generic_residual_contribution_axi_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...
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: r,z,u at n_plot^2 plot points.
AxisymAdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
unsigned U_index_adv_diff
The index at which the unknown is stored at the nodes.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
QAxisymAdvectionDiffusionElement elements are linear/quadrilateral/brick-shaped Axisymmetric Advectio...
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 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.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
void output(std::ostream &outfile)
Output with default number of plot points.
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 * D_pt
Pointer to global Diffusion parameter.
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...
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)
unsigned nscalar_paraview() const
Number of scalars/fields output by this element. Reimplements broken virtual function in base class...
AxisymAdvectionDiffusionPrescribedAlphaFctPt & alpha_fct_pt()
Access function for the prescribed-alpha function pointer.
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...
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 get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux:
void(* AxisymAdvectionDiffusionSourceFctPt)(const Vector< double > &x, double &f)
Function pointer to source function fct(x,f(x)) – x is a Vector!
const double & pe() const
Peclet number.
A class for elements that allow the imposition of an applied Robin boundary condition on the boundari...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
AxisymAdvectionDiffusionPrescribedBetaFctPt Beta_fct_pt
Function pointer to the (global) prescribed-beta function.
void fill_in_generic_residual_contribution_axi_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...
double *& pe_pt()
Pointer to Peclet number.
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 ...
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual void dinterpolated_u_axi_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.
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...
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
void output(FILE *file_pt)
C-style output function: r,z,u.
AxisymAdvectionDiffusionPrescribedBetaFctPt & beta_fct_pt()
Broken assignment operator.
void(* AxisymAdvectionDiffusionWindFctPt)(const Vector< double > &x, Vector< double > &wind)
Function pointer to wind function fct(x,w(x)) – x is a Vector!
AxisymAdvectionDiffusionSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
static double Default_peclet_number
Static default value for the Peclet number.
double du_dt_axi_adv_diff(const unsigned &n) const
du/dt at local node n.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
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.
AxisymAdvectionDiffusionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
void output(FILE *file_pt)
C_style output with default number of plot points.
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_u_axi_adv_diff(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
AxisymAdvectionDiffusionEquations()
Constructor: Initialise the Source_fct_pt and Wind_fct_pt to null and set (pointer to) Peclet number ...
virtual unsigned u_index_axi_adv_diff() const
Broken assignment operator.
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...
static double Default_diffusion_parameter
Static default value for the Peclet number.
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 ...
bool is_steady() const
Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-depen...
void get_beta(const Vector< double > &x, double &beta)
Function to calculate the prescribed beta at a given spatial position.
AxisymAdvectionDiffusionSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
AxisymAdvectionDiffusionWindFctPt wind_fct_pt() const
Access function: Pointer to wind function. Const version.
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.
void output(std::ostream &outfile)
Output function – forward to broken version in FiniteElement until somebody decides what exactly the...
virtual void get_source_axi_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...
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.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s...
double * PeSt_pt
Pointer to global Peclet number multiplied by Strouhal 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...
A class for all elements that solve the Advection Diffusion equations in a cylindrical polar coordina...
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
const double & d() const
Peclet number multiplied by Strouhal number.
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)...
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.
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...