93 template <
unsigned DIM>
100 unsigned n_node = nnode();
103 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
106 unsigned u_nodal_index = u_index_lin_wave();
109 Shape psi(n_node), test(n_node);
110 DShape dpsidx(n_node,DIM), dtestdx(n_node,DIM);
113 unsigned n_intpt = integral_pt()->nweight();
119 int local_eqn=0, local_unknown=0;
122 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
126 for(
unsigned i=0;
i<DIM;
i++) s[
i] = integral_pt()->knot(ipt,
i);
129 double w = integral_pt()->weight(ipt);
133 dshape_and_dtest_eulerian_at_knot_lin_wave(ipt,psi,dpsidx,test,dtestdx);
139 double interpolated_u=0.0;
146 for(
unsigned l=0;l<n_node;l++)
149 double u_value = raw_nodal_value(l,u_nodal_index);
150 interpolated_u += u_value*psi(l);
151 ddudt += d2u_dt2_lin_wave(l)*psi(l);
153 for(
unsigned j=0;j<DIM;j++)
155 interpolated_x[j] += raw_nodal_position(l,j)*psi(l);
156 interpolated_dudx[j] += u_value*dpsidx(l,j);
164 get_source_lin_wave(time,ipt,interpolated_x,source);
170 for(
unsigned l=0;l<n_node;l++)
172 local_eqn = nodal_local_eqn(l,u_nodal_index);
178 residuals[local_eqn] += (ddudt+source)*test(l)*
W;
181 for(
unsigned k=0;k<DIM;k++)
183 residuals[local_eqn] +=
184 interpolated_dudx[k]*dtestdx(l,k)*
W;
193 for(
unsigned l2=0;l2<n_node;l2++)
195 local_unknown = nodal_local_eqn(l2,u_nodal_index);
197 if(local_unknown >= 0)
200 jacobian(local_eqn,local_unknown)
201 += test(l)*psi(l2)*node_pt(l2)->time_stepper_pt()->weight(2,0)*
W;
204 for(
unsigned i=0;
i<DIM;
i++)
206 jacobian(local_eqn,local_unknown)
207 += dpsidx(l2,
i)*dtestdx(l,
i)*
W;
225 template <
unsigned DIM>
258 template <
unsigned DIM>
260 const unsigned &nplot)
266 outfile << tecplot_zone_string(nplot);
269 unsigned num_plot_points=nplot_points(nplot);
270 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
273 get_s_plot(iplot,nplot,s);
274 for(
unsigned i=0;
i<DIM;
i++)
276 outfile << interpolated_x(s,
i) <<
" ";
278 outfile << interpolated_u_lin_wave(s) <<
" ";
279 outfile << interpolated_du_dt_lin_wave(s) <<
" ";
280 outfile << interpolated_d2u_dt2_lin_wave(s) << std::endl;
284 write_tecplot_zone_footer(outfile,nplot);
295 template <
unsigned DIM>
297 const unsigned &nplot)
303 fprintf(file_pt,
"%s",tecplot_zone_string(nplot).c_str());
306 unsigned num_plot_points=nplot_points(nplot);
307 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
310 get_s_plot(iplot,nplot,s);
312 for(
unsigned i=0;
i<DIM;
i++)
315 fprintf(file_pt,
"%g ",interpolated_x(s,
i));
318 fprintf(file_pt,
"%g \n",interpolated_u_lin_wave(s));
322 write_tecplot_zone_footer(file_pt,nplot);
336 template <
unsigned DIM>
338 std::ostream &outfile,
const unsigned &nplot,
348 outfile << tecplot_zone_string(nplot);
354 unsigned num_plot_points=nplot_points(nplot);
355 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
358 get_s_plot(iplot,nplot,s);
364 (*exact_soln_pt)(x,exact_soln);
367 for(
unsigned i=0;
i<DIM;
i++)
369 outfile << x[
i] <<
" ";
371 outfile << exact_soln[0] << std::endl;
376 write_tecplot_zone_footer(outfile,nplot);
389 template <
unsigned DIM>
391 std::ostream &outfile,
const unsigned &nplot,
const double& time,
402 outfile << tecplot_zone_string(nplot);
408 unsigned num_plot_points=nplot_points(nplot);
409 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
413 get_s_plot(iplot,nplot,s);
419 (*exact_soln_pt)(time,x,exact_soln);
422 for(
unsigned i=0;
i<DIM;
i++)
424 outfile << x[
i] <<
" ";
426 outfile << exact_soln[0] <<
" " 427 << exact_soln[1] <<
" " 428 << exact_soln[2] <<
" " 433 write_tecplot_zone_footer(outfile,nplot);
446 template <
unsigned DIM>
448 std::ostream &outfile,
450 double& error,
double& norm)
465 unsigned n_node = nnode();
470 unsigned n_intpt = integral_pt()->nweight();
473 outfile <<
"ZONE" << std::endl;
479 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);
501 double u_fe=interpolated_u_lin_wave(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;
529 template <
unsigned DIM>
531 std::ostream &outfile,
533 const double& time,
double& error,
double& norm)
548 unsigned n_node = nnode();
553 unsigned n_intpt = integral_pt()->nweight();
556 outfile <<
"ZONE" << std::endl;
562 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
566 for(
unsigned i=0;
i<DIM;
i++)
568 s[
i] = integral_pt()->knot(ipt,
i);
572 double w = integral_pt()->weight(ipt);
575 double J=J_eulerian(s);
584 double u_fe=interpolated_u_lin_wave(s);
587 (*exact_soln_pt)(time,x,exact_soln);
590 for(
unsigned i=0;
i<DIM;
i++)
592 outfile << x[
i] <<
" ";
594 outfile << exact_soln[0] <<
" " << exact_soln[0]-u_fe << std::endl;
597 norm+=exact_soln[0]*exact_soln[0]*
W;
598 error+=(exact_soln[0]-u_fe)*(exact_soln[0]-u_fe)*
W;
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.
virtual unsigned self_test()
Self-test: Check inversion of element & do self-test for GeneralisedElement. Return 0 if OK...
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
void output(std::ostream &outfile)
Output with default number of plot points.
unsigned self_test()
Self-test: Return 0 for OK.
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_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.