54 const unsigned n_node =
nnode();
60 Shape psi(n_node), test(n_node);
61 DShape dpsidx(n_node, 2), dtestdx(n_node, 2);
70 const double scaled_peclet =
pe();
73 const double scaled_peclet_st =
pe_st();
77 int local_eqn = 0, local_unknown = 0;
80 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
90 ipt, psi, dpsidx, test, dtestdx);
97 double interpolated_u = 0.0;
105 for (
unsigned l = 0; l < n_node; l++)
109 interpolated_u += u_value * psi(l);
112 for (
unsigned j = 0; j < 2; j++)
115 interpolated_dudx[j] += u_value * dpsidx(l, j);
135 double dS = r * r * sin_th;
142 for (
unsigned l = 0; l < n_node; l++)
151 residuals[local_eqn] -=
152 (scaled_peclet_st * dudt + source) * dS * test(l) *
W;
155 residuals[local_eqn] -=
157 (dS * interpolated_dudx[0] *
158 (scaled_peclet * wind[0] * test(l) + dtestdx(l, 0)) +
160 (sin_th * interpolated_dudx[1] *
161 (r * scaled_peclet * wind[1] * test(l) + dtestdx(l, 1)))) *
170 for (
unsigned l2 = 0; l2 < n_node; l2++)
176 if (local_unknown >= 0)
179 jacobian(local_eqn, local_unknown) -=
180 scaled_peclet_st * test(l) * psi(l2) *
186 mass_matrix(local_eqn, local_unknown) +=
187 scaled_peclet_st * test(l) * psi(l2) * dS *
W;
191 jacobian(local_eqn, local_unknown) -=
193 (dS * dpsidx(l2, 0) *
194 (scaled_peclet * wind[0] * test(l) + dtestdx(l, 0)) +
196 (sin_th * dpsidx(l2, 1) *
197 (r * scaled_peclet * wind[1] * test(l) + dtestdx(l, 1)))) *
244 const unsigned& nplot)
254 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
263 for (
unsigned i = 0;
i < 2;
i++)
265 outfile << x[
i] <<
" ";
269 outfile << x[0] * sin(x[1]) <<
" " << x[0] * cos(x[1]) <<
" ";
278 for (
unsigned i = 0;
i < 2;
i++)
280 outfile << wind[
i] <<
" ";
282 outfile << std::endl;
299 const unsigned& nplot)
309 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
314 for (
unsigned i = 0;
i < 2;
i++)
321 fprintf(file_pt,
"%g %g ", r * sin(theta), r * cos(theta));
340 std::ostream& outfile,
341 const unsigned& nplot,
358 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
367 (*exact_soln_pt)(x, exact_soln);
370 for (
unsigned i = 0;
i < 2;
i++)
372 outfile << x[
i] <<
" ";
374 outfile << exact_soln[0] << std::endl;
391 std::ostream& outfile,
407 unsigned n_node =
nnode();
415 outfile <<
"ZONE" << std::endl;
421 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
424 for (
unsigned i = 0;
i < 2;
i++)
445 (*exact_soln_pt)(x, exact_soln);
448 for (
unsigned i = 0;
i < 2;
i++)
450 outfile << x[
i] <<
" ";
452 outfile << exact_soln[0] <<
" " << exact_soln[0] - u_fe << std::endl;
455 norm += exact_soln[0] * exact_soln[0] *
W;
456 error += (exact_soln[0] - u_fe) * (exact_soln[0] - u_fe) *
W;
464 template<
unsigned NNODE_1D>
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction")
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node.
unsigned nnode() const
Return the number of nodes.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as .
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction")
double raw_nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n but do NOT take hanging nodes into account.
double raw_nodal_position(const unsigned &n, const unsigned &i) const
Return the i-th coordinate at local node n. Do not use the hanging node representation....
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Add tecplot zone "footer" to output stream (when plotting nplot points in each "coordinate direction"...
virtual unsigned self_test()
Self-test: Check inversion of element & do self-test for GeneralisedElement. Return 0 if OK.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
unsigned self_test()
Self-test: Return 0 for OK.
virtual void get_source_spherical_adv_diff(const unsigned &ipt, const Vector< double > &x, double &source) const
Get source term at (Eulerian) position x. This function is virtual to allow overloading in multi-phys...
double interpolated_u_spherical_adv_diff(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
virtual double dshape_and_dtest_eulerian_at_knot_spherical_adv_diff(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Shape/test functions and derivs w.r.t. to global coords at integration point ipt; return Jacobian of ...
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: r,z,u_exact at nplot^2 plot points.
const double & pe() const
Peclet number.
void output(std::ostream &outfile)
Output with default number of plot points.
double du_dt_spherical_adv_diff(const unsigned &n) const
du/dt at local node n. Uses suitably interpolated value for hanging nodes.
const double & pe_st() const
Peclet number multiplied by Strouhal number.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
virtual unsigned u_index_spherical_adv_diff() const
Return the index at which the unknown value is stored. The default value, 0, is appropriate for singl...
static double Default_peclet_number
Static default value for the Peclet number.
virtual void fill_in_generic_residual_contribution_spherical_adv_diff(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add the element's contribution to its residual vector only (if flag=and/or element Jacobian matrix.
virtual void get_wind_spherical_adv_diff(const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &wind) const
Get wind at (Eulerian) position x and/or local coordinate s. This function is virtual to allow overlo...
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...