42 template<
unsigned DIM>
51 unsigned n_position_type = this->nnodal_position_type();
52 if(n_position_type != 1)
55 "LinearElasticity is not yet implemented for more than one position type",
56 OOMPH_CURRENT_FUNCTION,
57 OOMPH_EXCEPTION_LOCATION);
61 if(this->Elasticity_tensor_pt==0)
64 "No elasticity tensor set",
65 OOMPH_CURRENT_FUNCTION,
66 OOMPH_EXCEPTION_LOCATION);
73 unsigned n_node = this->nnode();
76 unsigned u_nodal_index[DIM];
77 for(
unsigned i=0;
i<DIM;
i++)
78 {u_nodal_index[
i] = this->u_index_linear_elasticity(
i);}
88 unsigned n_intpt = this->integral_pt()->nweight();
94 int local_eqn=0, local_unknown=0;
97 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
100 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
103 for(
unsigned i=0;
i<DIM;++
i) {s[
i] = this->integral_pt()->knot(ipt,
i);}
106 double w = this->integral_pt()->weight(ipt);
109 double J = this->dshape_eulerian_at_knot(ipt,psi,dpsidx);
122 for(
unsigned l=0;l<n_node;l++)
125 for(
unsigned i=0;
i<DIM;
i++)
128 interpolated_x[
i] += this->nodal_position(l,
i)*psi(l);
139 const double u_value = nodal_value(l,u_nodal_index[
i]);
142 for(
unsigned j=0;j<DIM;j++)
144 interpolated_dudx(i,j) += u_value*dpsidx(l,j);
151 this->body_force(interpolated_x,b);
157 unsigned n_master=1;
double hang_weight=1.0;
160 for(
unsigned l=0;l<n_node;l++)
163 bool is_node_hanging = node_pt(l)->is_hanging();
168 hang_info_pt = node_pt(l)->hanging_pt();
170 n_master = hang_info_pt->
nmaster();
179 for(
unsigned m=0;m<n_master;m++)
182 for(
unsigned a=0;a<DIM;a++)
196 local_eqn = this->nodal_local_eqn(l,u_nodal_index[a]);
204 residuals[local_eqn] +=
205 (-b[a])*psi(l)*W*hang_weight;
208 for(
unsigned b=0;b<DIM;b++)
210 for(
unsigned c=0;c<DIM;c++)
212 for(
unsigned d=0;d<DIM;d++)
215 residuals[local_eqn] +=
216 this->
E(a,b,c,d)*interpolated_dudx(c,d)*dpsidx(l,b)*W*
226 unsigned n_master2=1;
double hang_weight2=1.0;
228 for(
unsigned l2=0;l2<n_node;l2++)
231 bool is_node2_hanging = node_pt(l2)->is_hanging();
236 hang_info2_pt = node_pt(l2)->hanging_pt();
238 n_master2 = hang_info2_pt->nmaster();
247 for(
unsigned m2=0;m2<n_master2;m2++)
250 for(
unsigned c=0;c<DIM;c++)
259 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
262 hang_weight2 = hang_info2_pt->master_weight(m2);
267 this->nodal_local_eqn(l2,u_nodal_index[c]);
272 if(local_unknown >= 0)
274 for(
unsigned b=0;b<DIM;b++)
276 for(
unsigned d=0;d<DIM;d++)
279 jacobian(local_eqn,local_unknown) +=
280 this->
E(a,b,c,d)*dpsidx(l2,d)*dpsidx(l,b)*W
281 *hang_weight*hang_weight2;
298 template<
unsigned DIM>
301 double& error,
double& norm)
314 unsigned n_intpt = this->integral_pt()->nweight();
324 nplot=unsigned(pow(n_intpt,1.0/
double(DIM)));
328 outfile << this->tecplot_zone_string(nplot);
334 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
338 for(
unsigned i=0;
i<DIM;
i++)
340 s[
i] = this->integral_pt()->knot(ipt,
i);
344 double w = this->integral_pt()->weight(ipt);
347 double J=this->J_eulerian(s);
353 this->interpolated_x(s,x);
359 (*exact_grad_pt)(x,exact_grad);
362 for(
unsigned i=0;
i<DIM;
i++)
364 outfile << x[
i] <<
" ";
366 for(
unsigned i=0;
i<DIM;
i++)
368 outfile << exact_grad[
i] <<
" " << exact_grad[
i]-dudx_fe[
i] << std::endl;
372 for(
unsigned i=0;
i<DIM;
i++)
375 norm+=exact_grad[
i]*exact_grad[
i]*
W;
376 error+=(exact_grad[
i]-dudx_fe[
i])*(exact_grad[
i]-dudx_fe[
i])*
W;
382 template<
unsigned DIM>
385 if(this->tree_pt()->father_pt()!=0)
Class for Refineable LinearElasticity equations.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
unsigned nmaster() const
Return the number of master nodes.
p-refineable version of 2D QLinearElasticityElement elements
void further_build()
Broken assignment operator.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
void compute_energy_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_grad_pt, double &error, double &norm)
Get error against and norm of exact solution.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
Class that contains data for hanging nodes.
void fill_in_generic_contribution_to_residuals_linear_elasticity(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Overloaded helper function to take hanging nodes into account.
void further_build()
Further build function, pass the pointers down to the sons.