40 template<
unsigned DIM>
62 template<
unsigned DIM,
unsigned NNODE_1D>
74 template <
unsigned DIM>
81 unsigned n_node = nnode();
84 unsigned u_nodal_index = u_index_womersley();
87 Shape psi(n_node), test(n_node);
88 DShape dpsidx(n_node,DIM), dtestdx(n_node,DIM);
91 unsigned n_intpt = integral_pt()->nweight();
97 int local_eqn=0, local_unknown=0;
100 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
104 for(
unsigned i=0;
i<DIM;
i++) s[
i] = integral_pt()->knot(ipt,
i);
107 double w = integral_pt()->weight(ipt);
111 dshape_and_dtest_eulerian_at_knot_womersley(ipt,psi,dpsidx,test,dtestdx);
117 double interpolated_u=0.0;
124 for(
unsigned l=0;l<n_node;l++)
127 double u_value = raw_nodal_value(l,u_nodal_index);
128 interpolated_u += u_value*psi(l);
129 dudt += du_dt_womersley(l)*psi(l);
131 for(
unsigned j=0;j<DIM;j++)
133 interpolated_x[j] += raw_nodal_position(l,j)*psi(l);
134 interpolated_dudx[j] += u_value*dpsidx(l,j);
143 if(Pressure_gradient_data_pt==0)
150 dpdz=Pressure_gradient_data_pt->value(0);
158 for(
unsigned l=0;l<n_node;l++)
160 local_eqn = nodal_local_eqn(l,u_nodal_index);
166 residuals[local_eqn] += (re_st()*dudt+dpdz)*test(l)*
W;
169 for(
unsigned k=0;k<DIM;k++)
171 residuals[local_eqn] +=
172 interpolated_dudx[k]*dtestdx(l,k)*
W;
181 for(
unsigned l2=0;l2<n_node;l2++)
183 local_unknown = nodal_local_eqn(l2,u_nodal_index);
185 if(local_unknown >= 0)
188 jacobian(local_eqn,local_unknown)
189 += re_st()*test(l)*psi(l2)*
190 node_pt(l2)->time_stepper_pt()->weight(1,0)*
W;
193 for(
unsigned i=0;
i<DIM;
i++)
195 double tmp=dtestdx(l,
i);
196 jacobian(local_eqn,local_unknown) += dpsidx(l2,
i)*tmp*
W;
203 if ((Pressure_gradient_data_pt!=0)&&
204 (!Pressure_gradient_data_pt->is_pinned(0)))
206 local_unknown=external_local_eqn(0,0);
207 if (local_unknown>=0)
209 jacobian(local_eqn,local_unknown) += test(l)*
W;
214 unsigned final_local_eqn=external_local_eqn(0,0);
215 unsigned local_unknown=local_eqn;
217 jacobian(final_local_eqn,local_unknown)+=psi(l)*
W;
235 template <
unsigned DIM>
239 unsigned n_node = nnode();
242 unsigned u_nodal_index = u_index_womersley();
246 DShape dpsidx(n_node,DIM);
249 unsigned n_intpt = integral_pt()->nweight();
258 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
262 for(
unsigned i=0;
i<DIM;
i++) s[
i] = integral_pt()->knot(ipt,
i);
265 double w = integral_pt()->weight(ipt);
268 double J = dshape_eulerian_at_knot(ipt,psi,dpsidx);
274 double interpolated_u=0.0;
279 for(
unsigned l=0;l<n_node;l++)
283 interpolated_u += nodal_value(l,u_nodal_index)*psi(l);
287 flux+=interpolated_u*
W;
303 template <
unsigned DIM>
334 template <
unsigned DIM>
336 const unsigned &nplot,
343 outfile << tecplot_zone_string(nplot);
346 unsigned num_plot_points=nplot_points(nplot);
347 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
350 get_s_plot(iplot,nplot,s);
352 for(
unsigned i=0;
i<DIM;
i++)
354 outfile << interpolated_x(s,
i) <<
" ";
356 outfile << z_out <<
" 0.0 0.0 " ;
357 outfile << interpolated_u_womersley(s);
358 outfile <<
" 0.0 " << std::endl;
362 write_tecplot_zone_footer(outfile,nplot);
373 template <
unsigned DIM>
375 const unsigned &nplot)
382 outfile << tecplot_zone_string(nplot);
385 unsigned num_plot_points=nplot_points(nplot);
386 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
389 get_s_plot(iplot,nplot,s);
391 for(
unsigned i=0;
i<DIM;
i++)
393 outfile << interpolated_x(s,
i) <<
" ";
395 outfile << interpolated_u_womersley(s) << std::endl;
399 write_tecplot_zone_footer(outfile,nplot);
412 template <
unsigned DIM>
414 const unsigned &nplot)
420 fprintf(file_pt,
"%s",tecplot_zone_string(nplot).c_str());
423 unsigned num_plot_points=nplot_points(nplot);
424 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
428 get_s_plot(iplot,nplot,s);
430 for(
unsigned i=0;
i<DIM;
i++)
432 fprintf(file_pt,
"%g ",interpolated_x(s,
i));
435 fprintf(file_pt,
"%g \n",interpolated_u_womersley(s));
439 write_tecplot_zone_footer(file_pt,nplot);
453 template <
unsigned DIM>
455 const unsigned &nplot,
466 outfile << tecplot_zone_string(nplot);
472 unsigned num_plot_points=nplot_points(nplot);
473 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
477 get_s_plot(iplot,nplot,s);
483 (*exact_soln_pt)(x,exact_soln);
486 for(
unsigned i=0;
i<DIM;
i++)
488 outfile << x[
i] <<
" ";
490 outfile << exact_soln[0] << std::endl;
495 write_tecplot_zone_footer(outfile,nplot);
509 template <
unsigned DIM>
511 const unsigned &nplot,
525 outfile << tecplot_zone_string(nplot);
531 unsigned num_plot_points=nplot_points(nplot);
532 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
536 get_s_plot(iplot,nplot,s);
542 (*exact_soln_pt)(time,x,exact_soln);
545 for(
unsigned i=0;
i<DIM;
i++)
547 outfile << x[
i] <<
" ";
549 outfile << exact_soln[0] << std::endl;
554 write_tecplot_zone_footer(outfile,nplot);
567 template <
unsigned DIM>
571 double& error,
double& norm)
585 unsigned n_node = nnode();
590 unsigned n_intpt = integral_pt()->nweight();
593 outfile <<
"ZONE" << std::endl;
599 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
603 for(
unsigned i=0;
i<DIM;
i++)
605 s[
i] = integral_pt()->knot(ipt,
i);
609 double w = integral_pt()->weight(ipt);
612 double J=J_eulerian(s);
621 double u_fe = interpolated_u_womersley(s);
624 (*exact_soln_pt)(x,exact_soln);
627 for(
unsigned i=0;
i<DIM;
i++)
629 outfile << x[
i] <<
" ";
631 outfile << exact_soln[0] <<
" " << exact_soln[0]-u_fe << std::endl;
634 norm+=exact_soln[0]*exact_soln[0]*
W;
635 error+=(exact_soln[0]-u_fe)*(exact_soln[0]-u_fe)*
W;
649 template<
unsigned DIM>
652 const double& time,
double& error,
double& norm)
668 unsigned n_node = nnode();
673 unsigned n_intpt = integral_pt()->nweight();
676 outfile <<
"ZONE" << std::endl;
682 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
686 for(
unsigned i=0;
i<DIM;
i++)
688 s[
i] = integral_pt()->knot(ipt,
i);
692 double w = integral_pt()->weight(ipt);
695 double J=J_eulerian(s);
704 double u_fe = interpolated_u_womersley(s);
707 (*exact_soln_pt)(time,x,exact_soln);
710 for(
unsigned i=0;
i<DIM;
i++)
712 outfile << x[
i] <<
" ";
714 outfile << exact_soln[0] <<
" " << exact_soln[0]-u_fe << std::endl;
717 norm+=exact_soln[0]*exact_soln[0]*
W;
718 error+=(exact_soln[0]-u_fe)*(exact_soln[0]-u_fe)*
W;
static const unsigned Initial_Nvalue
Static array of ints to hold number of variables at nodes: Initial_Nvalue[n].
unsigned self_test()
Self-test: Return 0 for OK.
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.
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 ...
double get_volume_flux()
Compute total volume flux through element.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
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...
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(std::ostream &outfile)
Output with default number of plot points.
static bool Suppress_warning_about_unpinned_nst_dofs
Static bool to suppress warning.
static double Default_ReSt_value
Static default value for the Womersley number.