12 #include <boost/math/constants/constants.hpp>
14 constexpr
double third = boost::math::constants::third<double>();
19 OpHMHH(
const int tag,
const bool eval_rhs,
const bool eval_lhs,
20 boost::shared_ptr<DataAtIntegrationPts> &data_ptr,
21 boost::shared_ptr<PhysicalEquations> &physics_ptr)
22 :
OpJacobian(tag, eval_rhs, eval_lhs, data_ptr, physics_ptr) {}
37 const auto nb_integration_pts = getGaussPts().size2();
38 auto iu = getFTensor2SymmetricFromMat<3>(dataAtPts->stretchTensorAtPts);
39 auto t_grad_h1 = getFTensor2FromMat<3, 3>(dataAtPts->wGradH1AtPts);
41 auto create_data_vec = [nb_integration_pts](
auto &
v) {
42 v.resize(nb_integration_pts,
false);
44 auto create_data_mat = [nb_integration_pts](
auto &
m) {
45 m.resize(9, nb_integration_pts,
false);
48 create_data_mat(dataAtPts->PAtPts);
51 auto r_P = getFTensor2FromMat<3, 3>(dataAtPts->PAtPts);
52 for (
unsigned int gg = 0; gg != nb_integration_pts; ++gg) {
56 switch (EshelbianCore::gradApperoximator) {
60 physicsPtr->get_h()(
i,
j) = iu(
i,
k) * t_h1(
k,
j);
63 physicsPtr->get_h()(
i,
j) = iu(
i,
j);
67 int r = ::function(tAg, physicsPtr->dependentVariablesPiola.size(),
68 physicsPtr->activeVariables.size(),
69 &physicsPtr->activeVariables[0],
70 &physicsPtr->dependentVariablesPiola[0]);
73 "ADOL-C function evaluation with error r = %d",
r);
76 switch (EshelbianCore::gradApperoximator) {
81 r_P(
k,
l) = physicsPtr->get_P()(
i,
j) * t_h1_du(
i,
j,
k,
l);
84 r_P(
i,
j) = physicsPtr->get_P()(
i,
j);
106 const int number_of_active_variables = physicsPtr->activeVariables.size();
107 const int number_of_dependent_variables =
108 physicsPtr->dependentVariablesPiola.size();
109 std::vector<double *> jac_ptr(number_of_dependent_variables);
110 for (
unsigned int n = 0;
n != number_of_dependent_variables; ++
n) {
113 ->dependentVariablesPiolaDirevatives[
n *
114 number_of_active_variables]);
117 const auto nb_integration_pts = getGaussPts().size2();
119 auto create_data_mat = [nb_integration_pts](
auto &
m) {
120 m.resize(9, nb_integration_pts,
false);
123 dataAtPts->P_du.resize(81, nb_integration_pts,
false);
125 auto iu = getFTensor2SymmetricFromMat<3>(dataAtPts->stretchTensorAtPts);
126 auto t_grad_h1 = getFTensor2FromMat<3, 3>(dataAtPts->wGradH1AtPts);
127 auto r_P_du = getFTensor4FromMat<3, 3, 3, 3>(dataAtPts->P_du);
135 for (
unsigned int gg = 0; gg != nb_integration_pts; ++gg) {
139 switch (EshelbianCore::gradApperoximator) {
143 physicsPtr->get_h()(
i,
j) = iu(
i,
k) * t_h1(
k,
j);
146 physicsPtr->get_h()(
i,
j) = iu(
i,
j);
151 int r = ::jacobian(tAg, number_of_dependent_variables,
152 number_of_active_variables,
153 &physicsPtr->activeVariables[0], &jac_ptr[0]);
156 "ADOL-C function evaluation with error");
160 t_P_dh_tmp(
i,
j, N0,
k) = physicsPtr->get_P_dh0()(
i,
j,
k);
161 t_P_dh_tmp(
i,
j, N1,
k) = physicsPtr->get_P_dh1()(
i,
j,
k);
162 t_P_dh_tmp(
i,
j, N2,
k) = physicsPtr->get_P_dh2()(
i,
j,
k);
164 switch (EshelbianCore::gradApperoximator) {
170 (t_P_dh_tmp(
i,
j, o, p) * t_h1_du(o, p,
m,
n)) * t_h1_du(
i,
j,
k,
l);
173 r_P_du(
i,
j,
m,
n) = t_P_dh_tmp(
i,
j,
m,
n);
186 static constexpr
int numberOfActiveVariables = 9;
187 static constexpr
int numberOfDependentVariables = 9;
199 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"stvenant_",
"",
"none");
201 CHKERR PetscOptionsScalar(
"-young_modulus",
"Young modulus",
"",
E, &
E,
203 CHKERR PetscOptionsScalar(
"-poisson_ratio",
"poisson ratio",
"", nu, &nu,
206 ierr = PetscOptionsEnd();
209 MOFEM_LOG(
"EP", Sev::inform) <<
"St Venant Kirchhoff model parameters: "
210 <<
"E = " <<
E <<
", nu = " << nu;
220 boost::shared_ptr<DataAtIntegrationPts> &data_ptr,
221 boost::shared_ptr<PhysicalEquations> &physics_ptr) {
222 return (
new OpHMHH(tag, eval_rhs, eval_lhs, data_ptr, physics_ptr));
267 ih(
i,
j) = (*t_h_ptr)(
i,
j);
274 enableMinMaxUsingAbs();
278 th(
i,
j) <<= get_h()(
i,
j);
285 tC(
I,
J) = tF(
i,
I) * tF(
i,
J);
294 energy = 0.5 *
lambda * trE * trE +
mu * (tE(
I,
J) * tE(
I,
J));
299 tS(N0, N0) +=
lambda * trE;
300 tS(N1, N1) +=
lambda * trE;
301 tS(N2, N2) +=
lambda * trE;
303 tP(
i,
J) = tF(
i,
I) * tS(
I,
J);
306 tP(
i,
j) >>= r_P(
i,
j);
316 static constexpr
int numberOfActiveVariables = 9;
317 static constexpr
int numberOfDependentVariables = 9;
326 boost::shared_ptr<DataAtIntegrationPts> &data_ptr,
327 boost::shared_ptr<PhysicalEquations> &physics_ptr) {
328 return (
new OpHMHH(tag, eval_rhs, eval_lhs, data_ptr, physics_ptr));
333 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"mooneyrivlin_",
"",
"none");
336 CHKERR PetscOptionsScalar(
"-alpha",
"Alpha",
"", alpha, &alpha, PETSC_NULL);
338 CHKERR PetscOptionsScalar(
"-beta",
"Beta",
"", beta, &beta, PETSC_NULL);
345 CHKERR PetscOptionsScalar(
"-epsilon",
"Epsilon",
"", epsilon, &epsilon,
348 ierr = PetscOptionsEnd();
404 ih(
i,
j) = (*t_h_ptr)(
i,
j);
411 enableMinMaxUsingAbs();
415 th(
i,
j) <<= get_h()(
i,
j);
421 tCof(
i,
I) = detF * tInvF(
I,
i);
423 A = tF(
k,
K) * tF(
k,
K);
424 B = tCof(
k,
K) * tCof(
k,
K);
426 tBF(
i,
I) = 4 * alpha * (
A * tF(
i,
I));
427 tBCof(
i,
I) = 4 * beta * (B * tCof(
i,
I));
428 tBj = (-12 * alpha - 24 * beta) / detF +
429 0.5 * (
lambda / epsilon) *
430 (pow(detF, epsilon - 1) - pow(detF, -epsilon - 1));
432 tP(
i,
I) = tBF(
i,
I);
435 tP(
i,
I) += tCof(
i,
I) * tBj;
438 tP(
i,
j) >>= r_P(
i,
j);
447 const int tape,
const double lambda,
const double mu,
448 const double sigma_y) {
450 physicalEquations = boost::make_shared<HMHStVenantKirchhoff>(
lambda,
mu);
451 CHKERR physicalEquations->recordTape(tape,
nullptr);
456 const int tape,
const double alpha,
const double beta,
const double lambda,
457 const double sigma_y) {
460 boost::make_shared<HMHPMooneyRivlinWriggersEq63>(alpha, beta,
lambda);
461 CHKERR physicalEquations->recordTape(tape,
nullptr);
474 boost::shared_ptr<HMHHencky> hencky_ptr)
475 :
OpJacobian(), dataAtGaussPts(data_ptr), henckyPtr(hencky_ptr) {
477 "getOptions failed");
479 "Can not get data from block");
486 for (
auto &b : henckyPtr->blockData) {
488 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
489 dataAtGaussPts->mu = b.bulkModulusK;
490 dataAtGaussPts->lambda = b.bulkModulusK;
491 CHKERR henckyPtr->getMatDPtr(dataAtGaussPts->getMatDPtr(),
492 dataAtGaussPts->getMatAxiatorDPtr(),
493 dataAtGaussPts->getMatDeviatorDPtr(),
494 b.bulkModulusK, b.shearModulusG);
499 const auto E = henckyPtr->E;
500 const auto nu = henckyPtr->nu;
508 CHKERR henckyPtr->getMatDPtr(dataAtGaussPts->getMatDPtr(),
509 dataAtGaussPts->getMatAxiatorDPtr(),
510 dataAtGaussPts->getMatDeviatorDPtr(),
526 boost::shared_ptr<DataAtIntegrationPts> &data_ptr,
527 boost::shared_ptr<PhysicalEquations> &physics_ptr) {
529 data_ptr, boost::dynamic_pointer_cast<HMHHencky>(physics_ptr)));
534 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"hencky_",
"",
"none");
536 CHKERR PetscOptionsScalar(
"-young_modulus",
"Young modulus",
"",
E, &
E,
538 CHKERR PetscOptionsScalar(
"-poisson_ratio",
"poisson ratio",
"", nu, &nu,
541 ierr = PetscOptionsEnd();
548 return extractBlockData(
552 (boost::format(
"%s(.*)") %
"MAT_ELASTIC").str()
564 for (
auto m : meshset_vec_ptr) {
566 std::vector<double> block_data;
567 CHKERR m->getAttributes(block_data);
568 if (block_data.size() != 2) {
570 "Expected that block has two attribute");
572 auto get_block_ents = [&]() {
574 CHKERR mField.get_moab().get_entities_by_handle(
m->meshset, ents,
true);
593 boost::shared_ptr<MatrixDouble> mat_axiator_D_ptr,
594 boost::shared_ptr<MatrixDouble> mat_deviator_D_ptr,
598 auto set_material_stiffness = [&]() {
608 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*mat_D_ptr);
610 getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*mat_axiator_D_ptr);
612 getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*mat_deviator_D_ptr);
613 t_axiator_D(
i,
j,
k,
l) =
A *
616 t_deviator_D(
i,
j,
k,
l) =
618 t_D(
i,
j,
k,
l) = t_axiator_D(
i,
j,
k,
l) + t_deviator_D(
i,
j,
k,
l);
625 set_material_stiffness();
645 physicalEquations = boost::make_shared<HMHHencky>(mField,
E, nu);