157 const unsigned DIM = this->dim();
161 lin_mo.initialise(0);
162 ang_mo.initialise(0);
168 unsigned n_intpt = this->integral_pt()->nweight();
171 Vector<double> s(DIM);
174 const unsigned n_node = this->nnode();
177 const unsigned n_position_type = this->nnodal_position_type();
180 Shape psi(n_node, n_position_type);
181 DShape dpsidxi(n_node, n_position_type, DIM);
184 double lambda_sq = this->lambda_sq();
187 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
190 for (
unsigned i = 0;
i < DIM;
i++)
191 { s[
i] = this->integral_pt()->knot(ipt,
i); }
194 double w = this->integral_pt()->weight(ipt);
197 double J = this->dshape_lagrangian_at_knot(ipt, psi, dpsidxi);
200 Vector<double> interpolated_xi(DIM, 0.0);
201 Vector<double> veloc(DIM, 0.0);
204 for (
unsigned l = 0; l < n_node; l++)
207 for (
unsigned k = 0; k < n_position_type; k++)
210 for (
unsigned i = 0;
i < DIM;
i++)
213 interpolated_xi[
i] += this->lagrangian_position_gen(l, k,
i) * psi(l, k);
218 veloc[
i] += this->dnodal_position_gen_dt(l, k,
i) * psi(l, k);
226 this->get_isotropic_growth(ipt, s, interpolated_xi,
gamma);
230 double W =
gamma * w * J;
232 DenseMatrix<double> sigma(DIM, DIM);
233 DenseMatrix<double> strain(DIM, DIM);
236 this->get_stress(s, sigma);
239 for (
unsigned i = 0;
i < DIM;
i++)
241 for (
unsigned j = 0; j < DIM; j++)
243 sigma(
i, j) += this->prestress(
i, j, interpolated_xi);
248 this->get_strain(s, strain);
251 double local_pot_en = 0;
255 for (
unsigned i = 0;
i < DIM;
i++)
257 for (
unsigned j = 0; j < DIM; j++)
259 local_pot_en += sigma(
i, j) * strain(
i, j);
261 veloc_sq += veloc[
i] * veloc[
i];
265 mass += lambda_sq * W;
267 Vector<double> cross_product(DIM, 0);
268 VectorHelpers::cross(interpolated_xi, veloc, cross_product);
269 for (
unsigned i = 0;
i < DIM;
i++)
271 lin_mo[
i] += lambda_sq * veloc[
i] * W;
272 ang_mo[
i] += lambda_sq * cross_product[
i] * W;
275 pot_en += 0.5 * local_pot_en * W;
277 kin_en += lambda_sq * 0.5 * veloc_sq * W;
Mdouble gamma(Mdouble gamma_in)
This is the gamma function returns the true value for the half integer value.
Definition: ExtendedMath.cc:137