56 const unsigned n_node = nnode();
59 const unsigned u_nodal_index = u_index_cons_adv_diff();
62 Shape psi(n_node), test(n_node);
63 DShape dpsidx(n_node, DIM), dtestdx(n_node, DIM);
66 const unsigned n_intpt = integral_pt()->nweight();
72 const double peclet = pe();
75 const double peclet_st = pe_st();
79 int local_eqn = 0, local_unknown = 0;
82 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
85 for (
unsigned i = 0;
i < DIM;
i++)
s[
i] = integral_pt()->knot(ipt,
i);
88 double w = integral_pt()->weight(ipt);
91 double J = dshape_and_dtest_eulerian_at_knot_cons_adv_diff(
92 ipt, psi, dpsidx, test, dtestdx);
99 double interpolated_u = 0.0;
109 for (
unsigned l = 0; l < n_node; l++)
112 double u_value = raw_nodal_value(l, u_nodal_index);
113 interpolated_u += u_value * psi(l);
114 dudt += du_dt_cons_adv_diff(l) * psi(l);
116 for (
unsigned j = 0; j < DIM; j++)
118 interpolated_x[j] += raw_nodal_position(l, j) * psi(l);
119 interpolated_dudx[j] += u_value * dpsidx(l, j);
124 if (!ALE_is_disabled)
126 for (
unsigned l = 0; l < n_node; l++)
128 for (
unsigned j = 0; j < DIM; j++)
130 mesh_velocity[j] += raw_dnodal_position_dt(l, j) * psi(l);
139 get_source_cons_adv_diff(ipt, interpolated_x, source);
145 get_wind_cons_adv_diff(ipt,
s, interpolated_x, wind);
149 get_conserved_wind_cons_adv_diff(ipt,
s, interpolated_x, conserved_wind);
154 get_diff_cons_adv_diff(ipt,
s, interpolated_x, D);
160 for (
unsigned l = 0; l < n_node; l++)
163 local_eqn = nodal_local_eqn(l, u_nodal_index);
169 residuals[local_eqn] -= (peclet_st * dudt + source) * test(l) * W;
172 for (
unsigned k = 0; k < DIM; k++)
176 double tmp = peclet * wind[k];
178 if (!ALE_is_disabled)
180 tmp -= peclet_st * mesh_velocity[k];
182 tmp *= interpolated_dudx[k];
186 double tmp2 = -conserved_wind[k] * interpolated_u;
188 for (
unsigned j = 0; j < DIM; j++)
190 tmp2 += D(k, j) * interpolated_dudx[j];
193 residuals[local_eqn] -= (tmp * test(l) + tmp2 * dtestdx(l, k)) * W;
201 for (
unsigned l2 = 0; l2 < n_node; l2++)
204 local_unknown = nodal_local_eqn(l2, u_nodal_index);
207 if (local_unknown >= 0)
210 jacobian(local_eqn, local_unknown) -=
211 peclet_st * test(l) * psi(l2) *
212 node_pt(l2)->time_stepper_pt()->weight(1, 0) * W;
217 mass_matrix(local_eqn, local_unknown) +=
218 peclet_st * test(l) * psi(l2) * W;
222 for (
unsigned k = 0; k < DIM; k++)
225 double tmp = -peclet * wind[k];
226 if (!ALE_is_disabled)
228 tmp -= peclet_st * mesh_velocity[k];
230 tmp *= dpsidx(l2, k);
232 double tmp2 = -conserved_wind[k] * psi(l2);
234 for (
unsigned j = 0; j < DIM; j++)
236 tmp2 += D(k, j) * dpsidx(l2, j);
240 jacobian(local_eqn, local_unknown) -=
241 (tmp * test(l) + tmp2 * dtestdx(l, k)) * W;
289 std::ostream& outfile,
const unsigned& nplot)
296 outfile << tecplot_zone_string(nplot);
298 const unsigned n_node = this->nnode();
300 DShape dpsidx(n_node, DIM);
303 unsigned num_plot_points = nplot_points(nplot);
304 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
307 get_s_plot(iplot, nplot,
s);
311 interpolated_x(
s, x);
313 for (
unsigned i = 0;
i < DIM;
i++)
315 outfile << x[
i] <<
" ";
317 outfile << interpolated_u_cons_adv_diff(
s) <<
" ";
320 (void)this->dshape_eulerian(
s, psi, dpsidx);
322 for (
unsigned n = 0; n < n_node; n++)
324 const double u_ = this->nodal_value(n, 0);
325 for (
unsigned i = 0;
i < DIM;
i++)
327 interpolated_dudx[
i] += u_ * dpsidx(n,
i);
331 for (
unsigned i = 0;
i < DIM;
i++)
333 outfile << interpolated_dudx[
i] <<
" ";
340 get_wind_cons_adv_diff(ipt,
s, x, wind);
341 for (
unsigned i = 0;
i < DIM;
i++)
343 outfile << wind[
i] <<
" ";
345 outfile << std::endl;
349 write_tecplot_zone_footer(outfile, nplot);
450 std::ostream& outfile,
466 unsigned n_node = nnode();
471 unsigned n_intpt = integral_pt()->nweight();
474 outfile <<
"ZONE" << std::endl;
480 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
483 for (
unsigned i = 0;
i < DIM;
i++)
485 s[
i] = integral_pt()->knot(ipt,
i);
489 double w = integral_pt()->weight(ipt);
492 double J = J_eulerian(
s);
498 interpolated_x(
s, x);
501 double u_fe = interpolated_u_cons_adv_diff(
s);
504 (*exact_soln_pt)(x, exact_soln);
507 for (
unsigned i = 0;
i < DIM;
i++)
509 outfile << x[
i] <<
" ";
511 outfile << exact_soln[0] <<
" " << exact_soln[0] - u_fe << std::endl;
514 norm += exact_soln[0] * exact_soln[0] * W;
515 error += (exact_soln[0] - u_fe) * (exact_soln[0] - u_fe) * W;
533 const unsigned n_node = nnode();
536 const unsigned u_nodal_index = this->u_index_cons_adv_diff();
542 const unsigned n_intpt = integral_pt()->nweight();
545 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
548 const double w = integral_pt()->weight(ipt);
551 this->shape_at_knot(ipt, psi);
554 double interpolated_u = 0.0;
555 for (
unsigned l = 0; l < n_node; l++)
557 interpolated_u += this->nodal_value(l, u_nodal_index) * psi(l);
561 const double J = J_eulerian_at_knot(ipt);
564 sum += interpolated_u * w * J;