39 template<
unsigned DIM>
41 const Shape &q_basis_local,
46 const unsigned n_node = this->nnode();
51 this->dshape_local(s,psi,dpsi);
57 double det = local_to_eulerian_mapping(dpsi,jacobian,inverse_jacobian);
60 const unsigned n_q_basis = this->nq_basis();
63 for(
unsigned l=0;l<n_q_basis;l++)
66 for(
unsigned i=0;
i<DIM;
i++)
74 for(
unsigned i=0;
i<DIM;
i++)
77 for(
unsigned j=0;j<DIM;j++)
81 double jac_trans = jacobian(j,
i)/det;
84 for(
unsigned l=0;l<n_q_basis;l++)
87 q_basis(l,
i) += jac_trans*q_basis_local(l,j);
102 template<
unsigned DIM>
104 std::ostream &outfile,
105 const unsigned &nplot,
113 outfile << this->tecplot_zone_string(nplot);
116 unsigned num_plot_points=this->nplot_points(nplot);
118 for(
unsigned iplot=0;iplot<num_plot_points;iplot++)
121 this->get_s_plot(iplot,nplot,s);
124 for(
unsigned i=0;
i<DIM;
i++)
126 outfile << this->interpolated_x(s,
i) <<
" ";
130 for(
unsigned i=0;
i<DIM;
i++)
132 outfile << this->interpolated_q(s,
i) <<
" ";
136 outfile << this->interpolated_div_q(s) <<
" ";
139 outfile << this->interpolated_p(s) <<
" ";
143 for (
unsigned i=0;
i<2;
i++)
145 flux+=this->interpolated_q(s,
i)*unit_normal[
i];
147 outfile << flux <<
" ";
149 outfile << std::endl;
153 this->write_tecplot_zone_footer(outfile,nplot);
162 template<
unsigned DIM>
169 outfile << tecplot_zone_string(nplot);
172 unsigned num_plot_points=nplot_points(nplot);
174 for(
unsigned iplot=0;iplot<num_plot_points;iplot++)
177 get_s_plot(iplot,nplot,s);
180 for(
unsigned i=0;
i<DIM;
i++)
182 outfile << interpolated_x(s,
i) <<
" ";
186 for(
unsigned i=0;
i<DIM;
i++)
188 outfile << interpolated_q(s,
i) <<
" ";
192 outfile << interpolated_div_q(s) <<
" ";
195 outfile << interpolated_p(s) <<
" ";
197 outfile << std::endl;
201 this->write_tecplot_zone_footer(outfile,nplot);
208 template<
unsigned DIM>
210 std::ostream &outfile,
211 const unsigned &nplot,
221 outfile << this->tecplot_zone_string(nplot);
227 unsigned num_plot_points=this->nplot_points(nplot);
229 for(
unsigned iplot=0;iplot<num_plot_points;iplot++)
232 this->get_s_plot(iplot,nplot,s);
235 this->interpolated_x(s,x);
238 (*exact_soln_pt)(x,exact_soln);
241 for(
unsigned i=0;
i<DIM;
i++)
243 outfile << x[
i] <<
" ";
245 for(
unsigned i=0;
i<DIM+2;
i++)
247 outfile << exact_soln[
i] <<
" ";
249 outfile << std::endl;
253 this->write_tecplot_zone_footer(outfile,nplot);
260 template<
unsigned DIM>
262 std::ostream &outfile,
267 for(
unsigned i=0;
i<2;
i++)
280 unsigned n_intpt = this->integral_pt()->nweight();
282 outfile <<
"ZONE" << std::endl;
288 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
291 for(
unsigned i=0;
i<DIM;
i++)
293 s[
i] = this->integral_pt()->knot(ipt,
i);
297 double w = this->integral_pt()->weight(ipt);
300 double J=this->J_eulerian(s);
306 this->interpolated_x(s,x);
309 (*exact_soln_pt)(x,exact_soln);
312 for(
unsigned i=0;
i<DIM;
i++)
314 norm[0]+=exact_soln[
i]*exact_soln[
i]*
W;
316 error[0]+=(exact_soln[
i]-this->interpolated_q(s,
i))*
317 (exact_soln[
i]-this->interpolated_q(s,
i))*W;
326 norm[1]+=exact_soln[DIM+1]*exact_soln[DIM+1]*
W;
327 error[1]+=(exact_soln[DIM+1]-this->interpolated_p(s))*
328 (exact_soln[DIM+1]-this->interpolated_p(s))*W;
331 for(
unsigned i=0;
i<DIM;
i++)
333 outfile << x[
i] <<
" ";
337 for(
unsigned i=0;
i<DIM;
i++)
339 outfile << exact_soln[
i]-this->interpolated_q(s,
i) <<
" ";
343 outfile << exact_soln[DIM+1]-this->interpolated_p(s) <<
" ";
345 outfile << std::endl;
352 template<
unsigned DIM>
360 const unsigned n_node = nnode();
361 const unsigned n_q_basis = nq_basis();
362 const unsigned n_q_basis_edge = nq_basis_edge();
363 const unsigned n_p_basis = np_basis();
366 Shape psi(n_node), q_basis(n_q_basis,DIM), q_test(n_q_basis,DIM),
367 p_basis(n_p_basis), p_test(n_p_basis),
368 div_q_basis_ds(n_q_basis), div_q_test_ds(n_q_basis);
371 unsigned n_intpt = integral_pt()->nweight();
380 double mass_source_local;
386 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
389 for(
unsigned i=0;
i<DIM;
i++) { s[
i] = integral_pt()->knot(ipt,
i); }
392 double w = integral_pt()->weight(ipt);
397 shape_basis_test_local_at_knot(
398 ipt,psi,q_basis,q_test,p_basis,p_test,div_q_basis_ds,div_q_test_ds);
403 double interpolated_div_q_ds=0.0;
404 double interpolated_p=0.0;
407 for(
unsigned l=0;l<n_node;l++)
409 for(
unsigned i=0;
i<DIM;
i++)
411 interpolated_x[
i] += nodal_position(l,
i)*psi[l];
417 for(
unsigned i=0;
i<DIM;
i++)
420 for(
unsigned l=0;l<n_q_basis_edge;l++)
422 interpolated_q[
i] += q_edge(l)*q_basis(l,
i);
425 for(
unsigned l=n_q_basis_edge;l<n_q_basis;l++)
427 interpolated_q[
i] += q_internal(l-n_q_basis_edge)*q_basis(l,
i);
432 for(
unsigned l=0;l<n_p_basis;l++)
434 interpolated_p += p_value(l)*p_basis(l);
439 for(
unsigned l=0;l<n_q_basis_edge;l++)
441 interpolated_div_q_ds += q_edge(l)*div_q_basis_ds(l);
443 for(
unsigned l=n_q_basis_edge;l<n_q_basis;l++)
445 interpolated_div_q_ds += q_internal(l-n_q_basis_edge)*div_q_basis_ds(l);
449 this->source(interpolated_x,f);
452 this->mass_source(interpolated_x,mass_source_local);
455 for(
unsigned l=0;l<n_q_basis;l++)
459 local_eqn = q_edge_local_eqn(l);
463 local_eqn = q_internal_local_eqn(l-n_q_basis_edge);
469 for(
unsigned i=0;
i<DIM;
i++)
471 residuals[local_eqn] +=
472 (interpolated_q[
i]-f[
i])*q_test(l,
i)*w*J;
476 residuals[local_eqn] -= (interpolated_p*div_q_test_ds(l))*w;
481 for(
unsigned l=0;l<n_p_basis;l++)
484 local_eqn = p_local_eqn(l);
490 residuals[local_eqn] += interpolated_div_q_ds*p_test(l)*w;
491 residuals[local_eqn] -= mass_source_local*p_test(l)*w*J;
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, Vector< double > &error, Vector< double > &norm)
Compute the error between the FE solution and the exact solution using the H(div) norm for q and L^2 ...
virtual void fill_in_generic_residual_contribution(Vector< double > &residuals, DenseMatrix< double > &jacobian, bool flag)
Fill in residuals and, if flag==true, jacobian.
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output FE representation of exact soln: x,y,q1,q2,div_q,p at Nplot^DIM plot points.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
double transform_basis(const Vector< double > &s, const Shape &q_basis_local, Shape &psi, Shape &q_basis) const
Performs a div-conserving transformation of the vector basis functions from the reference element to ...
void output(std::ostream &outfile)
Output with default number of plot points.
void output_with_projected_flux(std::ostream &outfile, const unsigned &nplot, const Vector< double > unit_normal)
Output incl. projection of fluxes into direction of the specified unit vector.