40 template<
unsigned DIM>
51 template <
unsigned DIM>
60 unsigned n_node = nnode();
63 unsigned u_nodal_index = u_index_adv_diff();
66 Shape psi(n_node), test(n_node);
67 DShape dpsidx(n_node,DIM), dtestdx(n_node,DIM);
70 unsigned n_intpt = integral_pt()->nweight();
79 double peclet_st =
pe_st();
83 int local_eqn=0, local_unknown=0;
86 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
90 for(
unsigned i=0;
i<DIM;
i++) s[
i] = integral_pt()->knot(ipt,
i);
93 double w = integral_pt()->weight(ipt);
97 dshape_and_dtest_eulerian_at_knot_adv_diff(ipt,psi,dpsidx,test,dtestdx);
104 double interpolated_u=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);
119 dudt += du_dt_adv_diff(l)*psi(l);
121 for(
unsigned j=0;j<DIM;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<DIM;j++)
135 mesh_velocity[j] += raw_dnodal_position_dt(l,j)*psi(l);
144 get_source_adv_diff(ipt,interpolated_x,source);
150 get_wind_adv_diff(ipt,s,interpolated_x,wind);
156 for(
unsigned l=0;l<n_node;l++)
159 local_eqn = nodal_local_eqn(l,u_nodal_index);
165 residuals[local_eqn] -= (peclet_st*dudt + source)*test(l)*
W;
168 for(
unsigned k=0;k<DIM;k++)
171 double tmp = peclet*wind[k];
175 residuals[local_eqn] -=
176 interpolated_dudx[k]*(tmp*test(l) + dtestdx(l,k))*W;
184 for(
unsigned l2=0;l2<n_node;l2++)
187 local_unknown = nodal_local_eqn(l2,u_nodal_index);
190 if(local_unknown >= 0)
193 jacobian(local_eqn,local_unknown)
194 -= peclet_st*test(l)*psi(l2)*
195 node_pt(l2)->time_stepper_pt()->weight(1,0)*
W;
200 mass_matrix(local_eqn,local_unknown)
201 += peclet_st*test(l)*psi(l2)*
W;
205 for(
unsigned i=0;
i<DIM;
i++)
208 double tmp = peclet*wind[
i];
211 jacobian(local_eqn,local_unknown)
212 -= dpsidx(l2,
i)*(tmp*test(l)+dtestdx(l,
i))*W;
230 template <
unsigned DIM>
263 template <
unsigned DIM>
265 const unsigned &nplot)
272 outfile << tecplot_zone_string(nplot);
275 unsigned num_plot_points=nplot_points(nplot);
276 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
279 get_s_plot(iplot,nplot,s);
285 for(
unsigned i=0;
i<DIM;
i++)
287 outfile << x[
i] <<
" ";
289 outfile << interpolated_u_adv_diff(s) <<
" ";
295 get_wind_adv_diff(ipt,s,x,wind);
296 for(
unsigned i=0;
i<DIM;
i++)
298 outfile << wind[
i] <<
" ";
300 outfile << std::endl;
305 write_tecplot_zone_footer(outfile,nplot);
317 template <
unsigned DIM>
319 const unsigned &nplot)
325 fprintf(file_pt,
"%s",tecplot_zone_string(nplot).c_str());
328 unsigned num_plot_points=nplot_points(nplot);
329 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
333 get_s_plot(iplot,nplot,s);
335 for(
unsigned i=0;
i<DIM;
i++)
337 fprintf(file_pt,
"%g ",interpolated_x(s,
i));
340 fprintf(file_pt,
"%g \n",interpolated_u_adv_diff(s));
344 write_tecplot_zone_footer(file_pt,nplot);
358 template <
unsigned DIM>
360 const unsigned &nplot,
371 outfile << tecplot_zone_string(nplot);
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);
388 (*exact_soln_pt)(x,exact_soln);
391 for(
unsigned i=0;
i<DIM;
i++)
393 outfile << x[
i] <<
" ";
395 outfile << exact_soln[0] << std::endl;
399 write_tecplot_zone_footer(outfile,nplot);
413 template <
unsigned DIM>
416 double& error,
double& norm)
430 unsigned n_node = nnode();
435 unsigned n_intpt = integral_pt()->nweight();
438 outfile <<
"ZONE" << std::endl;
444 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
448 for(
unsigned i=0;
i<DIM;
i++)
450 s[
i] = integral_pt()->knot(ipt,
i);
454 double w = integral_pt()->weight(ipt);
457 double J=J_eulerian(s);
466 double u_fe=interpolated_u_adv_diff(s);
469 (*exact_soln_pt)(x,exact_soln);
472 for(
unsigned i=0;
i<DIM;
i++)
474 outfile << x[
i] <<
" ";
476 outfile << exact_soln[0] <<
" " << exact_soln[0]-u_fe << std::endl;
479 norm+=exact_soln[0]*exact_soln[0]*
W;
480 error+=(exact_soln[0]-u_fe)*(exact_soln[0]-u_fe)*
W;
490 template<
unsigned DIM,
unsigned NNODE_1D>
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...
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
const double & pe() const
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.
virtual unsigned self_test()
Self-test: Check inversion of element & do self-test for GeneralisedElement. Return 0 if OK...
QAdvectionDiffusionElement elements are linear/quadrilateral/brick-shaped Advection Diffusion element...
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,u_exact or x,y,z,u_exact at nplot^DIM plot points.
A class for all elements that solve the Advection Diffusion equations using isoparametric elements...
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
const double & pe_st() const
Peclet number multiplied by Strouhal number.
void output(std::ostream &outfile)
Output with default number of plot points.
unsigned self_test()
Self-test: Return 0 for OK.