31 #ifndef OOMPH_GEN_AXISYM_ADV_DIFF_ELEMENTS_HEADER 32 #define OOMPH_GEN_AXISYM_ADV_DIFF_ELEMENTS_HEADER 37 #include <oomph-lib-config.h> 41 #include "../generic/nodes.h" 42 #include "../generic/Qelements.h" 43 #include "../generic/oomph_utilities.h" 60 class GeneralisedAxisymAdvectionDiffusionEquations :
61 public virtual FiniteElement
68 typedef void (*GeneralisedAxisymAdvectionDiffusionSourceFctPt)
69 (
const Vector<double>& x,
double& f);
73 typedef void (*GeneralisedAxisymAdvectionDiffusionWindFctPt)
74 (
const Vector<double>& x, Vector<double>& wind);
78 typedef void (*GeneralisedAxisymAdvectionDiffusionDiffFctPt)
79 (
const Vector<double> &x, DenseMatrix<double> &
D);
83 GeneralisedAxisymAdvectionDiffusionEquations() :
94 GeneralisedAxisymAdvectionDiffusionEquations(
95 const GeneralisedAxisymAdvectionDiffusionEquations& dummy)
124 TimeStepper* time_stepper_pt= this->node_pt(n)->time_stepper_pt();
135 const unsigned n_time = time_stepper_pt->
ntstorage();
137 for(
unsigned t=0;
t<n_time;
t++)
139 dudt += time_stepper_pt->
weight(1,
t)*nodal_value(
t,n,u_nodal_index);
172 void output(std::ostream &outfile,
const unsigned &nplot);
183 void output(FILE* file_pt,
const unsigned &n_plot);
187 void output_fct(std::ostream &outfile,
const unsigned &nplot,
194 virtual void output_fct(std::ostream &outfile,
const unsigned &nplot,
199 "There is no time-dependent output_fct() for Advection Diffusion elements",
200 OOMPH_CURRENT_FUNCTION,
201 OOMPH_EXCEPTION_LOCATION);
208 exact_soln_pt,
double& error,
double& norm);
215 const double& time,
double& error,
double& norm)
218 "No time-dependent compute_error() for Advection Diffusion elements",
219 OOMPH_CURRENT_FUNCTION,
220 OOMPH_EXCEPTION_LOCATION);
233 GeneralisedAxisymAdvectionDiffusionSourceFctPt
source_fct_pt()
const 243 GeneralisedAxisymAdvectionDiffusionWindFctPt
wind_fct_pt()
const 263 GeneralisedAxisymAdvectionDiffusionDiffFctPt
diff_fct_pt()
const 284 double& source)
const 291 (*Source_fct_pt)(x,source);
309 for(
unsigned i=0;
i<3;
i++) {wind[
i]= 0.0;}
314 (*Wind_fct_pt)(x,wind);
334 for(
unsigned i=0;
i<3;
i++) {wind[
i]= 0.0;}
339 (*Conserved_wind_fct_pt)(x,wind);
360 for(
unsigned i=0;
i<3;
i++)
362 for(
unsigned j=0;j<3;j++)
364 if(
i==j) {
D(
i,j) = 1.0;}
else {
D(
i,j) = 0.0;}
380 const unsigned n_node = this->nnode();
390 dshape_eulerian(s,psi,dpsidx);
393 for(
unsigned j=0;j<2;j++) {flux[j] = 0.0;}
396 for(
unsigned l=0;l<n_node;l++)
398 const double u_value = this->nodal_value(l,u_nodal_index);
400 flux[0] += u_value*dpsidx(l,0);
401 flux[1] += u_value*dpsidx(l,1);
410 const unsigned n_node = nnode();
420 dshape_eulerian(s,psi,dpsidx);
425 double interpolated_u = 0.0;
430 for(
unsigned l=0;l<n_node;l++)
433 const double u_value = this->nodal_value(l,u_nodal_index);
434 interpolated_u += u_value*psi(l);
436 for(
unsigned j=0;j<2;j++)
438 interpolated_x[j] += this->nodal_position(l,j)*psi(l);
439 interpolated_dudx[j] += u_value*dpsidx(l,j);
458 for(
unsigned i=0;
i<2;
i++)
461 for(
unsigned j=0;j<2;j++)
463 total_flux[
i] +=
D(
i,j)*interpolated_dudx[j];
465 total_flux[
i] -= conserved_wind[
i]*interpolated_u;
500 jacobian,mass_matrix,2);
509 unsigned n_node = nnode();
521 double interpolated_u = 0.0;
524 for(
unsigned l=0;l<n_node;l++)
526 interpolated_u += nodal_value(l,u_nodal_index)*psi[l];
529 return(interpolated_u);
606 template <
unsigned NNODE_1D>
608 public virtual QElement<2,NNODE_1D>,
609 public virtual GeneralisedAxisymAdvectionDiffusionEquations
624 GeneralisedAxisymAdvectionDiffusionEquations()
643 {
return Initial_Nvalue;}
652 void output(std::ostream &outfile,
const unsigned &n_plot)
665 void output(FILE* file_pt,
const unsigned &n_plot)
672 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
682 void output_fct(std::ostream &outfile,
const unsigned &n_plot,
688 output_fct(outfile,n_plot,time,exact_soln_pt);
696 const Vector<double> &
s,
700 DShape &dtestdx)
const;
723 template<
unsigned NNODE_1D>
729 DShape &dtestdx)
const 732 double J = this->dshape_eulerian(s,psi,dpsidx);
736 for(
unsigned i=0;
i<NNODE_1D;
i++)
739 for(
unsigned j=0;j<2;j++)
741 dtestdx(
i,j) = dpsidx(
i,j);
757 template<
unsigned NNODE_1D>
764 DShape &dtestdx)
const 767 double J = this->dshape_eulerian_at_knot(ipt,psi,dpsidx);
790 template<
unsigned NNODE_1D>
792 public virtual QElement<1,NNODE_1D>
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
GeneralisedAxisymAdvectionDiffusionSourceFctPt Source_fct_pt
Pointer to source function:
const double & pe() const
Peclet number.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function: r,z,u at n_plot^2 plot points.
GeneralisedAxisymAdvectionDiffusionWindFctPt & conserved_wind_fct_pt()
Access function: Pointer to additional (conservative) wind function.
GeneralisedAxisymAdvectionDiffusionWindFctPt Wind_fct_pt
Pointer to wind function:
GeneralisedAxisymAdvectionDiffusionSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
QGeneralisedAxisymAdvectionDiffusionElement()
Constructor: Call constructors for QElement and Advection Diffusion equations.
virtual void get_diff_cons_axisym_adv_diff(const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, DenseMatrix< double > &D) const
Get diffusivity tensor at (Eulerian) position x and/or local coordinate s. This function is virtual t...
void output(FILE *file_pt, const unsigned &n_plot)
C-style output FE representation of soln: r,z,u at n_plot^2 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.
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
virtual void get_wind_cons_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...
virtual double dshape_and_dtest_eulerian_at_knot_cons_axisym_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 get_flux(const Vector< double > &s, Vector< double > &flux) const
Get flux: .
virtual void get_conserved_wind_cons_axisym_adv_diff(const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &wind) const
Get additional (conservative) wind at (Eulerian) position x and/or local coordinate s...
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
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.
unsigned self_test()
Self-test: Return 0 for OK.
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) ...
const double & pe_st() const
Peclet number multiplied by Strouhal number.
double * PeSt_pt
Pointer to global Peclet number multiplied by Strouhal number.
virtual void fill_in_generic_residual_contribution_cons_axisym_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...
GeneralisedAxisymAdvectionDiffusionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
GeneralisedAxisymAdvectionDiffusionWindFctPt Conserved_wind_fct_pt
Pointer to additional (conservative) wind function:
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_cons_axisym_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.
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
void get_total_flux(const Vector< double > &s, Vector< double > &total_flux) const
Get flux: .
virtual void output_fct(std::ostream &outfile, const unsigned &nplot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: r,z,,u_exact at nplot^2 plot points (dummy time-dependent version to keep intel co...
QGeneralisedAxisymAdvectionDiffusionElement elements are linear/quadrilateral/brick-shaped Advection ...
void shape(const double &s, double *Psi)
Definition for 1D Lagrange shape functions. The value of all the shape functions at the local coordin...
void output(std::ostream &outfile)
Output with default number of plot points.
GeneralisedAxisymAdvectionDiffusionDiffFctPt Diff_fct_pt
Pointer to diffusivity funciton.
unsigned ntstorage() const
Return the number of doubles required to represent history (one for steady)
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
double *& pe_st_pt()
Pointer to Peclet number multipled by Strouha number.
double integrate_u()
Integrate the concentration over the element.
GeneralisedAxisymAdvectionDiffusionDiffFctPt & diff_fct_pt()
Access function: Pointer to diffusion function.
void disable_ALE()
Disable ALE, i.e. assert the mesh is not moving – you do this at your own risk!
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
double *& pe_pt()
Pointer to Peclet number.
static double Default_peclet_number
Static default value for the Peclet number.
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.
double du_dt_cons_axisym_adv_diff(const unsigned &n) const
du/dt at local node n.
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Output function for a time-dependent exact solution. r,z,u_exact at n_plot^2 plot points (Calls the s...
virtual unsigned u_index_cons_axisym_adv_diff() const
A class for all elements that solve the Advection Diffusion equations in conservative form using isop...
void output(std::ostream &outfile)
Output function: r,z,u.
virtual double dshape_and_dtest_eulerian_cons_axisym_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...
bool is_steady() const
Flag to indicate if a timestepper has been made steady (possibly temporarily to switch off time-depen...
double * Pe_pt
Pointer to global Peclet number.
QGeneralisedAxisymAdvectionDiffusionElement(const QGeneralisedAxisymAdvectionDiffusionElement< NNODE_1D > &dummy)
Broken copy constructor.
double dshape_and_dtest_eulerian_at_knot_cons_axisym_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.
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 void get_source_cons_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...
double interpolated_u_cons_axisym_adv_diff(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
void output(FILE *file_pt)
C-style output function: r,z,u.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...