37 template<
unsigned DIM>
45 unsigned n_position_type = this->nnodal_position_type();
46 if (n_position_type != 1)
48 throw OomphLibError(
"TimeHarmonicLinearElasticity is not yet implemented "
49 "for more than one position type",
50 OOMPH_CURRENT_FUNCTION,
51 OOMPH_EXCEPTION_LOCATION);
55 if (this->Elasticity_tensor_pt == 0)
58 OOMPH_CURRENT_FUNCTION,
59 OOMPH_EXCEPTION_LOCATION);
65 unsigned n_node = this->nnode();
68 std::complex<unsigned> u_nodal_index[DIM];
69 for (
unsigned i = 0;
i < DIM;
i++)
71 u_nodal_index[
i] = this->u_index_time_harmonic_linear_elasticity(
i);
75 const double omega_sq_local = this->omega_sq();
79 DShape dpsidx(n_node, DIM);
82 unsigned n_intpt = this->integral_pt()->nweight();
88 int local_eqn = 0, local_unknown = 0;
91 HangInfo *hang_info_pt = 0, *hang_info2_pt = 0;
94 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
97 for (
unsigned i = 0;
i < DIM; ++
i)
99 s[
i] = this->integral_pt()->knot(ipt,
i);
103 double w = this->integral_pt()->weight(ipt);
106 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
113 DIM, std::complex<double>(0.0, 0.0));
117 DIM, DIM, std::complex<double>(0.0, 0.0));
120 for (
unsigned l = 0; l < n_node; l++)
123 for (
unsigned i = 0;
i < DIM;
i++)
126 interpolated_x[
i] += this->nodal_position(l,
i) * psi(l);
129 const std::complex<double> u_value =
130 std::complex<double>(nodal_value(l, u_nodal_index[
i].real()),
131 nodal_value(l, u_nodal_index[
i].imag()));
133 interpolated_u[
i] += u_value * psi(l);
136 for (
unsigned j = 0; j < DIM; j++)
138 interpolated_dudx(
i, j) += u_value * dpsidx(l, j);
145 this->body_force(interpolated_x, b);
151 unsigned n_master = 1;
152 double hang_weight = 1.0;
155 for (
unsigned l = 0; l < n_node; l++)
158 bool is_node_hanging = node_pt(l)->is_hanging();
163 hang_info_pt = node_pt(l)->hanging_pt();
165 n_master = hang_info_pt->
nmaster();
174 for (
unsigned m = 0; m < n_master; m++)
177 for (
unsigned a = 0; a < DIM; a++)
187 u_nodal_index[a].real());
194 local_eqn = this->nodal_local_eqn(l, u_nodal_index[a].real());
202 residuals[local_eqn] +=
203 (-omega_sq_local * interpolated_u[a].real() - b[a].real()) *
204 psi(l) *
W * hang_weight;
207 for (
unsigned b = 0; b < DIM; b++)
209 for (
unsigned c = 0; c < DIM; c++)
211 for (
unsigned d = 0; d < DIM; d++)
214 residuals[local_eqn] += this->
E(a, b, c, d) *
215 interpolated_dudx(c, d).real() *
216 dpsidx(l, b) *
W * hang_weight;
225 unsigned n_master2 = 1;
226 double hang_weight2 = 1.0;
228 for (
unsigned l2 = 0; l2 < n_node; l2++)
231 bool is_node2_hanging = node_pt(l2)->is_hanging();
234 if (is_node2_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++)
254 if (is_node2_hanging)
257 local_unknown = this->local_hang_eqn(
258 hang_info2_pt->master_node_pt(m2),
259 u_nodal_index[c].real());
261 hang_weight2 = hang_info2_pt->master_weight(m2);
266 this->nodal_local_eqn(l2, u_nodal_index[c].real());
271 if (local_unknown >= 0)
276 jacobian(local_eqn, local_unknown) -=
277 omega_sq_local * psi(l) * psi(l2) *
W *
278 hang_weight * hang_weight2;
282 for (
unsigned b = 0; b < DIM; b++)
284 for (
unsigned d = 0; d < DIM; d++)
287 jacobian(local_eqn, local_unknown) +=
288 this->
E(a, b, c, d) * dpsidx(l2, d) *
289 dpsidx(l, b) *
W * hang_weight * hang_weight2;
309 u_nodal_index[a].imag());
316 local_eqn = this->nodal_local_eqn(l, u_nodal_index[a].imag());
324 residuals[local_eqn] +=
325 (-omega_sq_local * interpolated_u[a].imag() - b[a].imag()) *
326 psi(l) *
W * hang_weight;
329 for (
unsigned b = 0; b < DIM; b++)
331 for (
unsigned c = 0; c < DIM; c++)
333 for (
unsigned d = 0; d < DIM; d++)
336 residuals[local_eqn] += this->
E(a, b, c, d) *
337 interpolated_dudx(c, d).imag() *
338 dpsidx(l, b) *
W * hang_weight;
347 unsigned n_master2 = 1;
348 double hang_weight2 = 1.0;
350 for (
unsigned l2 = 0; l2 < n_node; l2++)
353 bool is_node2_hanging = node_pt(l2)->is_hanging();
356 if (is_node2_hanging)
358 hang_info2_pt = node_pt(l2)->hanging_pt();
360 n_master2 = hang_info2_pt->nmaster();
369 for (
unsigned m2 = 0; m2 < n_master2; m2++)
372 for (
unsigned c = 0; c < DIM; c++)
376 if (is_node2_hanging)
379 local_unknown = this->local_hang_eqn(
380 hang_info2_pt->master_node_pt(m2),
381 u_nodal_index[c].imag());
383 hang_weight2 = hang_info2_pt->master_weight(m2);
388 this->nodal_local_eqn(l2, u_nodal_index[c].imag());
393 if (local_unknown >= 0)
398 jacobian(local_eqn, local_unknown) -=
399 omega_sq_local * psi(l) * psi(l2) *
W *
400 hang_weight * hang_weight2;
404 for (
unsigned b = 0; b < DIM; b++)
406 for (
unsigned d = 0; d < DIM; d++)
409 jacobian(local_eqn, local_unknown) +=
410 this->
E(a, b, c, d) * dpsidx(l2, d) *
411 dpsidx(l, b) *
W * hang_weight * hang_weight2;
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
Class that contains data for hanging nodes.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
unsigned nmaster() const
Return the number of master nodes.
An OomphLibError object which should be thrown when an run-time error is encountered....
Class for Refineable TimeHarmonicLinearElasticity equations.
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.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...