52 Vector<double> &residuals,
53 DenseMatrix<double> &jacobian,
59 const unsigned n_node = nnode();
65 Shape psi(n_node), test(n_node);
66 DShape dpsidx(n_node,2), dtestdx(n_node,2);
69 const unsigned n_intpt = integral_pt()->nweight();
75 const double peclet =
pe();
78 const double peclet_st =
pe_st();
82 int local_eqn=0, local_unknown=0;
85 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
89 for(
unsigned i=0;
i<2;
i++)
s[
i] = integral_pt()->knot(ipt,
i);
92 double w = integral_pt()->weight(ipt);
97 ipt,psi,dpsidx,test,dtestdx);
104 double interpolated_u=0.0;
106 Vector<double> interpolated_x(2,0.0);
107 Vector<double> interpolated_dudx(2,0.0);
108 Vector<double> mesh_velocity(2,0.0);
114 for(
unsigned l=0;l<n_node;l++)
117 double u_value = raw_nodal_value(l,u_nodal_index);
118 interpolated_u += u_value*psi(l);
121 for(
unsigned j=0;j<2;j++)
123 interpolated_x[j] += raw_nodal_position(l,j)*psi(l);
124 interpolated_dudx[j] += u_value*dpsidx(l,j);
131 for(
unsigned l=0;l<n_node;l++)
133 for(
unsigned j=0;j<2;j++)
135 mesh_velocity[j] += raw_dnodal_position_dt(l,j)*psi(l);
149 Vector<double> wind(3);
153 Vector<double> conserved_wind(3);
157 DenseMatrix<double>
D(3,3);
161 double r = interpolated_x[0];
167 for(
unsigned l=0;l<n_node;l++)
170 local_eqn = nodal_local_eqn(l,u_nodal_index);
176 residuals[local_eqn] -= (peclet_st*dudt + source)*r*test(l)*
W;
180 for(
unsigned k=0;k<2;k++)
184 double tmp = peclet*wind[k];
187 tmp *= interpolated_dudx[k];
191 double tmp2 = -conserved_wind[k]*interpolated_u;
193 for(
unsigned j=0;j<2;j++)
195 tmp2 +=
D(k,j)*interpolated_dudx[j];
198 residuals[local_eqn] -= (tmp*test(l) + tmp2*dtestdx(l,k))*r*W;
206 for(
unsigned l2=0;l2<n_node;l2++)
209 local_unknown = nodal_local_eqn(l2,u_nodal_index);
212 if(local_unknown >= 0)
215 jacobian(local_eqn,local_unknown)
216 -= peclet_st*test(l)*psi(l2)*
217 node_pt(l2)->time_stepper_pt()->weight(1,0)*r*
W;
222 mass_matrix(local_eqn,local_unknown)
223 += peclet_st*test(l)*psi(l2)*r*
W;
227 for(
unsigned k=0;k<2;k++)
230 double tmp = -peclet*wind[k];
232 {tmp -= peclet_st*mesh_velocity[k];}
235 double tmp2 = -conserved_wind[k]*psi(l2);
237 for(
unsigned j=0;j<2;j++)
239 tmp2 +=
D(k,j)*dpsidx(l2,j);
243 jacobian(local_eqn,local_unknown)
244 -= (tmp*test(l) + tmp2*dtestdx(l,k))*r*W;
294 std::ostream &outfile,
295 const unsigned &nplot)
301 outfile << tecplot_zone_string(nplot);
303 const unsigned n_node = this->nnode();
305 DShape dpsidx(n_node,2);
308 unsigned num_plot_points=nplot_points(nplot);
309 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
312 get_s_plot(iplot,nplot,
s);
318 for(
unsigned i=0;
i<2;
i++)
320 outfile << x[
i] <<
" ";
342 Vector<double> wind(3);
346 for(
unsigned i=0;
i<3;
i++)
348 outfile << wind[
i] <<
" ";
350 outfile << std::endl;
355 write_tecplot_zone_footer(outfile,nplot);
368 const unsigned &nplot)
374 fprintf(file_pt,
"%s",tecplot_zone_string(nplot).c_str());
377 unsigned num_plot_points=nplot_points(nplot);
378 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
382 get_s_plot(iplot,nplot,
s);
384 for(
unsigned i=0;
i<2;
i++)
386 fprintf(file_pt,
"%g ",interpolated_x(
s,
i));
393 write_tecplot_zone_footer(file_pt,nplot);
408 std::ostream &outfile,
409 const unsigned &nplot,
420 outfile << tecplot_zone_string(nplot);
423 Vector<double> exact_soln(1);
426 unsigned num_plot_points=nplot_points(nplot);
427 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
431 get_s_plot(iplot,nplot,
s);
437 (*exact_soln_pt)(x,exact_soln);
440 for(
unsigned i=0;
i<2;
i++)
442 outfile << x[
i] <<
" ";
444 outfile << exact_soln[0] << std::endl;
448 write_tecplot_zone_footer(outfile,nplot);
463 std::ostream &outfile,
465 double& error,
double& norm)
479 unsigned n_node = nnode();
484 unsigned n_intpt = integral_pt()->nweight();
487 outfile <<
"ZONE" << std::endl;
490 Vector<double> exact_soln(1);
493 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
497 for(
unsigned i=0;
i<2;
i++)
499 s[
i] = integral_pt()->knot(ipt,
i);
503 double w = integral_pt()->weight(ipt);
506 double J=J_eulerian(
s);
518 (*exact_soln_pt)(x,exact_soln);
521 for(
unsigned i=0;
i<2;
i++)
523 outfile << x[
i] <<
" ";
525 outfile << exact_soln[0] <<
" " << exact_soln[0]-u_fe << std::endl;
528 norm+=exact_soln[0]*exact_soln[0]*x[0]*
W;
529 error+=(exact_soln[0]-u_fe)*(exact_soln[0]-u_fe)*x[0]*
W;
545 const unsigned n_node = this->nnode();
554 const unsigned n_intpt = integral_pt()->nweight();
557 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
560 const double w = integral_pt()->weight(ipt);
563 this->shape_at_knot(ipt,psi);
566 double interpolated_u = 0.0;
567 for(
unsigned l=0;l<n_node;l++)
568 {interpolated_u += this->nodal_value(l,u_nodal_index)*psi(l);}
572 for(
unsigned l=0;l<n_node;l++)
573 {r += this->nodal_position(l,0)*psi(l);}
576 const double J=J_eulerian_at_knot(ipt);
579 sum += interpolated_u*r*w*J;
590 template<
unsigned NNODE_1D>
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
const double & pe() const
Peclet number.
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_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: r,z,u_exact at nplot^2 plot points.
virtual unsigned self_test()
Self-test: Check inversion of element & do self-test for GeneralisedElement. Return 0 if OK...
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 ...
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 ...
unsigned self_test()
Self-test: Return 0 for OK.
const double & pe_st() const
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...
QGeneralisedAxisymAdvectionDiffusionElement elements are linear/quadrilateral/brick-shaped Advection ...
void output(std::ostream &outfile)
Output with default number of plot points.
double integrate_u()
Integrate the concentration over the element.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
static double Default_peclet_number
Static default value for the Peclet number.
double du_dt_cons_axisym_adv_diff(const unsigned &n) const
du/dt at local node n.
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...
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.