37 template<
unsigned NNODE_1D>
54 const unsigned n_node =
nnode();
57 Shape psi(n_node), test(n_node);
58 DShape dpsidx(n_node, 2), dtestdx(n_node, 2);
77 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
92 double interpolated_w = 0;
93 double interpolated_laplacian_w = 0;
94 double interpolated_phi = 0;
95 double interpolated_laplacian_phi = 0;
104 double interpolated_continuous_d2wdx2 = 0;
105 double interpolated_continuous_d2wdy2 = 0;
106 double interpolated_continuous_d2phidx2 = 0;
107 double interpolated_continuous_d2phidy2 = 0;
108 double interpolated_continuous_d2wdxdy = 0;
109 double interpolated_continuous_d2phidxdy = 0;
115 for (
unsigned l = 0; l < n_node; l++)
133 interpolated_laplacian_w +=
nodal_value[1] * psi(l);
138 interpolated_laplacian_phi +=
nodal_value[3] * psi(l);
140 interpolated_smooth_dwdx[0] +=
nodal_value[4] * psi(l);
141 interpolated_smooth_dwdx[1] +=
nodal_value[5] * psi(l);
142 interpolated_smooth_dphidx[0] +=
nodal_value[6] * psi(l);
143 interpolated_smooth_dphidx[1] +=
nodal_value[7] * psi(l);
145 interpolated_continuous_d2wdx2 +=
nodal_value[4] * dpsidx(l, 0);
146 interpolated_continuous_d2wdy2 +=
nodal_value[5] * dpsidx(l, 1);
147 interpolated_continuous_d2phidx2 +=
nodal_value[6] * dpsidx(l, 0);
148 interpolated_continuous_d2phidy2 +=
nodal_value[7] * dpsidx(l, 1);
150 interpolated_continuous_d2wdxdy +=
153 interpolated_continuous_d2phidxdy +=
159 for (
unsigned j = 0; j < 2; j++)
162 interpolated_dwdx[j] +=
nodal_value[0] * dpsidx(l, j);
163 interpolated_dlaplacian_wdx[j] +=
nodal_value[1] * dpsidx(l, j);
167 interpolated_dphidx[j] +=
nodal_value[2] * dpsidx(l, j);
168 interpolated_dlaplacian_phidx[j] +=
nodal_value[3] * dpsidx(l, j);
185 for (
unsigned l = 0; l < n_node; l++)
193 residuals[local_eqn] += pressure * test(l) *
W;
196 for (
unsigned k = 0; k < 2; k++)
198 residuals[local_eqn] +=
199 interpolated_dlaplacian_wdx[k] * dtestdx(l, k) *
W;
205 residuals[local_eqn] +=
eta() *
206 (interpolated_continuous_d2wdx2 *
207 interpolated_continuous_d2phidy2 +
208 interpolated_continuous_d2wdy2 *
209 interpolated_continuous_d2phidx2 -
210 2.0 * interpolated_continuous_d2wdxdy *
211 interpolated_continuous_d2phidxdy) *
223 residuals[local_eqn] += interpolated_laplacian_w * test(l) *
W;
225 for (
unsigned k = 0; k < 2; k++)
227 residuals[local_eqn] += interpolated_dwdx[k] * dtestdx(l, k) *
W;
237 residuals[local_eqn] += airy_forcing * test(l) *
W;
240 for (
unsigned k = 0; k < 2; k++)
242 residuals[local_eqn] +=
243 interpolated_dlaplacian_phidx[k] * dtestdx(l, k) *
W;
247 residuals[local_eqn] -=
248 (interpolated_continuous_d2wdx2 * interpolated_continuous_d2wdy2 -
249 interpolated_continuous_d2wdxdy *
250 interpolated_continuous_d2wdxdy) *
261 residuals[local_eqn] += interpolated_laplacian_phi * test(l) *
W;
263 for (
unsigned k = 0; k < 2; k++)
265 residuals[local_eqn] += interpolated_dphidx[k] * dtestdx(l, k) *
W;
274 residuals[local_eqn] +=
275 (interpolated_dwdx[0] - interpolated_smooth_dwdx[0]) * test(l) *
W;
282 residuals[local_eqn] +=
283 (interpolated_dwdx[1] - interpolated_smooth_dwdx[1]) * test(l) *
W;
290 residuals[local_eqn] +=
291 (interpolated_dphidx[0] - interpolated_smooth_dphidx[0]) * test(l) *
299 residuals[local_eqn] +=
300 (interpolated_dphidx[1] - interpolated_smooth_dphidx[1]) * test(l) *
389 unsigned n_dim = this->
dim();
390 unsigned n_node = this->
nnode();
392 DShape dpsidx(n_node, n_dim);
394 double interpolated_continuous_d2phidx2 = 0;
395 double interpolated_continuous_d2phidy2 = 0;
396 double interpolated_continuous_d2phidxdy = 0;
402 for (
unsigned l = 0; l < n_node; l++)
404 interpolated_continuous_d2phidx2 +=
406 interpolated_continuous_d2phidy2 +=
408 interpolated_continuous_d2phidxdy +=
413 sigma_xx = interpolated_continuous_d2phidy2;
414 sigma_yy = interpolated_continuous_d2phidx2;
415 sigma_xy = -interpolated_continuous_d2phidxdy;
427 const unsigned& nplot)
437 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
442 for (
unsigned i = 0;
i < 2;
i++)
471 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
476 for (
unsigned i = 0;
i < 2;
i++)
497 std::ostream& outfile,
498 const unsigned& nplot,
516 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
525 (*exact_soln_pt)(x, exact_soln);
528 for (
unsigned i = 0;
i < 2;
i++)
530 outfile << x[
i] <<
" ";
532 outfile << exact_soln[0] << std::endl;
548 std::ostream& outfile,
564 unsigned n_node =
nnode();
572 outfile <<
"ZONE" << std::endl;
579 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
582 for (
unsigned i = 0;
i < 2;
i++)
603 (*exact_soln_pt)(x, exact_soln);
606 for (
unsigned i = 0;
i < 2;
i++)
608 outfile << x[
i] <<
" ";
610 outfile << exact_soln[0] <<
" " << exact_soln[0] - w_fe << std::endl;
613 norm += exact_soln[0] * exact_soln[0] *
W;
614 error += (exact_soln[0] - w_fe) * (exact_soln[0] - w_fe) *
W;
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s.
double nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n. Produces suitably interpolated values for hanging nodes...
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 dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
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 dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Compute the geometric shape functions and also first derivatives w.r.t. global coordinates at local c...
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.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
double interpolated_w_fvk(const Vector< double > &s, unsigned index=0) const
Return FE representation of function value w_fvk(s) at local coordinate s (by default - if index > 0,...
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: x,y,w_exact at n_plot^DIM plot points.
void output(std::ostream &outfile)
Output with default number of plot points.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Fill in the residuals with this element's contribution.
virtual void get_airy_forcing_fvk(const unsigned &ipt, const Vector< double > &x, double &airy_forcing) const
Get Airy forcing term at (Eulerian) position x. This function is virtual to allow overloading in mult...
int Volume_constraint_pressure_external_data_index
Index of the external Data object that represents the volume constraint pressure (initialised to -1 i...
virtual double get_bounded_volume() const
Return the integral of the displacement over the current element, effectively calculating its contrib...
bool Linear_bending_model
Flag which stores whether we are using a linear, pure bending model instead of the full non-linear Fo...
virtual void get_pressure_fvk(const unsigned &ipt, const Vector< double > &x, double &pressure) const
Get pressure term at (Eulerian) position x. This function is virtual to allow overloading in multi-ph...
virtual unsigned nodal_index_fvk(const unsigned &i=0) const
Return the index at which the i-th unknown value is stored. The default value, i, is appropriate for ...
unsigned self_test()
Self-test: Return 0 for OK.
virtual double dshape_and_dtest_eulerian_at_knot_fvk(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 ...
const double & eta() const
Eta.
static double Default_Physical_Constant_Value
Default value for physical constants.
void interpolated_stress(const Vector< double > &s, double &sigma_xx, double &sigma_yy, double &sigma_xy)
Compute in-plane stresses.
int external_local_eqn(const unsigned &i, const unsigned &j)
Return the local equation number corresponding to the j-th value stored at the i-th external data.
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.
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
static const unsigned Initial_Nvalue
Static int that holds the number of variables at nodes: always the same.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...