36 template<
unsigned DIM>
40 template<
unsigned DIM>
47 template<
unsigned DIM,
unsigned NNODE_1D>
58 template<
unsigned DIM>
64 unsigned n_node = nnode();
67 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
70 unsigned u_nodal_index = u_index_ust_heat();
73 Shape psi(n_node), test(n_node);
74 DShape dpsidx(n_node, DIM), dtestdx(n_node, DIM);
77 unsigned n_intpt = integral_pt()->nweight();
83 double alpha_local = alpha();
84 double beta_local = beta();
87 int local_eqn = 0, local_unknown = 0;
90 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
93 for (
unsigned i = 0;
i < DIM;
i++)
s[
i] = integral_pt()->knot(ipt,
i);
96 double w = integral_pt()->weight(ipt);
99 double J = dshape_and_dtest_eulerian_at_knot_ust_heat(
100 ipt, psi, dpsidx, test, dtestdx);
106 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_ust_heat(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);
129 if (!ALE_is_disabled)
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);
143 get_source_ust_heat(time, ipt, interpolated_x, source);
149 for (
unsigned l = 0; l < n_node; l++)
151 local_eqn = nodal_local_eqn(l, u_nodal_index);
156 residuals[local_eqn] += (alpha_local * dudt + source) * test(l) *
W;
159 if (!ALE_is_disabled)
161 for (
unsigned k = 0; k < DIM; k++)
163 residuals[local_eqn] -= alpha_local * mesh_velocity[k] *
164 interpolated_dudx[k] * test(l) *
W;
169 for (
unsigned k = 0; k < DIM; k++)
171 residuals[local_eqn] +=
172 beta_local * interpolated_dudx[k] * dtestdx(l, k) *
W;
181 for (
unsigned l2 = 0; l2 < n_node; l2++)
183 local_unknown = nodal_local_eqn(l2, u_nodal_index);
185 if (local_unknown >= 0)
188 jacobian(local_eqn, local_unknown) +=
189 alpha_local * test(l) * psi(l2) *
190 node_pt(l2)->time_stepper_pt()->weight(1, 0) *
W;
193 for (
unsigned i = 0;
i < DIM;
i++)
195 double tmp = beta_local * dtestdx(l,
i);
196 if (!ALE_is_disabled)
197 tmp -= alpha_local * mesh_velocity[
i] * test(l);
198 jacobian(local_eqn, local_unknown) += dpsidx(l2,
i) * tmp *
W;
214 template<
unsigned DIM>
227 unsigned n_node = nnode();
232 unsigned n_intpt = integral_pt()->nweight();
235 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
238 for (
unsigned i = 0;
i < DIM;
i++)
240 s[
i] = integral_pt()->knot(ipt,
i);
244 double w = integral_pt()->weight(ipt);
247 double J = J_eulerian(
s);
253 double u = interpolated_u_ust_heat(
s);
263 template<
unsigned DIM>
293 template<
unsigned DIM>
295 const unsigned& nplot)
301 outfile << tecplot_zone_string(nplot);
304 unsigned num_plot_points = nplot_points(nplot);
305 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
308 get_s_plot(iplot, nplot,
s);
310 for (
unsigned i = 0;
i < DIM;
i++)
312 outfile << interpolated_x(
s,
i) <<
" ";
314 outfile << interpolated_u_ust_heat(
s) << std::endl;
318 write_tecplot_zone_footer(outfile, nplot);
329 template<
unsigned DIM>
336 fprintf(file_pt,
"%s", tecplot_zone_string(nplot).c_str());
339 unsigned num_plot_points = nplot_points(nplot);
340 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
343 get_s_plot(iplot, nplot,
s);
345 for (
unsigned i = 0;
i < DIM;
i++)
347 fprintf(file_pt,
"%g ", interpolated_x(
s,
i));
349 fprintf(file_pt,
"%g \n", interpolated_u_ust_heat(
s));
353 write_tecplot_zone_footer(file_pt, nplot);
365 template<
unsigned DIM>
367 std::ostream& outfile,
368 const unsigned& nplot,
378 outfile << tecplot_zone_string(nplot);
384 unsigned num_plot_points = nplot_points(nplot);
385 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
388 get_s_plot(iplot, nplot,
s);
391 interpolated_x(
s, x);
394 (*exact_soln_pt)(x, exact_soln);
397 for (
unsigned i = 0;
i < DIM;
i++)
399 outfile << x[
i] <<
" ";
401 outfile << exact_soln[0] << std::endl;
405 write_tecplot_zone_footer(outfile, nplot);
417 template<
unsigned DIM>
419 std::ostream& outfile,
420 const unsigned& nplot,
433 outfile << tecplot_zone_string(nplot);
439 unsigned num_plot_points = nplot_points(nplot);
440 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
443 get_s_plot(iplot, nplot,
s);
446 interpolated_x(
s, x);
449 (*exact_soln_pt)(time, x, exact_soln);
452 for (
unsigned i = 0;
i < DIM;
i++)
454 outfile << x[
i] <<
" ";
456 outfile << exact_soln[0] << std::endl;
460 write_tecplot_zone_footer(outfile, nplot);
471 template<
unsigned DIM>
473 std::ostream& outfile,
489 unsigned n_node = nnode();
494 unsigned n_intpt = integral_pt()->nweight();
497 outfile <<
"ZONE" << std::endl;
503 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
506 for (
unsigned i = 0;
i < DIM;
i++)
508 s[
i] = integral_pt()->knot(ipt,
i);
512 double w = integral_pt()->weight(ipt);
515 double J = J_eulerian(
s);
521 interpolated_x(
s, x);
524 double u_fe = interpolated_u_ust_heat(
s);
527 (*exact_soln_pt)(x, exact_soln);
530 for (
unsigned i = 0;
i < DIM;
i++)
532 outfile << x[
i] <<
" ";
534 outfile << exact_soln[0] <<
" " << exact_soln[0] - u_fe << std::endl;
537 norm += exact_soln[0] * exact_soln[0] *
W;
538 error += (exact_soln[0] - u_fe) * (exact_soln[0] - u_fe) *
W;
550 template<
unsigned DIM>
552 std::ostream& outfile,
571 unsigned n_node = nnode();
576 unsigned n_intpt = integral_pt()->nweight();
579 outfile <<
"ZONE" << std::endl;
585 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
588 for (
unsigned i = 0;
i < DIM;
i++)
590 s[
i] = integral_pt()->knot(ipt,
i);
594 double w = integral_pt()->weight(ipt);
597 double J = J_eulerian(
s);
603 interpolated_x(
s, x);
606 double u_fe = interpolated_u_ust_heat(
s);
609 (*exact_soln_pt)(time, x, exact_soln);
612 for (
unsigned i = 0;
i < DIM;
i++)
614 outfile << x[
i] <<
" ";
616 outfile << exact_soln[0] <<
" " << exact_soln[0] - u_fe << std::endl;
619 norm += exact_soln[0] * exact_soln[0] *
W;
620 error += (exact_soln[0] - u_fe) * (exact_soln[0] - u_fe) *
W;
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as .
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
virtual unsigned self_test()
Self-test: Check inversion of element & do self-test for GeneralisedElement. Return 0 if OK.
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
void compute_norm(double &norm)
Compute norm of fe solution.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
void output(std::ostream &outfile)
Output with default number of plot points.
unsigned self_test()
Self-test: Return 0 for OK.
static double Default_beta_parameter
Static default value for the Beta parameter (thermal conductivity): One for natural scaling.
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.
virtual void fill_in_generic_residual_contribution_ust_heat(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
static double Default_alpha_parameter
Static default value for the Alpha parameter: (thermal inertia): One for natural scaling.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...