42 template<
unsigned DIM>
51 unsigned n_position_type = this->nnodal_position_type();
52 if(n_position_type != 1)
55 "TimeHarmonicLinearElasticity 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);
72 unsigned n_node = this->nnode();
75 std::complex<unsigned> u_nodal_index[DIM];
76 for(
unsigned i=0;
i<DIM;
i++)
78 u_nodal_index[
i] = this->u_index_time_harmonic_linear_elasticity(
i);
82 const double omega_sq_local = this->omega_sq();
89 unsigned n_intpt = this->integral_pt()->nweight();
95 int local_eqn=0, local_unknown=0;
98 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
101 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
104 for(
unsigned i=0;
i<DIM;++
i) {s[
i] = this->integral_pt()->knot(ipt,
i);}
107 double w = this->integral_pt()->weight(ipt);
110 double J = this->dshape_eulerian_at_knot(ipt,psi,dpsidx);
117 interpolated_u(DIM,std::complex<double>(0.0,0.0));
121 DIM,DIM,std::complex<double>(0.0,0.0));
124 for(
unsigned l=0;l<n_node;l++)
127 for(
unsigned i=0;
i<DIM;
i++)
130 interpolated_x[
i] += this->nodal_position(l,
i)*psi(l);
133 const std::complex<double> u_value =
134 std::complex<double>(nodal_value(l,u_nodal_index[
i].real()),
135 nodal_value(l,u_nodal_index[
i].imag()));
137 interpolated_u[
i]+=u_value*psi(l);
140 for(
unsigned j=0;j<DIM;j++)
142 interpolated_dudx(
i,j) += u_value*dpsidx(l,j);
149 this->body_force(interpolated_x,b);
155 unsigned n_master=1;
double hang_weight=1.0;
158 for(
unsigned l=0;l<n_node;l++)
161 bool is_node_hanging = node_pt(l)->is_hanging();
166 hang_info_pt = node_pt(l)->hanging_pt();
168 n_master = hang_info_pt->
nmaster();
177 for(
unsigned m=0;m<n_master;m++)
180 for(
unsigned a=0;a<DIM;a++)
192 u_nodal_index[a].real());
199 local_eqn = this->nodal_local_eqn(l,u_nodal_index[a].real());
207 residuals[local_eqn] +=
208 (-omega_sq_local*interpolated_u[a].real()
209 -b[a].real())*psi(l)*W*hang_weight;
212 for(
unsigned b=0;b<DIM;b++)
214 for(
unsigned c=0;c<DIM;c++)
216 for(
unsigned d=0;d<DIM;d++)
219 residuals[local_eqn] +=
220 this->
E(a,b,c,d)*interpolated_dudx(c,d).real()*dpsidx(l,b)*W*
230 unsigned n_master2=1;
double hang_weight2=1.0;
232 for(
unsigned l2=0;l2<n_node;l2++)
235 bool is_node2_hanging = node_pt(l2)->is_hanging();
240 hang_info2_pt = node_pt(l2)->hanging_pt();
242 n_master2 = hang_info2_pt->nmaster();
251 for(
unsigned m2=0;m2<n_master2;m2++)
254 for(
unsigned c=0;c<DIM;c++)
263 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
264 u_nodal_index[c].real());
266 hang_weight2 = hang_info2_pt->master_weight(m2);
271 this->nodal_local_eqn(l2,u_nodal_index[c].real());
276 if(local_unknown >= 0)
281 jacobian(local_eqn,local_unknown) -=
282 omega_sq_local*psi(l)*psi(l2)*W*
283 hang_weight*hang_weight2;
287 for(
unsigned b=0;b<DIM;b++)
289 for(
unsigned d=0;d<DIM;d++)
292 jacobian(local_eqn,local_unknown) +=
293 this->
E(a,b,c,d)*dpsidx(l2,d)*dpsidx(l,b)*W
294 *hang_weight*hang_weight2;
315 u_nodal_index[a].imag());
322 local_eqn = this->nodal_local_eqn(l,u_nodal_index[a].imag());
330 residuals[local_eqn] +=
331 (-omega_sq_local*interpolated_u[a].imag()
332 -b[a].imag())*psi(l)*W*hang_weight;
335 for(
unsigned b=0;b<DIM;b++)
337 for(
unsigned c=0;c<DIM;c++)
339 for(
unsigned d=0;d<DIM;d++)
342 residuals[local_eqn] +=
343 this->
E(a,b,c,d)*interpolated_dudx(c,d).imag()*dpsidx(l,b)*W*
353 unsigned n_master2=1;
double hang_weight2=1.0;
355 for(
unsigned l2=0;l2<n_node;l2++)
358 bool is_node2_hanging = node_pt(l2)->is_hanging();
363 hang_info2_pt = node_pt(l2)->hanging_pt();
365 n_master2 = hang_info2_pt->nmaster();
374 for(
unsigned m2=0;m2<n_master2;m2++)
377 for(
unsigned c=0;c<DIM;c++)
386 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
387 u_nodal_index[c].imag());
389 hang_weight2 = hang_info2_pt->master_weight(m2);
394 this->nodal_local_eqn(l2,u_nodal_index[c].imag());
399 if(local_unknown >= 0)
405 jacobian(local_eqn,local_unknown) -=
406 omega_sq_local*psi(l)*psi(l2)*W*
407 hang_weight*hang_weight2;
411 for(
unsigned b=0;b<DIM;b++)
413 for(
unsigned d=0;d<DIM;d++)
416 jacobian(local_eqn,local_unknown) +=
417 this->
E(a,b,c,d)*dpsidx(l2,d)*dpsidx(l,b)*W
418 *hang_weight*hang_weight2;
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.
void fill_in_generic_contribution_to_residuals_time_harmonic_linear_elasticity(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Overloaded helper function to take hanging nodes into account.
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.
Class for Refineable TimeHarmonicLinearElasticity equations.