35 throw OomphLibError(
"RefineablePVDEquations cannot be used with "
36 "incompressible constitutive laws.",
37 OOMPH_CURRENT_FUNCTION,
38 OOMPH_EXCEPTION_LOCATION);
43 if (this->Solid_ic_pt != 0)
45 this->get_residuals_for_solid_ic(residuals);
50 const unsigned n_node = this->nnode();
53 const unsigned n_position_type = this->nnodal_position_type();
59 double lambda_sq = this->lambda_sq();
62 double time_factor = 0.0;
63 double time_factor1 = 0.0;
66 time_factor = this->node_pt(0)->position_time_stepper_pt()->weight(2, 0);
67 time_factor1 = this->node_pt(0)->position_time_stepper_pt()->weight(1, 0);
71 Shape psi(n_node, n_position_type);
72 DShape dpsidxi(n_node, n_position_type, DIM);
75 const unsigned n_intpt = this->integral_pt()->nweight();
78 Vector<double> s(DIM);
81 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
84 for (
unsigned i = 0;
i < DIM; ++
i)
86 s[
i] = this->integral_pt()->knot(ipt,
i);
90 double w = this->integral_pt()->weight(ipt);
93 double J = this->dshape_lagrangian_at_knot(ipt, psi, dpsidxi);
97 DenseMatrix<double> interpolated_G(DIM, DIM, 0.0);
100 Vector<double> accel(DIM, 0.0);
103 Vector<double> interpolated_xi(DIM, 0.0);
106 for (
unsigned l = 0; l < n_node; l++)
109 for (
unsigned k = 0; k < n_position_type; k++)
111 double psi_ = psi(l, k);
113 for (
unsigned i = 0;
i < DIM;
i++)
116 interpolated_xi[
i] += this->lagrangian_position_gen(l, k,
i) * psi_;
121 if ((lambda_sq > 0.0) && (this->Unsteady))
123 accel[
i] += this->dnodal_position_gen_dt(2, l, k,
i) * psi_;
125 this->dnodal_position_gen_dt(1, l, k,
i) * psi_;
129 for (
unsigned j = 0; j < DIM; j++)
131 interpolated_G(j,
i) +=
132 this->nodal_position_gen(l, k,
i) * dpsidxi(l, k, j);
140 this->get_isotropic_growth(ipt, s, interpolated_xi,
gamma);
143 Vector<double> b(DIM);
144 this->body_force(interpolated_xi, b);
149 double diag_entry = pow(
gamma, 2.0 /
double(DIM));
150 DenseMatrix<double> g(DIM);
151 for (
unsigned i = 0;
i < DIM;
i++)
153 for (
unsigned j = 0; j < DIM; j++)
157 g(
i, j) = diag_entry;
168 double W =
gamma * w * J;
171 DenseMatrix<double> G(DIM);
174 for (
unsigned i = 0;
i < DIM;
i++)
177 for (
unsigned j =
i; j < DIM; j++)
182 for (
unsigned k = 0; k < DIM; k++)
184 G(
i, j) += interpolated_G(
i, k) * interpolated_G(j, k);
188 for (
unsigned j = 0; j <
i; j++)
195 DenseMatrix<double> sigma(DIM);
196 this->get_stress(g, G, sigma);
202 RankFourTensor<double> d_stress_dG(DIM, DIM, DIM, DIM, 0.0);
204 RankFiveTensor<double> d_G_dX(
205 n_node, n_position_type, DIM, DIM, DIM, 0.0);
215 for (
unsigned ll = 0; ll < n_node; ll++)
217 for (
unsigned kk = 0; kk < n_position_type; kk++)
219 for (
unsigned ii = 0; ii < DIM; ii++)
221 for (
unsigned aa = 0; aa < DIM; aa++)
223 for (
unsigned bb = aa; bb < DIM; bb++)
225 d_G_dX(ll, kk, ii, aa, bb) =
226 interpolated_G(aa, ii) * dpsidxi(ll, kk, bb) +
227 interpolated_G(bb, ii) * dpsidxi(ll, kk, aa);
237 this->get_d_stress_dG_upper(g, G, sigma, d_stress_dG);
242 for (
unsigned i = 0;
i < DIM;
i++)
244 for (
unsigned j = 0; j < DIM; j++)
246 sigma(
i, j) += this->prestress(
i, j, interpolated_xi);
255 unsigned n_master = 1;
256 double hang_weight = 1.0;
259 for (
unsigned l = 0; l < n_node; l++)
262 Node* local_node_pt = this->node_pt(l);
265 bool is_hanging = local_node_pt->is_hanging();
270 n_master = local_node_pt->hanging_pt()->nmaster();
281 DenseMatrix<int> position_local_eqn_at_node(n_position_type, DIM);
284 for (
unsigned m = 0; m < n_master; m++)
289 position_local_eqn_at_node = this->local_position_hang_eqn(
290 local_node_pt->hanging_pt()->master_node_pt(m));
293 hang_weight = local_node_pt->hanging_pt()->master_weight(m);
298 for (
unsigned k = 0; k < n_position_type; k++)
301 for (
unsigned i = 0;
i < DIM;
i++)
303 position_local_eqn_at_node(k,
i) = this->position_local_eqn(l, k,
i);
312 for (
unsigned k = 0; k < n_position_type; k++)
315 const unsigned offset5 = dpsidxi.offset(l, k);
318 for (
unsigned i = 0;
i < DIM;
i++)
320 local_eqn = position_local_eqn_at_node(k,
i);
329 sum += (lambda_sq * accel[
i] - b[
i]) * psi(l, k);
332 for (
unsigned a = 0; a < DIM; a++)
334 unsigned count = offset5;
335 for (
unsigned b = 0; b < DIM; b++)
338 sum += sigma(a, b) * interpolated_G(a,
i) *
339 dpsidxi.raw_direct_access(count);
343 residuals[local_eqn] += W * sum * hang_weight;
350 const unsigned offset1 = d_G_dX.offset(l, k,
i);
353 unsigned nn_master = 1;
354 double hhang_weight = 1.0;
357 for (
unsigned ll = 0; ll < n_node; ll++)
360 Node* llocal_node_pt = this->node_pt(ll);
363 bool iis_hanging = llocal_node_pt->is_hanging();
368 nn_master = llocal_node_pt->hanging_pt()->nmaster();
379 DenseMatrix<int> position_local_unk_at_node(n_position_type,
383 for (
unsigned mm = 0; mm < nn_master; mm++)
388 position_local_unk_at_node = this->local_position_hang_eqn(
389 llocal_node_pt->hanging_pt()->master_node_pt(mm));
393 llocal_node_pt->hanging_pt()->master_weight(mm);
398 for (
unsigned kk = 0; kk < n_position_type; kk++)
401 for (
unsigned ii = 0; ii < DIM; ii++)
403 position_local_unk_at_node(kk, ii) =
404 this->position_local_eqn(ll, kk, ii);
414 for (
unsigned kk = 0; kk < n_position_type; kk++)
417 for (
unsigned ii = 0; ii < DIM; ii++)
421 position_local_unk_at_node(kk, ii);
425 if (local_unknown >= 0)
428 const unsigned offset2 = d_G_dX.offset(ll, kk, ii);
429 const unsigned offset4 = dpsidxi.offset(ll, kk);
435 unsigned count1 = offset1;
436 for (
unsigned a = 0; a < DIM; a++)
441 for (
unsigned b = a; b < DIM; b++)
444 d_G_dX.raw_direct_access(count1);
445 if (a == b) factor *= 0.5;
448 unsigned offset3 = d_stress_dG.offset(a, b);
449 unsigned count2 = offset2;
450 unsigned count3 = offset3;
452 for (
unsigned aa = 0; aa < DIM; aa++)
461 for (
unsigned bb = aa; bb < DIM; bb++)
465 d_stress_dG.raw_direct_access(count3) *
466 d_G_dX.raw_direct_access(count2);
477 jacobian(local_eqn, local_unknown) +=
478 sum * W * hang_weight * hhang_weight;
482 if ((
i == ii) && (local_unknown >= local_eqn))
488 sum += lambda_sq * time_factor * psi(ll, kk) *
491 * time_factor1 * psi(ll,kk) * psi(l,k);
494 unsigned count4 = offset4;
495 for (
unsigned a = 0; a < DIM; a++)
498 const double factor =
499 dpsidxi.raw_direct_access(count4);
502 unsigned count5 = offset5;
503 for (
unsigned b = 0; b < DIM; b++)
506 sigma(a, b) * factor *
507 dpsidxi.raw_direct_access(count5);
514 sum * W * hang_weight * hhang_weight;
516 jacobian(local_eqn, local_unknown) += sym_entry;
518 if (local_eqn != local_unknown)
520 jacobian(local_unknown, local_eqn) += sym_entry;
double dissipation_
Definition: RefineableQDPVDElement.h:539
ConstitutiveLaw * Constitutive_law_pt
Pointer to constitutive law.
Definition: TwenteMeshGluing.cpp:61
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
Mdouble gamma(Mdouble gamma_in)
This is the gamma function returns the true value for the half integer value.
Definition: ExtendedMath.cc:137