279 {
283 const auto t_packed_basis = FTensor::SymmLTensor<double, 3>();
285 const auto parameters = material_ptr->getParameters(getFEEntityHandle());
286 const double alpha_grad_u = material_ptr->alphaGradU;
287 auto t_h =
dataAtPts->getFTensorLogStretch(nbIntegrationPts);
288 auto t_physical =
dataAtPts->getFTensorAdjointPdU(nbIntegrationPts);
289
290 std::optional<
decltype(
dataAtPts->getFTensorLogStretchDot(
291 nbIntegrationPts))>
292 t_dot_h;
293 std::optional<
decltype(
dataAtPts->getFTensorGradLogStretchDot(
294 nbIntegrationPts))>
295 t_grad_dot_h;
297 t_dot_h.emplace(
dataAtPts->getFTensorLogStretchDot(nbIntegrationPts));
298 if (alpha_grad_u != 0.)
299 t_grad_dot_h.emplace(
300 dataAtPts->getFTensorGradLogStretchDot(nbIntegrationPts));
303 auto t_weight = getFTensor0IntegrationWeight();
304 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
306 t_log_stretch(
i,
j) = t_h(
i,
j);
308 double energy;
310 const double alpha = getMeasure() * t_weight;
312 t_residual(L) = t_stress(L) - t_physical(L);
313 if (t_dot_h)
314 t_residual(L) +=
315 alphaU * (t_packed_basis(
i,
j, L) * (*t_dot_h)(
i,
j));
317 t_gradient(L,
i) = 0.;
318 if (t_grad_dot_h)
319 t_gradient(L,
i) = alpha_grad_u * (*t_grad_dot_h)(
L,
i);
320 auto t_nf = getNf<size_symm>();
321 int rr = 0;
323 t_nf(L) += alpha *
324 (t_row * t_residual(L) + t_grad_row(
i) * t_gradient(L,
i));
325 ++t_nf;
326 ++t_row;
327 ++t_grad_row;
328 }
329 for (; rr != nbRowBaseFunctions; ++rr) {
330 ++t_row;
331 ++t_grad_row;
332 }
333 ++t_weight;
334 ++t_h;
335 ++t_physical;
336 if (t_dot_h)
337 ++*t_dot_h;
338 if (t_grad_dot_h)
339 ++*t_grad_dot_h;
340 }
342 }
#define FTENSOR_INDEXES(DIM,...)
#define FTENSOR_INDEX(DIM, I)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
static constexpr auto size_symm
static boost::shared_ptr< HMHNeohookean > getMaterial(const boost::shared_ptr< DataAtIntegrationPts > &data_ptr)
FTensor::Tensor1< double, size_symm > PackedStress
static MoFEMErrorCode evaluateDirect(const Material::Parameters ¶meters, const Material::SymmetricTensor &t_log_stretch, double &energy, PackedStress *stress_ptr=nullptr, PackedTangent *tangent_ptr=nullptr)
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
auto getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.