43 template<
unsigned NNODE_1D>
60 const unsigned n_node =
nnode();
63 Shape psi(n_node), test(n_node);
64 DShape dpsidx(n_node,2), dtestdx(n_node,2);
83 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
98 double interpolated_w = 0;
99 double interpolated_laplacian_w = 0;
100 double interpolated_phi = 0;
101 double interpolated_laplacian_phi = 0;
110 double interpolated_continuous_d2wdx2 = 0;
111 double interpolated_continuous_d2wdy2 = 0;
112 double interpolated_continuous_d2phidx2 = 0;
113 double interpolated_continuous_d2phidy2 = 0;
114 double interpolated_continuous_d2wdxdy = 0;
115 double interpolated_continuous_d2phidxdy = 0;
121 for(
unsigned l=0;l<n_node;l++)
138 interpolated_w += nodal_value[0]*psi(l);
139 interpolated_laplacian_w += nodal_value[1]*psi(l);
143 interpolated_phi += nodal_value[2]*psi(l);
144 interpolated_laplacian_phi += nodal_value[3]*psi(l);
146 interpolated_smooth_dwdx[0] += nodal_value[4]*psi(l);
147 interpolated_smooth_dwdx[1] += nodal_value[5]*psi(l);
148 interpolated_smooth_dphidx[0] += nodal_value[6]*psi(l);
149 interpolated_smooth_dphidx[1] += nodal_value[7]*psi(l);
151 interpolated_continuous_d2wdx2 += nodal_value[4]*dpsidx(l,0);
152 interpolated_continuous_d2wdy2 += nodal_value[5]*dpsidx(l,1);
153 interpolated_continuous_d2phidx2 += nodal_value[6]*dpsidx(l,0);
154 interpolated_continuous_d2phidy2 += nodal_value[7]*dpsidx(l,1);
156 interpolated_continuous_d2wdxdy += 0.5*(nodal_value[4]*dpsidx(l,1)
157 + nodal_value[5]*dpsidx(l,0));
158 interpolated_continuous_d2phidxdy += 0.5*(nodal_value[6]*dpsidx(l,1)
159 + nodal_value[7]*dpsidx(l,0));
163 for(
unsigned j=0;j<2;j++)
166 interpolated_dwdx[j] += nodal_value[0]*dpsidx(l,j);
167 interpolated_dlaplacian_wdx[j] += nodal_value[1]*dpsidx(l,j);
171 interpolated_dphidx[j] += nodal_value[2]*dpsidx(l,j);
172 interpolated_dlaplacian_phidx[j] += nodal_value[3]*dpsidx(l,j);
189 for(
unsigned l=0;l<n_node;l++)
197 residuals[local_eqn] += pressure*test(l)*
W;
200 for(
unsigned k=0;k<2;k++)
202 residuals[local_eqn] += interpolated_dlaplacian_wdx[k]*dtestdx(l,k)*
W;
208 residuals[local_eqn] +=
210 (interpolated_continuous_d2wdx2*interpolated_continuous_d2phidy2
211 + interpolated_continuous_d2wdy2*interpolated_continuous_d2phidx2
212 - 2.0*interpolated_continuous_d2wdxdy*
213 interpolated_continuous_d2phidxdy)
225 residuals[local_eqn] += interpolated_laplacian_w*test(l)*
W;
227 for(
unsigned k=0;k<2;k++)
229 residuals[local_eqn] += interpolated_dwdx[k]*dtestdx(l,k)*
W;
239 residuals[local_eqn] += airy_forcing*test(l)*
W;
242 for(
unsigned k=0;k<2;k++)
244 residuals[local_eqn] +=
245 interpolated_dlaplacian_phidx[k]*dtestdx(l,k)*
W;
249 residuals[local_eqn] -=
250 (interpolated_continuous_d2wdx2*interpolated_continuous_d2wdy2
251 - interpolated_continuous_d2wdxdy*interpolated_continuous_d2wdxdy)
262 residuals[local_eqn] += interpolated_laplacian_phi*test(l)*
W;
264 for(
unsigned k=0;k<2;k++)
266 residuals[local_eqn] += interpolated_dphidx[k]*dtestdx(l,k)*
W;
275 residuals[local_eqn] +=
276 (interpolated_dwdx[0] - interpolated_smooth_dwdx[0])*test(l)*
W;
283 residuals[local_eqn] +=
284 (interpolated_dwdx[1] - interpolated_smooth_dwdx[1])*test(l)*
W;
291 residuals[local_eqn] +=
292 (interpolated_dphidx[0] - interpolated_smooth_dphidx[0])*test(l)*
W;
299 residuals[local_eqn] +=
300 (interpolated_dphidx[1] - interpolated_smooth_dphidx[1])*test(l)*
W;
392 unsigned n_dim=this->
dim();
393 unsigned n_node=this->
nnode();
395 DShape dpsidx(n_node,n_dim);
397 double interpolated_continuous_d2phidx2 = 0;
398 double interpolated_continuous_d2phidy2 = 0;
399 double interpolated_continuous_d2phidxdy = 0;
405 for(
unsigned l=0;l<n_node;l++)
407 interpolated_continuous_d2phidx2 +=
409 interpolated_continuous_d2phidy2 +=
411 interpolated_continuous_d2phidxdy += 0.5*(
416 sigma_xx=interpolated_continuous_d2phidy2;
417 sigma_yy=interpolated_continuous_d2phidx2;
418 sigma_xy=-interpolated_continuous_d2phidxdy;
432 const unsigned &nplot)
443 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
449 for(
unsigned i=0;
i<2;
i++)
471 const unsigned &nplot)
481 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
486 for(
unsigned i=0;
i<2;
i++)
508 const unsigned &nplot,
526 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
536 (*exact_soln_pt)(x,exact_soln);
539 for(
unsigned i=0;
i<2;
i++)
541 outfile << x[
i] <<
" ";
543 outfile << exact_soln[0] << std::endl;
562 double& error,
double& norm)
576 unsigned n_node =
nnode();
584 outfile <<
"ZONE" << std::endl;
591 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
595 for(
unsigned i=0;
i<2;
i++)
616 (*exact_soln_pt)(x,exact_soln);
619 for(
unsigned i=0;
i<2;
i++)
621 outfile << x[
i] <<
" ";
623 outfile << exact_soln[0] <<
" " << exact_soln[0]-w_fe << std::endl;
626 norm+=exact_soln[0]*exact_soln[0]*
W;
627 error+=(exact_soln[0]-w_fe)*(exact_soln[0]-w_fe)*
W;
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction") ...
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 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...
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.
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.
static double Default_Physical_Constant_Value
Default value for physical constants.
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...
bool Linear_bending_model
Flag which stores whether we are using a linear, pure bending model instead of the full non-linear Fo...
virtual unsigned self_test()
Self-test: Check inversion of element & do self-test for GeneralisedElement. Return 0 if OK...
virtual double get_bounded_volume() const
Return the integral of the displacement over the current element, effectively calculating its contrib...
static const unsigned Initial_Nvalue
Static int that holds the number of variables at nodes: always the same.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction") ...
int Volume_constraint_pressure_external_data_index
Index of the external Data object that represents the volume constraint pressure (initialised to -1 i...
void interpolated_stress(const Vector< double > &s, double &sigma_xx, double &sigma_yy, double &sigma_xy)
Compute in-plane stresses.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
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...
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
unsigned self_test()
Self-test: Return 0 for OK.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
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 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 ...
const double & eta() const
Eta.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Fill in the residuals with this element's contribution.
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 ...
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...
void output(std::ostream &outfile)
Output with default number of plot points.
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. NOTE: Moved to cc file because of a possible compiler bug in gcc (yes, really!). The move to the cc file avoids inlining which appears to cause problems (only) when compiled with gcc and -O3; offensive "illegal read" is in optimised-out section of code and data that is allegedly illegal is readily readable (by other means) just before this function is called so I can't really see how we could possibly be responsible for this...
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
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...
unsigned nnode() const
Return the number of nodes.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s...
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...
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...
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...