34 template<
unsigned DIM>
54 template<
unsigned DIM,
unsigned NNODE_1D>
66 template<
unsigned DIM>
71 unsigned n_node = nnode();
74 unsigned u_nodal_index = u_index_womersley();
77 Shape psi(n_node), test(n_node);
78 DShape dpsidx(n_node, DIM), dtestdx(n_node, DIM);
81 unsigned n_intpt = integral_pt()->nweight();
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_womersley(
100 ipt, psi, dpsidx, test, dtestdx);
106 double interpolated_u = 0.0;
113 for (
unsigned l = 0; l < n_node; l++)
116 double u_value = raw_nodal_value(l, u_nodal_index);
117 interpolated_u += u_value * psi(l);
118 dudt += du_dt_womersley(l) * psi(l);
120 for (
unsigned j = 0; j < DIM; j++)
122 interpolated_x[j] += raw_nodal_position(l, j) * psi(l);
123 interpolated_dudx[j] += u_value * dpsidx(l, j);
132 if (Pressure_gradient_data_pt == 0)
139 dpdz = Pressure_gradient_data_pt->value(0);
147 for (
unsigned l = 0; l < n_node; l++)
149 local_eqn = nodal_local_eqn(l, u_nodal_index);
154 residuals[local_eqn] += (re_st() * dudt + dpdz) * test(l) *
W;
157 for (
unsigned k = 0; k < DIM; k++)
159 residuals[local_eqn] += interpolated_dudx[k] * dtestdx(l, k) *
W;
168 for (
unsigned l2 = 0; l2 < n_node; l2++)
170 local_unknown = nodal_local_eqn(l2, u_nodal_index);
172 if (local_unknown >= 0)
175 jacobian(local_eqn, local_unknown) +=
176 re_st() * test(l) * psi(l2) *
177 node_pt(l2)->time_stepper_pt()->weight(1, 0) *
W;
180 for (
unsigned i = 0;
i < DIM;
i++)
182 double tmp = dtestdx(l,
i);
183 jacobian(local_eqn, local_unknown) += dpsidx(l2,
i) * tmp *
W;
190 if ((Pressure_gradient_data_pt != 0) &&
191 (!Pressure_gradient_data_pt->is_pinned(0)))
193 local_unknown = external_local_eqn(0, 0);
194 if (local_unknown >= 0)
196 jacobian(local_eqn, local_unknown) += test(l) *
W;
201 unsigned final_local_eqn = external_local_eqn(0, 0);
202 unsigned local_unknown = local_eqn;
204 jacobian(final_local_eqn, local_unknown) += psi(l) *
W;
218 template<
unsigned DIM>
222 unsigned n_node = nnode();
225 unsigned u_nodal_index = u_index_womersley();
229 DShape dpsidx(n_node, DIM);
232 unsigned n_intpt = integral_pt()->nweight();
241 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
244 for (
unsigned i = 0;
i < DIM;
i++)
s[
i] = integral_pt()->knot(ipt,
i);
247 double w = integral_pt()->weight(ipt);
250 double J = dshape_eulerian_at_knot(ipt, psi, dpsidx);
256 double interpolated_u = 0.0;
261 for (
unsigned l = 0; l < n_node; l++)
265 interpolated_u += nodal_value(l, u_nodal_index) * psi(l);
269 flux += interpolated_u *
W;
280 template<
unsigned DIM>
307 template<
unsigned DIM>
309 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 << z_out <<
" 0.0 0.0 ";
330 outfile << interpolated_u_womersley(
s);
331 outfile <<
" 0.0 " << std::endl;
335 write_tecplot_zone_footer(outfile, nplot);
345 template<
unsigned DIM>
347 const unsigned& nplot)
353 outfile << tecplot_zone_string(nplot);
356 unsigned num_plot_points = nplot_points(nplot);
357 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
360 get_s_plot(iplot, nplot,
s);
362 for (
unsigned i = 0;
i < DIM;
i++)
364 outfile << interpolated_x(
s,
i) <<
" ";
366 outfile << interpolated_u_womersley(
s) << std::endl;
370 write_tecplot_zone_footer(outfile, nplot);
381 template<
unsigned DIM>
388 fprintf(file_pt,
"%s", tecplot_zone_string(nplot).c_str());
391 unsigned num_plot_points = nplot_points(nplot);
392 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
395 get_s_plot(iplot, nplot,
s);
397 for (
unsigned i = 0;
i < DIM;
i++)
399 fprintf(file_pt,
"%g ", interpolated_x(
s,
i));
401 fprintf(file_pt,
"%g \n", interpolated_u_womersley(
s));
405 write_tecplot_zone_footer(file_pt, nplot);
417 template<
unsigned DIM>
419 std::ostream& outfile,
420 const unsigned& nplot,
430 outfile << tecplot_zone_string(nplot);
436 unsigned num_plot_points = nplot_points(nplot);
437 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
440 get_s_plot(iplot, nplot,
s);
443 interpolated_x(
s, x);
446 (*exact_soln_pt)(x, exact_soln);
449 for (
unsigned i = 0;
i < DIM;
i++)
451 outfile << x[
i] <<
" ";
453 outfile << exact_soln[0] << std::endl;
457 write_tecplot_zone_footer(outfile, nplot);
469 template<
unsigned DIM>
471 std::ostream& outfile,
472 const unsigned& nplot,
485 outfile << tecplot_zone_string(nplot);
491 unsigned num_plot_points = nplot_points(nplot);
492 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
495 get_s_plot(iplot, nplot,
s);
498 interpolated_x(
s, x);
501 (*exact_soln_pt)(time, x, exact_soln);
504 for (
unsigned i = 0;
i < DIM;
i++)
506 outfile << x[
i] <<
" ";
508 outfile << exact_soln[0] << std::endl;
512 write_tecplot_zone_footer(outfile, nplot);
523 template<
unsigned DIM>
525 std::ostream& outfile,
541 unsigned n_node = nnode();
546 unsigned n_intpt = integral_pt()->nweight();
549 outfile <<
"ZONE" << std::endl;
555 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
558 for (
unsigned i = 0;
i < DIM;
i++)
560 s[
i] = integral_pt()->knot(ipt,
i);
564 double w = integral_pt()->weight(ipt);
567 double J = J_eulerian(
s);
573 interpolated_x(
s, x);
576 double u_fe = interpolated_u_womersley(
s);
579 (*exact_soln_pt)(x, exact_soln);
582 for (
unsigned i = 0;
i < DIM;
i++)
584 outfile << x[
i] <<
" ";
586 outfile << exact_soln[0] <<
" " << exact_soln[0] - u_fe << std::endl;
589 norm += exact_soln[0] * exact_soln[0] *
W;
590 error += (exact_soln[0] - u_fe) * (exact_soln[0] - u_fe) *
W;
602 template<
unsigned DIM>
604 std::ostream& outfile,
623 unsigned n_node = nnode();
628 unsigned n_intpt = integral_pt()->nweight();
631 outfile <<
"ZONE" << std::endl;
637 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
640 for (
unsigned i = 0;
i < DIM;
i++)
642 s[
i] = integral_pt()->knot(ipt,
i);
646 double w = integral_pt()->weight(ipt);
649 double J = J_eulerian(
s);
655 interpolated_x(
s, x);
658 double u_fe = interpolated_u_womersley(
s);
661 (*exact_soln_pt)(time, x, exact_soln);
664 for (
unsigned i = 0;
i < DIM;
i++)
666 outfile << x[
i] <<
" ";
668 outfile << exact_soln[0] <<
" " << exact_soln[0] - u_fe << std::endl;
671 norm += exact_soln[0] * exact_soln[0] *
W;
672 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...
static bool Suppress_warning_about_unpinned_nst_dofs
Static bool to suppress warning.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
virtual void fill_in_generic_residual_contribution_womersley(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
void output(std::ostream &outfile)
Output with default number of plot points.
static double Default_ReSt_value
Static default value for the Womersley number.
double get_volume_flux()
Compute total volume flux through element.
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 output_3d(std::ostream &outfile, const unsigned &n_plot, const double &z_out)
Output function: x,y,z_out,0,0,u,0 to allow comparison against full Navier Stokes at n_nplot x n_plot...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...