39 template<
unsigned SPATIAL_DIM>
40 double SpaceTimeUnsteadyHeatMixedOrderEquations<
41 SPATIAL_DIM>::Default_alpha_parameter = 1.0;
44 template<
unsigned SPATIAL_DIM>
45 double SpaceTimeUnsteadyHeatMixedOrderEquations<
46 SPATIAL_DIM>::Default_beta_parameter = 1.0;
51 template<
unsigned SPATIAL_DIM,
unsigned NNODE_1D>
53 QUnsteadyHeatMixedOrderSpaceTimeElement<SPATIAL_DIM,
54 NNODE_1D>::Initial_Nvalue = 1;
64 template<
unsigned SPATIAL_DIM>
72 unsigned n_node = nnode();
75 unsigned u_nodal_index = u_index_ust_heat();
84 DShape dpsidx(n_node, SPATIAL_DIM + 1);
87 DShape dtestdx(n_node, SPATIAL_DIM + 1);
90 unsigned n_intpt = integral_pt()->nweight();
96 double alpha_local = alpha();
99 double beta_local = beta();
105 int local_unknown = 0;
108 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
111 for (
unsigned i = 0;
i < SPATIAL_DIM + 1;
i++)
114 s[
i] = integral_pt()->knot(ipt,
i);
118 double w = integral_pt()->weight(ipt);
121 double J = dshape_and_dtest_eulerian_at_knot_ust_heat(
122 ipt, psi, dpsidx, test, dtestdx);
128 double interpolated_t = 0.0;
131 double interpolated_u = 0.0;
134 double interpolated_dudt = 0.0;
149 for (
unsigned l = 0; l < n_node; l++)
152 double u_value = raw_nodal_value(l, u_nodal_index);
155 interpolated_t += raw_nodal_position(l, SPATIAL_DIM) * psi(l);
158 for (
unsigned j = 0; j < SPATIAL_DIM; j++)
161 interpolated_x[j] += raw_nodal_position(l, j) * psi(l);
164 interpolated_dudx[j] += u_value * dpsidx(l, j);
168 interpolated_u += u_value * psi(l);
171 interpolated_dudt += u_value * dpsidx(l, SPATIAL_DIM);
178 get_source_ust_heat(interpolated_t, ipt, interpolated_x, source);
184 for (
unsigned l = 0; l < n_node; l++)
187 local_eqn = nodal_local_eqn(l, u_nodal_index);
193 residuals[local_eqn] +=
194 (source + alpha_local * interpolated_dudt) * test(l) *
W;
197 for (
unsigned k = 0; k < SPATIAL_DIM; k++)
200 residuals[local_eqn] +=
201 beta_local * interpolated_dudx[k] * dtestdx(l, k) *
W;
211 for (
unsigned l2 = 0; l2 < n_node; l2++)
214 local_unknown = nodal_local_eqn(l2, u_nodal_index);
217 if (local_unknown >= 0)
220 jacobian(local_eqn, local_unknown) +=
221 (alpha_local * test(l) * dpsidx(l2, SPATIAL_DIM) *
W);
224 for (
unsigned i = 0;
i < SPATIAL_DIM;
i++)
227 jacobian(local_eqn, local_unknown) +=
228 (beta_local * dpsidx(l2,
i) * dtestdx(l,
i) *
W);
242 template<
unsigned SPATIAL_DIM>
256 unsigned n_intpt = integral_pt()->nweight();
259 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
262 for (
unsigned i = 0;
i < SPATIAL_DIM + 1;
i++)
265 s[
i] = integral_pt()->knot(ipt,
i);
269 double w = integral_pt()->weight(ipt);
272 double J = J_eulerian(
s);
278 double u = interpolated_u_ust_heat(
s);
289 template<
unsigned SPATIAL_DIM>
322 template<
unsigned SPATIAL_DIM>
324 std::ostream& outfile,
const unsigned& nplot)
330 outfile << tecplot_zone_string(nplot);
333 unsigned num_plot_points = nplot_points(nplot);
336 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
339 get_s_plot(iplot, nplot,
s);
342 for (
unsigned i = 0;
i < SPATIAL_DIM + 1;
i++)
345 outfile << interpolated_x(
s,
i) <<
" ";
349 outfile << interpolated_u_ust_heat(
s) << std::endl;
353 write_tecplot_zone_footer(outfile, nplot);
362 template<
unsigned SPATIAL_DIM>
364 FILE* file_pt,
const unsigned& nplot)
370 fprintf(file_pt,
"%s", tecplot_zone_string(nplot).c_str());
373 unsigned num_plot_points = nplot_points(nplot);
376 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
379 get_s_plot(iplot, nplot,
s);
382 for (
unsigned i = 0;
i < SPATIAL_DIM + 1;
i++)
385 fprintf(file_pt,
"%g ", interpolated_x(
s,
i));
389 fprintf(file_pt,
"%g \n", interpolated_u_ust_heat(
s));
393 write_tecplot_zone_footer(file_pt, nplot);
402 template<
unsigned SPATIAL_DIM>
404 std::ostream& outfile,
405 const unsigned& nplot,
415 outfile << tecplot_zone_string(nplot);
421 unsigned num_plot_points = nplot_points(nplot);
424 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
427 get_s_plot(iplot, nplot,
s);
430 for (
unsigned i = 0;
i < SPATIAL_DIM;
i++)
433 spatial_coordinates[
i] = interpolated_x(
s,
i);
436 outfile << spatial_coordinates[
i] <<
" ";
440 outfile << interpolated_x(
s, SPATIAL_DIM) <<
" ";
443 (*exact_soln_pt)(spatial_coordinates, exact_soln);
446 outfile << exact_soln[0] << std::endl;
450 write_tecplot_zone_footer(outfile, nplot);
459 template<
unsigned SPATIAL_DIM>
461 std::ostream& outfile,
462 const unsigned& nplot,
467 double interpolated_t = 0.0;
476 outfile << tecplot_zone_string(nplot);
482 unsigned num_plot_points = nplot_points(nplot);
485 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
488 get_s_plot(iplot, nplot,
s);
491 for (
unsigned i = 0;
i < SPATIAL_DIM;
i++)
494 spatial_coordinates[
i] = interpolated_x(
s,
i);
497 outfile << spatial_coordinates[
i] <<
" ";
501 interpolated_t = interpolated_x(
s, SPATIAL_DIM);
504 outfile << interpolated_t <<
" ";
507 (*exact_soln_pt)(interpolated_t, spatial_coordinates, exact_soln);
510 outfile << exact_soln[0] << std::endl;
514 write_tecplot_zone_footer(outfile, nplot);
524 template<
unsigned SPATIAL_DIM>
526 std::ostream& outfile,
544 unsigned n_intpt = integral_pt()->nweight();
547 outfile <<
"ZONE" << std::endl;
553 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
556 for (
unsigned i = 0;
i < SPATIAL_DIM + 1;
i++)
559 s[
i] = integral_pt()->knot(ipt,
i);
563 double w = integral_pt()->weight(ipt);
566 double J = J_eulerian(
s);
572 double u_fe = interpolated_u_ust_heat(
s);
575 for (
unsigned i = 0;
i < SPATIAL_DIM;
i++)
578 spatial_coordinates[
i] = interpolated_x(
s,
i);
581 outfile << spatial_coordinates[
i] <<
" ";
585 outfile << interpolated_x(
s, SPATIAL_DIM) <<
" ";
588 (*exact_soln_pt)(spatial_coordinates, exact_soln);
591 outfile << exact_soln[0] <<
" " << exact_soln[0] - u_fe << std::endl;
594 norm += exact_soln[0] * exact_soln[0] *
W;
597 error += (exact_soln[0] - u_fe) * (exact_soln[0] - u_fe) *
W;
608 template<
unsigned SPATIAL_DIM>
610 std::ostream& outfile,
623 double interpolated_t = 0.0;
632 unsigned n_int_pt = integral_pt()->nweight();
638 for (
unsigned ipt = 0; ipt < n_int_pt; ipt++)
641 for (
unsigned i = 0;
i < SPATIAL_DIM + 1;
i++)
643 s[
i] = integral_pt()->knot(ipt,
i);
647 double w = integral_pt()->weight(ipt);
650 double J = J_eulerian(
s);
656 double u_fe = interpolated_u_ust_heat(
s);
659 for (
unsigned i = 0;
i < SPATIAL_DIM;
i++)
662 spatial_coordinates[
i] = interpolated_x(
s,
i);
666 interpolated_t = interpolated_x(
s, SPATIAL_DIM);
669 (*exact_soln_pt)(interpolated_t, spatial_coordinates, exact_soln);
672 norm += exact_soln[0] * exact_soln[0] *
W;
675 error += (exact_soln[0] - u_fe) * (exact_soln[0] - u_fe) *
W;
682 outfile << tecplot_zone_string(n_plot);
685 unsigned num_plot_points = nplot_points(n_plot);
688 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
691 get_s_plot(iplot, n_plot,
s);
694 for (
unsigned i = 0;
i < SPATIAL_DIM;
i++)
697 spatial_coordinates[
i] = interpolated_x(
s,
i);
700 outfile << spatial_coordinates[
i] <<
" ";
704 interpolated_t = interpolated_x(
s, SPATIAL_DIM);
707 double u_fe = interpolated_u_ust_heat(
s);
710 outfile << interpolated_t <<
" ";
713 (*exact_soln_pt)(interpolated_t, spatial_coordinates, exact_soln);
716 outfile << exact_soln[0] - u_fe << std::endl;
720 write_tecplot_zone_footer(outfile, n_plot);
729 template<
unsigned SPATIAL_DIM>
731 SPATIAL_DIM>::output_element_paraview(std::ofstream& file_out,
732 const unsigned& nplot)
735 file_out.setf(std::ios_base::uppercase);
738 unsigned number_of_nodes = this->nplot_points_paraview(nplot);
741 unsigned total_number_of_elements = this->nsub_elements_paraview(nplot);
748 file_out <<
"<?xml version=\"1.0\"?>\n"
749 <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" "
750 <<
"byte_order=\"LittleEndian\">\n"
751 <<
"<UnstructuredGrid>\n"
752 <<
"<Piece NumberOfPoints=\"" << number_of_nodes
753 <<
"\" NumberOfCells=\"" << total_number_of_elements <<
"\">\n";
759 unsigned ndof = this->nscalar_paraview();
762 file_out <<
"<PointData ";
767 file_out <<
"Scalars=\"" << this->scalar_name_paraview(0) <<
"\">\n";
770 for (
unsigned i = 0;
i < ndof;
i++)
772 file_out <<
"<DataArray type=\"Float32\" "
773 <<
"Name=\"" << this->scalar_name_paraview(
i) <<
"\" "
774 <<
"format=\"ascii\""
778 this->scalar_value_paraview(file_out,
i, nplot);
781 file_out <<
"</DataArray>\n";
785 file_out <<
"</PointData>\n";
791 file_out <<
"<Points>\n"
792 <<
"<DataArray type=\"Float32\""
793 <<
" NumberOfComponents=\"" << 3 <<
"\" "
794 <<
"format=\"ascii\">\n";
797 this->output_paraview(file_out, nplot);
800 file_out <<
"</DataArray>\n"
806 file_out <<
"<Cells>\n"
807 <<
"<DataArray type=\"Int32\" Name=\""
808 <<
"connectivity\" format=\"ascii\">\n";
812 unsigned counter = 0;
815 this->write_paraview_output_offset_information(file_out, nplot, counter);
818 file_out <<
"</DataArray>\n"
819 <<
"<DataArray type=\"Int32\" "
820 <<
"Name=\"offsets\" format=\"ascii\">\n";
823 unsigned offset_sum = 0;
826 this->write_paraview_offsets(file_out, nplot, offset_sum);
829 file_out <<
"</DataArray>\n"
830 <<
"<DataArray type=\"UInt8\" Name=\"types\">\n";
833 this->write_paraview_type(file_out, nplot);
836 file_out <<
"</DataArray>\n"
842 file_out <<
"</Piece>\n"
843 <<
"</UnstructuredGrid>\n"
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.
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
A class for all isoparametric elements that solve the SpaceTimeUnsteadyHeatMixedOrder equations.
unsigned self_test()
Self-test: Return 0 for OK.
void compute_norm(double &norm)
Compute norm of FE solution.
void output(std::ostream &outfile)
Output with default number of plot points.
virtual void fill_in_generic_residual_contribution_ust_heat(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error and norm against 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^SPATIAL_DIM plot points.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...