223 const unsigned DIM = this->dim();
226 if (this->Solid_ic_pt != 0)
228 this->fill_in_residuals_for_solid_ic(residuals);
233 const unsigned n_node = this->nnode();
236 const unsigned n_position_type = this->nnodal_position_type();
239 Shape psi(n_node, n_position_type);
240 DShape dpsidxi(n_node, n_position_type,
DIM);
243 const unsigned n_intpt = this->integral_pt()->nweight();
246 Vector<double>
s(
DIM);
249 double lambda_sq = this->lambda_sq();
252 double time_factor = 0.0;
255 time_factor = this->node_pt(0)->position_time_stepper_pt()->weight(2, 0);
262 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
265 for (
unsigned i = 0;
i <
DIM; ++
i)
266 {
s[
i] = this->integral_pt()->knot(ipt,
i); }
269 double w = this->integral_pt()->weight(ipt);
272 double J = this->dshape_lagrangian_at_knot(ipt, psi, dpsidxi);
275 double coupling_w = 0;
276 for (
unsigned l = 0; l < n_node; l++)
278 double nodal_coupling_w =
dynamic_cast<CoupledSolidNode*
>(this->node_pt(l))->get_coupling_weight();
279 double psi_ = psi(l);
280 coupling_w += psi_ * nodal_coupling_w;
288 Vector<double> accel(
DIM);
291 for (
unsigned i = 0;
i <
DIM;
i++)
295 for (
unsigned j = 0;
j <
DIM;
j++)
297 interpolated_G(
i,
j) = 0.0;
302 Vector<double> interpolated_xi(
DIM, 0.0);
305 for (
unsigned l = 0; l < n_node; l++)
308 for (
unsigned k = 0;
k < n_position_type;
k++)
310 double psi_ = psi(l,
k);
312 for (
unsigned i = 0;
i <
DIM;
i++)
315 interpolated_xi[
i] += this->lagrangian_position_gen(l,
k,
i) * psi_;
318 if (( lambda_sq > 0.0 ) && ( this->Unsteady ))
320 accel[
i] += this->dnodal_position_gen_dt(2, l,
k,
i) * psi_;
324 for (
unsigned j = 0;
j <
DIM;
j++)
326 interpolated_G(
j,
i) +=
327 this->nodal_position_gen(l,
k,
i) * dpsidxi(l,
k,
j);
335 this->get_isotropic_growth(ipt,
s, interpolated_xi,
gamma);
339 Vector<double>
b(
DIM);
347 for (
unsigned i = 0;
i <
DIM;
i++)
349 for (
unsigned j = 0;
j <
DIM;
j++)
352 { g(
i,
j) = diag_entry; }
360 double W =
gamma *
w * ( 1.0 - coupling_w ) *
J;
366 for (
unsigned i = 0;
i <
DIM;
i++)
369 for (
unsigned j =
i;
j <
DIM;
j++)
374 for (
unsigned k = 0;
k <
DIM;
k++)
376 G(
i,
j) += interpolated_G(
i,
k) * interpolated_G(
j,
k);
380 for (
unsigned j = 0;
j <
i;
j++)
388 ELEMENT::get_stress(g,
G,
sigma);
391 for (
unsigned i = 0;
i <
DIM;
i++)
393 for (
unsigned j = 0;
j <
DIM;
j++)
395 sigma(
i,
j) += this->prestress(
i,
j, interpolated_xi);
403 RankFourTensor<double> d_stress_dG(
DIM,
DIM,
DIM,
DIM, 0.0);
405 RankFiveTensor<double> d_G_dX(n_node, n_position_type,
DIM,
DIM,
DIM, 0.0);
415 for (
unsigned ll = 0; ll < n_node; ll++)
417 for (
unsigned kk = 0; kk < n_position_type; kk++)
419 for (
unsigned ii = 0; ii <
DIM; ii++)
421 for (
unsigned aa = 0; aa <
DIM; aa++)
423 for (
unsigned bb = aa; bb <
DIM; bb++)
425 d_G_dX(ll, kk, ii, aa, bb) =
426 interpolated_G(aa, ii) * dpsidxi(ll, kk, bb) +
427 interpolated_G(bb, ii) * dpsidxi(ll, kk, aa);
436 this->get_d_stress_dG_upper(g,
G,
sigma, d_stress_dG);
442 for (
unsigned l = 0; l < n_node; l++)
445 for (
unsigned k = 0;
k < n_position_type;
k++)
448 const unsigned offset5 = dpsidxi.offset(l,
k);
451 for (
unsigned i = 0;
i <
DIM;
i++)
454 local_eqn = this->position_local_eqn(l,
k,
i);
463 sum += ( lambda_sq * accel[
i] -
b[
i] ) * psi(l,
k);
466 for (
unsigned a = 0;
a <
DIM;
a++)
468 unsigned count = offset5;
469 for (
unsigned b = 0;
b <
DIM;
b++)
472 sum +=
sigma(
a,
b) * interpolated_G(
a,
i) *
473 dpsidxi.raw_direct_access(count);
477 residuals[local_eqn] +=
W * sum;
483 const unsigned offset1 = d_G_dX.offset(l,
k,
i);
486 for (
unsigned ll = 0; ll < n_node; ll++)
489 for (
unsigned kk = 0; kk < n_position_type; kk++)
492 for (
unsigned ii = 0; ii <
DIM; ii++)
495 int local_unknown = this->position_local_eqn(ll, kk, ii);
498 if (local_unknown >= 0)
501 const unsigned offset2 = d_G_dX.offset(ll, kk, ii);
502 const unsigned offset4 = dpsidxi.offset(ll, kk);
507 unsigned count1 = offset1;
508 for (
unsigned a = 0;
a <
DIM;
a++)
513 for (
unsigned b =
a;
b <
DIM;
b++)
515 double factor = d_G_dX.raw_direct_access(count1);
516 if (
a ==
b) factor *= 0.5;
519 unsigned offset3 = d_stress_dG.offset(
a,
b);
520 unsigned count2 = offset2;
521 unsigned count3 = offset3;
523 for (
unsigned aa = 0; aa <
DIM; aa++)
531 for (
unsigned bb = aa; bb <
DIM; bb++)
534 d_stress_dG.raw_direct_access(count3) *
535 d_G_dX.raw_direct_access(count2);
547 jacobian(local_eqn, local_unknown) += sum *
W;
551 if ((
i == ii ) && ( local_unknown >= local_eqn ))
557 sum += lambda_sq * time_factor * psi(ll, kk) * psi(l,
k);
560 unsigned count4 = offset4;
561 for (
unsigned a = 0;
a <
DIM;
a++)
564 const double factor =
565 dpsidxi.raw_direct_access(count4);
568 unsigned count5 = offset5;
569 for (
unsigned b = 0;
b <
DIM;
b++)
572 dpsidxi.raw_direct_access(count5);
577 jacobian(local_eqn, local_unknown) += sum *
W;
579 if (local_eqn != local_unknown)
581 jacobian(local_unknown, local_eqn) += sum *
W;
JacobiRotation< float > G
Definition: Jacobi_makeGivens.cpp:2
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
RowVector3d w
Definition: Matrix_resize_int.cpp:3
Scalar * b
Definition: benchVecAdd.cpp:17
RealScalar s
Definition: level1_cplx_impl.h:130
const Scalar * a
Definition: level2_cplx_impl.h:32
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 pow(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:625
void body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:96
int sigma
Definition: calibrate.py:179
Mdouble gamma(Mdouble gamma_in)
This is the gamma function returns the true value for the half integer value.
Definition: ExtendedMath.cc:116
@ W
Definition: quadtree.h:63
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2