41 template<
unsigned DIM>
45 template<
unsigned DIM>
52 template<
unsigned DIM,
unsigned NNODE_1D>
63 template <
unsigned DIM>
70 unsigned n_node = nnode();
73 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
76 unsigned u_nodal_index = u_index_ust_heat();
79 Shape psi(n_node), test(n_node);
80 DShape dpsidx(n_node,DIM), dtestdx(n_node,DIM);
83 unsigned n_intpt = integral_pt()->nweight();
89 double alpha_local = alpha();
90 double beta_local = beta();
93 int local_eqn=0, local_unknown=0;
96 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
100 for(
unsigned i=0;
i<DIM;
i++) s[
i] = integral_pt()->knot(ipt,
i);
103 double w = integral_pt()->weight(ipt);
107 dshape_and_dtest_eulerian_at_knot_ust_heat(ipt,psi,dpsidx,test,dtestdx);
113 double interpolated_u=0.0;
121 for(
unsigned l=0;l<n_node;l++)
124 double u_value = raw_nodal_value(l,u_nodal_index);
125 interpolated_u += u_value*psi(l);
126 dudt += du_dt_ust_heat(l)*psi(l);
128 for(
unsigned j=0;j<DIM;j++)
130 interpolated_x[j] += raw_nodal_position(l,j)*psi(l);
131 interpolated_dudx[j] += u_value*dpsidx(l,j);
138 for(
unsigned l=0;l<n_node;l++)
140 for(
unsigned j=0;j<DIM;j++)
142 mesh_velocity[j] += raw_dnodal_position_dt(l,j)*psi(l);
150 get_source_ust_heat(time,ipt,interpolated_x,source);
156 for(
unsigned l=0;l<n_node;l++)
158 local_eqn = nodal_local_eqn(l,u_nodal_index);
164 residuals[local_eqn] += (alpha_local*dudt+source)*test(l)*
W;
169 for(
unsigned k=0;k<DIM;k++)
171 residuals[local_eqn] -= alpha_local*
172 mesh_velocity[k]*interpolated_dudx[k]*test(l)*
W;
177 for(
unsigned k=0;k<DIM;k++)
179 residuals[local_eqn] += beta_local*
180 interpolated_dudx[k]*dtestdx(l,k)*
W;
189 for(
unsigned l2=0;l2<n_node;l2++)
191 local_unknown = nodal_local_eqn(l2,u_nodal_index);
193 if(local_unknown >= 0)
196 jacobian(local_eqn,local_unknown)
197 += alpha_local*test(l)*psi(l2)*
198 node_pt(l2)->time_stepper_pt()->weight(1,0)*
W;
201 for(
unsigned i=0;
i<DIM;
i++)
203 double tmp=beta_local*dtestdx(l,
i);
205 jacobian(local_eqn,local_unknown) +=
223 template <
unsigned DIM>
237 unsigned n_node = nnode();
242 unsigned n_intpt = integral_pt()->nweight();
245 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
249 for(
unsigned i=0;
i<DIM;
i++)
251 s[
i] = integral_pt()->knot(ipt,
i);
255 double w = integral_pt()->weight(ipt);
258 double J=J_eulerian(s);
264 double u=interpolated_u_ust_heat(s);
275 template <
unsigned DIM>
308 template <
unsigned DIM>
310 const unsigned &nplot)
316 outfile << tecplot_zone_string(nplot);
319 unsigned num_plot_points=nplot_points(nplot);
320 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
323 get_s_plot(iplot,nplot,s);
325 for(
unsigned i=0;
i<DIM;
i++)
327 outfile << interpolated_x(s,
i) <<
" ";
329 outfile << interpolated_u_ust_heat(s) << std::endl;
333 write_tecplot_zone_footer(outfile,nplot);
346 template <
unsigned DIM>
348 const unsigned &nplot)
354 fprintf(file_pt,
"%s",tecplot_zone_string(nplot).c_str());
357 unsigned num_plot_points=nplot_points(nplot);
358 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
362 get_s_plot(iplot,nplot,s);
364 for(
unsigned i=0;
i<DIM;
i++)
366 fprintf(file_pt,
"%g ",interpolated_x(s,
i));
369 fprintf(file_pt,
"%g \n",interpolated_u_ust_heat(s));
373 write_tecplot_zone_footer(file_pt,nplot);
387 template <
unsigned DIM>
389 const unsigned &nplot,
400 outfile << tecplot_zone_string(nplot);
406 unsigned num_plot_points=nplot_points(nplot);
407 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
411 get_s_plot(iplot,nplot,s);
417 (*exact_soln_pt)(x,exact_soln);
420 for(
unsigned i=0;
i<DIM;
i++)
422 outfile << x[
i] <<
" ";
424 outfile << exact_soln[0] << std::endl;
429 write_tecplot_zone_footer(outfile,nplot);
443 template <
unsigned DIM>
445 const unsigned &nplot,
459 outfile << tecplot_zone_string(nplot);
465 unsigned num_plot_points=nplot_points(nplot);
466 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
470 get_s_plot(iplot,nplot,s);
476 (*exact_soln_pt)(time,x,exact_soln);
479 for(
unsigned i=0;
i<DIM;
i++)
481 outfile << x[
i] <<
" ";
483 outfile << exact_soln[0] << std::endl;
488 write_tecplot_zone_footer(outfile,nplot);
501 template <
unsigned DIM>
504 double& error,
double& norm)
518 unsigned n_node = nnode();
523 unsigned n_intpt = integral_pt()->nweight();
526 outfile <<
"ZONE" << std::endl;
532 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
536 for(
unsigned i=0;
i<DIM;
i++)
538 s[
i] = integral_pt()->knot(ipt,
i);
542 double w = integral_pt()->weight(ipt);
545 double J=J_eulerian(s);
554 double u_fe = interpolated_u_ust_heat(s);
557 (*exact_soln_pt)(x,exact_soln);
560 for(
unsigned i=0;
i<DIM;
i++)
562 outfile << x[
i] <<
" ";
564 outfile << exact_soln[0] <<
" " << exact_soln[0]-u_fe << std::endl;
567 norm+=exact_soln[0]*exact_soln[0]*
W;
568 error+=(exact_soln[0]-u_fe)*(exact_soln[0]-u_fe)*
W;
582 template<
unsigned DIM>
585 const double& time,
double& error,
double& norm)
601 unsigned n_node = nnode();
606 unsigned n_intpt = integral_pt()->nweight();
609 outfile <<
"ZONE" << std::endl;
615 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
619 for(
unsigned i=0;
i<DIM;
i++)
621 s[
i] = integral_pt()->knot(ipt,
i);
625 double w = integral_pt()->weight(ipt);
628 double J=J_eulerian(s);
637 double u_fe = interpolated_u_ust_heat(s);
640 (*exact_soln_pt)(time,x,exact_soln);
643 for(
unsigned i=0;
i<DIM;
i++)
645 outfile << x[
i] <<
" ";
647 outfile << exact_soln[0] <<
" " << exact_soln[0]-u_fe << std::endl;
650 norm+=exact_soln[0]*exact_soln[0]*
W;
651 error+=(exact_soln[0]-u_fe)*(exact_soln[0]-u_fe)*
W;
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
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_norm(double &norm)
Compute norm of fe solution.
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 ...
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(std::ostream &outfile)
Output with default number of plot points.
static double Default_alpha_parameter
Static default value for the Alpha parameter: (thermal inertia): One for natural scaling.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
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.