49 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
52 1, 1, 1, 1, 1, 1, 1, 1, 1};
58 1, 1, 1, 1, 1, 1, 1, 1};
61 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
62 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
65 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
66 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
67 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
78 template<
unsigned DIM>
83 unsigned n_node = nnode();
86 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
89 unsigned u_nodal_index = u_index_lin_wave();
92 Shape psi(n_node), test(n_node);
93 DShape dpsidx(n_node, DIM), dtestdx(n_node, DIM);
96 unsigned n_intpt = integral_pt()->nweight();
102 int local_eqn = 0, local_unknown = 0;
105 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
108 for (
unsigned i = 0;
i < DIM;
i++)
s[
i] = integral_pt()->knot(ipt,
i);
111 double w = integral_pt()->weight(ipt);
114 double J = dshape_and_dtest_eulerian_at_knot_lin_wave(
115 ipt, psi, dpsidx, test, dtestdx);
121 double interpolated_u = 0.0;
128 for (
unsigned l = 0; l < n_node; l++)
131 double u_value = raw_nodal_value(l, u_nodal_index);
132 interpolated_u += u_value * psi(l);
133 ddudt += d2u_dt2_lin_wave(l) * psi(l);
135 for (
unsigned j = 0; j < DIM; j++)
137 interpolated_x[j] += raw_nodal_position(l, j) * psi(l);
138 interpolated_dudx[j] += u_value * dpsidx(l, j);
146 get_source_lin_wave(time, ipt, interpolated_x, source);
152 for (
unsigned l = 0; l < n_node; l++)
154 local_eqn = nodal_local_eqn(l, u_nodal_index);
159 residuals[local_eqn] += (ddudt + source) * test(l) *
W;
162 for (
unsigned k = 0; k < DIM; k++)
164 residuals[local_eqn] += interpolated_dudx[k] * dtestdx(l, k) *
W;
173 for (
unsigned l2 = 0; l2 < n_node; l2++)
175 local_unknown = nodal_local_eqn(l2, u_nodal_index);
177 if (local_unknown >= 0)
180 jacobian(local_eqn, local_unknown) +=
182 node_pt(l2)->time_stepper_pt()->weight(2, 0) *
W;
185 for (
unsigned i = 0;
i < DIM;
i++)
187 jacobian(local_eqn, local_unknown) +=
188 dpsidx(l2,
i) * dtestdx(l,
i) *
W;
204 template<
unsigned DIM>
234 template<
unsigned DIM>
236 const unsigned& nplot)
242 outfile << tecplot_zone_string(nplot);
245 unsigned num_plot_points = nplot_points(nplot);
246 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
249 get_s_plot(iplot, nplot,
s);
250 for (
unsigned i = 0;
i < DIM;
i++)
252 outfile << interpolated_x(
s,
i) <<
" ";
254 outfile << interpolated_u_lin_wave(
s) <<
" ";
255 outfile << interpolated_du_dt_lin_wave(
s) <<
" ";
256 outfile << interpolated_d2u_dt2_lin_wave(
s) << std::endl;
260 write_tecplot_zone_footer(outfile, nplot);
270 template<
unsigned DIM>
277 fprintf(file_pt,
"%s", tecplot_zone_string(nplot).c_str());
280 unsigned num_plot_points = nplot_points(nplot);
281 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
284 get_s_plot(iplot, nplot,
s);
286 for (
unsigned i = 0;
i < DIM;
i++)
289 fprintf(file_pt,
"%g ", interpolated_x(
s,
i));
292 fprintf(file_pt,
"%g \n", interpolated_u_lin_wave(
s));
296 write_tecplot_zone_footer(file_pt, nplot);
308 template<
unsigned DIM>
310 std::ostream& outfile,
311 const unsigned& nplot,
321 outfile << tecplot_zone_string(nplot);
327 unsigned num_plot_points = nplot_points(nplot);
328 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
331 get_s_plot(iplot, nplot,
s);
334 interpolated_x(
s, x);
337 (*exact_soln_pt)(x, exact_soln);
340 for (
unsigned i = 0;
i < DIM;
i++)
342 outfile << x[
i] <<
" ";
344 outfile << exact_soln[0] << std::endl;
348 write_tecplot_zone_footer(outfile, nplot);
360 template<
unsigned DIM>
362 std::ostream& outfile,
363 const unsigned& nplot,
374 outfile << tecplot_zone_string(nplot);
380 unsigned num_plot_points = nplot_points(nplot);
381 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
384 get_s_plot(iplot, nplot,
s);
387 interpolated_x(
s, x);
390 (*exact_soln_pt)(time, x, exact_soln);
393 for (
unsigned i = 0;
i < DIM;
i++)
395 outfile << x[
i] <<
" ";
397 outfile << exact_soln[0] <<
" " << exact_soln[1] <<
" " << exact_soln[2]
402 write_tecplot_zone_footer(outfile, nplot);
413 template<
unsigned DIM>
415 std::ostream& outfile,
432 unsigned n_node = nnode();
437 unsigned n_intpt = integral_pt()->nweight();
440 outfile <<
"ZONE" << std::endl;
446 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
449 for (
unsigned i = 0;
i < DIM;
i++)
451 s[
i] = integral_pt()->knot(ipt,
i);
455 double w = integral_pt()->weight(ipt);
458 double J = J_eulerian(
s);
464 interpolated_x(
s, x);
467 double u_fe = interpolated_u_lin_wave(
s);
470 (*exact_soln_pt)(x, exact_soln);
473 for (
unsigned i = 0;
i < DIM;
i++)
475 outfile << x[
i] <<
" ";
477 outfile << exact_soln[0] <<
" " << exact_soln[0] - u_fe << std::endl;
480 norm += exact_soln[0] * exact_soln[0] *
W;
481 error += (exact_soln[0] - u_fe) * (exact_soln[0] - u_fe) *
W;
493 template<
unsigned DIM>
495 std::ostream& outfile,
513 unsigned n_node = nnode();
518 unsigned n_intpt = integral_pt()->nweight();
521 outfile <<
"ZONE" << std::endl;
527 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
530 for (
unsigned i = 0;
i < DIM;
i++)
532 s[
i] = integral_pt()->knot(ipt,
i);
536 double w = integral_pt()->weight(ipt);
539 double J = J_eulerian(
s);
545 interpolated_x(
s, x);
548 double u_fe = interpolated_u_lin_wave(
s);
551 (*exact_soln_pt)(time, x, exact_soln);
554 for (
unsigned i = 0;
i < DIM;
i++)
556 outfile << x[
i] <<
" ";
558 outfile << exact_soln[0] <<
" " << exact_soln[0] - u_fe << std::endl;
561 norm += exact_soln[0] * exact_soln[0] *
W;
562 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.
unsigned self_test()
Self-test: Return 0 for OK.
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.
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.
virtual void fill_in_generic_residual_contribution_lin_wave(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...