22 boost::shared_ptr<HMHHencky> hencky_ptr)
27 "Can not get data from block");
30 MoFEMErrorCode
doWork(
int side, EntityType type,
31 EntitiesFieldData::EntData &data) {
41 b.bulkModulusK, b.shearModulusG);
72 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
73 boost::shared_ptr<PhysicalEquations> physics_ptr) {
75 data_ptr, boost::dynamic_pointer_cast<HMHHencky>(physics_ptr)));
81 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
82 const double alpha_u);
97 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
98 const double alpha_u) {
105 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
106 boost::shared_ptr<ExternalStrainVec> &external_strain_vec_ptr,
107 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv);
118 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
119 boost::shared_ptr<ExternalStrainVec> external_strain_vec_ptr,
120 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv)
123 field_name, data_ptr, external_strain_vec_ptr, smv);
129 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
143 std::string row_field, std::string col_field,
144 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
const double alpha) {
164 boost::shared_ptr<double> total_energy_ptr);
165 MoFEMErrorCode
doWork(
int side, EntityType type,
EntData &data);
174 boost::shared_ptr<double> total_energy_ptr) {
180 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
181 boost::shared_ptr<MatrixDouble> strain_ptr,
182 boost::shared_ptr<MatrixDouble> stress_ptr,
183 boost::shared_ptr<HMHHencky> hencky_ptr);
184 MoFEMErrorCode
doWork(
int side, EntityType type,
EntData &data);
187 boost::shared_ptr<DataAtIntegrationPts>
195 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
196 boost::shared_ptr<PhysicalEquations> physics_ptr) {
198 data_ptr, data_ptr->getLogStretchTensorAtPts(),
199 data_ptr->getApproxPAtPts(),
200 boost::dynamic_pointer_cast<HMHHencky>(physics_ptr));
204 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
205 boost::shared_ptr<PhysicalEquations> physics_ptr) {
207 data_ptr, data_ptr->getVarLogStreachPts(), data_ptr->getVarPiolaPts(),
208 boost::dynamic_pointer_cast<HMHHencky>(physics_ptr));
211 MoFEMErrorCode
getOptions(boost::shared_ptr<DataAtIntegrationPts> data_ptr) {
213 PetscOptionsBegin(PETSC_COMM_WORLD,
"hencky_",
"",
"none");
215 CHKERR PetscOptionsScalar(
"-young_modulus",
"Young modulus",
"",
E, &
E,
217 CHKERR PetscOptionsScalar(
"-poisson_ratio",
"poisson ratio",
"",
nu, &
nu,
223 <<
"Hencky: E = " <<
E <<
" nu = " <<
nu;
236 (boost::format(
"%s(.*)") %
"MAT_ELASTIC").str()
248 for (
auto m : meshset_vec_ptr) {
250 std::vector<double> block_data;
251 CHKERR m->getAttributes(block_data);
252 if (block_data.size() < 2) {
254 "Expected that block has atleast two attributes");
256 auto get_block_ents = [&]() {
276 MoFEMErrorCode
getMatDPtr(boost::shared_ptr<MatrixDouble> mat_D_ptr,
277 boost::shared_ptr<MatrixDouble> mat_axiator_D_ptr,
278 boost::shared_ptr<MatrixDouble> mat_deviator_D_ptr,
282 auto set_material_stiffness = [&]() {
288 auto t_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
289 &*(mat_D_ptr->data().begin()));
290 auto t_axiator_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
291 &*mat_axiator_D_ptr->data().begin());
292 auto t_deviator_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
293 &*mat_deviator_D_ptr->data().begin());
296 t_deviator_D(
i,
j,
k,
l) =
298 t_D(
i,
j,
k,
l) = t_axiator_D(
i,
j,
k,
l) + t_deviator_D(
i,
j,
k,
l);
305 set_material_stiffness();
314 auto set_material_compilance = [&]() {
323 auto t_inv_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
324 &*(mat_inv_D_ptr->data().begin()));
325 t_inv_D(
i,
j,
k,
l) =
331 set_material_compilance();
355 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
const double alpha_u)
358 CHK_MOAB_THROW(PetscOptionsGetBool(PETSC_NULLPTR,
"",
"-poly_convex",
360 "get polyconvex option failed");
366 CHKERR integratePolyconvexHencky(data);
368 CHKERR integrateHencky(data);
380 int nb_integration_pts = data.
getN().size1();
381 auto v = getVolume();
382 auto t_w = getFTensor0IntegrationWeight();
383 auto t_approx_P_adjoint_log_du =
384 getFTensor1FromMat<size_symm>(dataAtPts->adjointPdUAtPts);
385 auto t_log_stretch_h1 =
386 getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchTotalTensorAtPts);
388 getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchDotTensorAtPts);
390 auto t_D = getFTensor4DdgFromPtr<3, 3, 0>(&*dataAtPts->matD.data().begin());
396 auto get_ftensor2 = [](
auto &
v) {
398 &
v[0], &
v[1], &
v[2], &
v[3], &
v[4], &
v[5]);
401 int nb_base_functions = data.
getN().size2();
403 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
405 auto t_nf = get_ftensor2(nF);
409 t_D(
i,
j,
k,
l) * (t_log_stretch_h1(
k,
l) + alphaU * t_dot_log_u(
k,
l));
412 a * (t_approx_P_adjoint_log_du(L) - t_L(
i,
j, L) * t_T(
i,
j));
415 for (; bb != nb_dofs / 6; ++bb) {
416 t_nf(L) -= t_row_base_fun * t_residual(L);
420 for (; bb != nb_base_functions; ++bb)
424 ++t_approx_P_adjoint_log_du;
439 int nb_integration_pts = data.
getN().size1();
440 auto v = getVolume();
441 auto t_w = getFTensor0IntegrationWeight();
442 auto t_approx_P_adjoint_log_du =
443 getFTensor1FromMat<size_symm>(dataAtPts->adjointPdUAtPts);
444 auto t_log_stretch_h1 =
445 getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchTotalTensorAtPts);
447 getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchDotTensorAtPts);
449 auto t_D = getFTensor4DdgFromPtr<3, 3, 0>(&*dataAtPts->matD.data().begin());
455 auto get_ftensor2 = [](
auto &
v) {
457 &
v[0], &
v[1], &
v[2], &
v[3], &
v[4], &
v[5]);
460 constexpr double nohat_k = 1. / 4;
461 constexpr double hat_k = 1. / 8;
462 double mu = dataAtPts->mu;
463 double lambda = dataAtPts->lambda;
465 constexpr double third = boost::math::constants::third<double>();
469 int nb_base_functions = data.
getN().size2();
471 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
473 auto t_nf = get_ftensor2(nF);
475 double log_det = t_log_stretch_h1(
i,
i);
476 double log_det2 = log_det * log_det;
479 double dev_norm2 = t_dev(
i,
j) * t_dev(
i,
j);
482 auto A = 2 *
mu * std::exp(nohat_k * dev_norm2);
483 auto B =
lambda * std::exp(hat_k * log_det2) * log_det;
486 A * (t_dev(
k,
l) * t_diff_deviator(
k,
l,
i,
j))
494 alphaU * t_D(
i,
j,
k,
l) * t_dot_log_u(
k,
l);
498 a * (t_approx_P_adjoint_log_du(L) - t_L(
i,
j, L) * t_T(
i,
j));
501 for (; bb != nb_dofs /
size_symm; ++bb) {
502 t_nf(L) -= t_row_base_fun * t_residual(L);
506 for (; bb != nb_base_functions; ++bb)
510 ++t_approx_P_adjoint_log_du;
518 std::string row_field, std::string col_field,
519 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
const double alpha)
524 CHK_MOAB_THROW(PetscOptionsGetBool(PETSC_NULLPTR,
"",
"-poly_convex",
526 "get polyconvex option failed");
531 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
532 boost::shared_ptr<ExternalStrainVec> &external_strain_vec_ptr,
533 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv)
535 externalStrainVecPtr(external_strain_vec_ptr), scalingMethodsMap(smv) {}
551 for (
auto &ext_strain_block : (*externalStrainVecPtr)) {
553 if (ext_strain_block.ents.find(fe_ent) != ext_strain_block.ents.end()) {
556 if (scalingMethodsMap.find(ext_strain_block.blockName) !=
557 scalingMethodsMap.end()) {
559 scalingMethodsMap.at(ext_strain_block.blockName)->getScale(time);
562 <<
"No scaling method found for " << ext_strain_block.blockName;
566 int nb_integration_pts = data.
getN().size1();
567 auto v = getVolume();
568 auto t_w = getFTensor0IntegrationWeight();
571 double external_strain_val;
572 VectorDouble v_external_strain;
573 auto block_name =
"(.*)ANALYTICAL_EXTERNALSTRAIN(.*)";
574 std::regex reg_name(block_name);
575 if (std::regex_match(ext_strain_block.blockName, reg_name)) {
576 VectorDouble analytical_external_strain;
577 std::string block_name_tmp;
578 std::tie(block_name_tmp, v_external_strain) =
580 ext_strain_block.blockName);
583 external_strain_val =
scale * ext_strain_block.val;
585 v_external_strain.resize(nb_integration_pts);
586 std::fill(v_external_strain.begin(), v_external_strain.end(),
587 external_strain_val);
589 auto t_external_strain = getFTensor0FromVec(v_external_strain);
597 auto get_ftensor2 = [](
auto &
v) {
599 &
v[0], &
v[1], &
v[2], &
v[3], &
v[4], &
v[5]);
602 int nb_base_functions = data.
getN().size2();
604 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
605 auto tr = 3.0 * t_external_strain;
607 auto t_nf = get_ftensor2(nF);
614 t_residual(L) =
a * (t_L(
i,
j, L) * t_T(
i,
j));
617 for (; bb != nb_dofs / 6; ++bb) {
618 t_nf(L) += t_row_base_fun * t_residual(L);
622 for (; bb != nb_base_functions; ++bb)
639 CHKERR integratePolyconvexHencky(row_data, col_data);
641 CHKERR integrateHencky(row_data, col_data);
656 int nb_integration_pts = row_data.
getN().size1();
657 int row_nb_dofs = row_data.
getIndices().size();
658 int col_nb_dofs = col_data.
getIndices().size();
660 auto get_ftensor2 = [](MatrixDouble &
m,
const int r,
const int c) {
664 &
m(r + 0,
c + 0), &
m(r + 0,
c + 1), &
m(r + 0,
c + 2), &
m(r + 0,
c + 3),
665 &
m(r + 0,
c + 4), &
m(r + 0,
c + 5),
667 &
m(r + 1,
c + 0), &
m(r + 1,
c + 1), &
m(r + 1,
c + 2), &
m(r + 1,
c + 3),
668 &
m(r + 1,
c + 4), &
m(r + 1,
c + 5),
670 &
m(r + 2,
c + 0), &
m(r + 2,
c + 1), &
m(r + 2,
c + 2), &
m(r + 2,
c + 3),
671 &
m(r + 2,
c + 4), &
m(r + 2,
c + 5),
673 &
m(r + 3,
c + 0), &
m(r + 3,
c + 1), &
m(r + 3,
c + 2), &
m(r + 3,
c + 3),
674 &
m(r + 3,
c + 4), &
m(r + 3,
c + 5),
676 &
m(r + 4,
c + 0), &
m(r + 4,
c + 1), &
m(r + 4,
c + 2), &
m(r + 4,
c + 3),
677 &
m(r + 4,
c + 4), &
m(r + 4,
c + 5),
679 &
m(r + 5,
c + 0), &
m(r + 5,
c + 1), &
m(r + 5,
c + 2), &
m(r + 5,
c + 3),
680 &
m(r + 5,
c + 4), &
m(r + 5,
c + 5)
691 auto v = getVolume();
692 auto t_w = getFTensor0IntegrationWeight();
694 auto t_approx_P_adjoint__dstretch =
695 getFTensor2FromMat<3, 3>(dataAtPts->adjointPdstretchAtPts);
696 auto t_eigen_vals = getFTensor1FromMat<3>(dataAtPts->eigenVals);
697 auto t_eigen_vecs = getFTensor2FromMat<3, 3>(dataAtPts->eigenVecs);
699 int row_nb_base_functions = row_data.
getN().size2();
702 auto get_dP = [&]() {
704 auto ts_a = getTSa();
706 auto t_D = getFTensor4DdgFromPtr<3, 3, 0>(&*dataAtPts->matD.data().begin());
708 t_dP_tmp(L,
J) = -(1 + alphaU * ts_a) *
710 ((t_D(
i,
j,
m,
n) * t_diff(
m,
n,
k,
l)) * t_L(
k,
l,
J)));
714 auto t_approx_P_adjoint__dstretch =
715 getFTensor2FromMat<3, 3>(dataAtPts->adjointPdstretchAtPts);
716 auto t_eigen_vals = getFTensor1FromMat<3>(dataAtPts->eigenVals);
717 auto t_eigen_vecs = getFTensor2FromMat<3, 3>(dataAtPts->eigenVecs);
718 auto &nbUniq = dataAtPts->nbUniq;
720 auto t_dP = getFTensor2FromMat<size_symm, size_symm>(dP);
721 for (
auto gg = 0; gg != nb_integration_pts; ++gg) {
726 t_sym(
i,
j) = (t_approx_P_adjoint__dstretch(
i,
j) ||
727 t_approx_P_adjoint__dstretch(
j,
i));
732 t_dP(L,
J) = t_L(
i,
j, L) *
733 ((t_diff2_uP2(
i,
j,
k,
l) + t_diff2_uP2(
k,
l,
i,
j)) *
739 ++t_approx_P_adjoint__dstretch;
744 auto t_dP = getFTensor2FromMat<size_symm, size_symm>(dP);
745 for (
auto gg = 0; gg != nb_integration_pts; ++gg) {
746 t_dP(L,
J) = t_dP_tmp(L,
J);
751 return getFTensor2FromMat<size_symm, size_symm>(dP);
754 auto t_dP = get_dP();
755 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
759 for (; rr != row_nb_dofs / 6; ++rr) {
761 auto t_m = get_ftensor2(K, 6 * rr, 0);
762 for (
int cc = 0; cc != col_nb_dofs / 6; ++cc) {
763 const double b =
a * t_row_base_fun * t_col_base_fun;
764 t_m(L,
J) -= b * t_dP(L,
J);
771 for (; rr != row_nb_base_functions; ++rr) {
790 int nb_integration_pts = row_data.
getN().size1();
791 int row_nb_dofs = row_data.
getIndices().size();
792 int col_nb_dofs = col_data.
getIndices().size();
794 auto get_ftensor2 = [](MatrixDouble &
m,
const int r,
const int c) {
798 &
m(r + 0,
c + 0), &
m(r + 0,
c + 1), &
m(r + 0,
c + 2), &
m(r + 0,
c + 3),
799 &
m(r + 0,
c + 4), &
m(r + 0,
c + 5),
801 &
m(r + 1,
c + 0), &
m(r + 1,
c + 1), &
m(r + 1,
c + 2), &
m(r + 1,
c + 3),
802 &
m(r + 1,
c + 4), &
m(r + 1,
c + 5),
804 &
m(r + 2,
c + 0), &
m(r + 2,
c + 1), &
m(r + 2,
c + 2), &
m(r + 2,
c + 3),
805 &
m(r + 2,
c + 4), &
m(r + 2,
c + 5),
807 &
m(r + 3,
c + 0), &
m(r + 3,
c + 1), &
m(r + 3,
c + 2), &
m(r + 3,
c + 3),
808 &
m(r + 3,
c + 4), &
m(r + 3,
c + 5),
810 &
m(r + 4,
c + 0), &
m(r + 4,
c + 1), &
m(r + 4,
c + 2), &
m(r + 4,
c + 3),
811 &
m(r + 4,
c + 4), &
m(r + 4,
c + 5),
813 &
m(r + 5,
c + 0), &
m(r + 5,
c + 1), &
m(r + 5,
c + 2), &
m(r + 5,
c + 3),
814 &
m(r + 5,
c + 4), &
m(r + 5,
c + 5)
825 auto v = getVolume();
826 auto t_w = getFTensor0IntegrationWeight();
828 int row_nb_base_functions = row_data.
getN().size2();
831 auto get_dP = [&]() {
833 auto ts_a = getTSa();
835 auto t_D = getFTensor4DdgFromPtr<3, 3, 0>(&*dataAtPts->matD.data().begin());
837 constexpr double nohat_k = 1. / 4;
838 constexpr double hat_k = 1. / 8;
839 double mu = dataAtPts->mu;
840 double lambda = dataAtPts->lambda;
842 constexpr double third = boost::math::constants::third<double>();
846 auto t_approx_P_adjoint__dstretch =
847 getFTensor2FromMat<3, 3>(dataAtPts->adjointPdstretchAtPts);
848 auto t_log_stretch_h1 =
849 getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchTotalTensorAtPts);
850 auto t_eigen_vals = getFTensor1FromMat<3>(dataAtPts->eigenVals);
851 auto t_eigen_vecs = getFTensor2FromMat<3, 3>(dataAtPts->eigenVecs);
852 auto &nbUniq = dataAtPts->nbUniq;
854 auto t_dP = getFTensor2FromMat<size_symm, size_symm>(dP);
855 for (
auto gg = 0; gg != nb_integration_pts; ++gg) {
857 double log_det = t_log_stretch_h1(
i,
i);
858 double log_det2 = log_det * log_det;
861 double dev_norm2 = t_dev(
i,
j) * t_dev(
i,
j);
863 auto A = 2 *
mu * std::exp(nohat_k * dev_norm2);
864 auto B =
lambda * std::exp(hat_k * log_det2) * log_det;
868 (
A * 2 * nohat_k) * (t_dev(
k,
l) * t_diff_deviator(
k,
l,
i,
j));
869 t_B_diff(
i,
j) = (
B * 2 * hat_k) * log_det *
t_kd(
i,
j) +
873 t_A_diff(
i,
j) * (t_dev(
m,
n) * t_diff_deviator(
m,
n,
k,
l))
877 A * t_diff_deviator(
m,
n,
i,
j) * t_diff_deviator(
m,
n,
k,
l)
883 t_dP(L,
J) = -t_L(
i,
j, L) *
890 (alphaU * ts_a) * (t_D(
i,
j,
m,
n) * t_diff(
m,
n,
k,
l)
900 t_sym(
i,
j) = (t_approx_P_adjoint__dstretch(
i,
j) ||
901 t_approx_P_adjoint__dstretch(
j,
i));
906 t_dP(L,
J) += t_L(
i,
j, L) *
907 ((t_diff2_uP2(
i,
j,
k,
l) + t_diff2_uP2(
k,
l,
i,
j)) *
913 ++t_approx_P_adjoint__dstretch;
919 return getFTensor2FromMat<size_symm, size_symm>(dP);
922 auto t_dP = get_dP();
923 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
927 for (; rr != row_nb_dofs / 6; ++rr) {
929 auto t_m = get_ftensor2(K, 6 * rr, 0);
930 for (
int cc = 0; cc != col_nb_dofs / 6; ++cc) {
931 const double b =
a * t_row_base_fun * t_col_base_fun;
932 t_m(L,
J) -= b * t_dP(L,
J);
939 for (; rr != row_nb_base_functions; ++rr) {
950 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
951 boost::shared_ptr<double> total_energy_ptr)
953 totalEnergyPtr(total_energy_ptr) {
957 "dataAtPts is not allocated. Please set it before "
958 "using this operator.");
972 int nb_integration_pts = getGaussPts().size2();
974 getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchTotalTensorAtPts);
977 auto &mat_d = dataAtPts->matD;
980 "wrong matD size, should be 6 by 6 but is %d by %d",
size_symm,
984 auto t_D = getFTensor4DdgFromPtr<3, 3, 0>(mat_d.data().data());
986 dataAtPts->energyAtPts.resize(nb_integration_pts,
false);
987 auto t_energy = getFTensor0FromVec(dataAtPts->energyAtPts);
989 for (
auto gg = 0; gg != nb_integration_pts; ++gg) {
991 t_energy = 0.5 * (t_log_u(
i,
j) * (t_D(
i,
j,
k,
l) * t_log_u(
k,
l)));
997 if (totalEnergyPtr) {
998 auto t_w = getFTensor0IntegrationWeight();
999 auto t_energy = getFTensor0FromVec(dataAtPts->energyAtPts);
1000 double loc_energy = 0;
1001 for (
auto gg = 0; gg != nb_integration_pts; ++gg) {
1002 loc_energy += t_energy * t_w;
1006 *totalEnergyPtr += getMeasure() * loc_energy;
1013 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1014 boost::shared_ptr<MatrixDouble> strain_ptr,
1015 boost::shared_ptr<MatrixDouble> stress_ptr,
1016 boost::shared_ptr<HMHHencky> hencky_ptr)
1018 strainPtr(strain_ptr), stressPtr(stress_ptr), henckyPtr(hencky_ptr) {}
1032 auto nb_integration_pts = stressPtr->size2();
1034 if (nb_integration_pts != getGaussPts().size2()) {
1036 "inconsistent number of integration points");
1040 auto get_D = [&]() {
1042 for (
auto &b : henckyPtr->blockData) {
1044 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
1045 dataAtPts->mu = b.shearModulusG;
1046 dataAtPts->lambda = b.bulkModulusK - 2 * b.shearModulusG / 3;
1047 CHKERR henckyPtr->getMatDPtr(
1048 dataAtPts->getMatDPtr(), dataAtPts->getMatAxiatorDPtr(),
1049 dataAtPts->getMatDeviatorDPtr(), b.bulkModulusK, b.shearModulusG);
1050 CHKERR henckyPtr->getInvMatDPtr(dataAtPts->getMatInvDPtr(),
1051 b.bulkModulusK, b.shearModulusG);
1056 const auto E = henckyPtr->E;
1057 const auto nu = henckyPtr->nu;
1065 CHKERR henckyPtr->getMatDPtr(
1066 dataAtPts->getMatDPtr(), dataAtPts->getMatAxiatorDPtr(),
1075 strainPtr->resize(
size_symm, nb_integration_pts,
false);
1076 auto t_strain = getFTensor2SymmetricFromMat<3>(*strainPtr);
1077 auto t_stress = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*stressPtr);
1078 auto t_inv_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
1079 &*dataAtPts->matInvD.data().begin());
1081 auto t_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
1082 &*dataAtPts->matD.data().begin());
1085 const double lambda = dataAtPts->lambda;
1086 const double mu = dataAtPts->mu;
1091 for (
auto gg = 0; gg != nb_integration_pts; ++gg) {
1092 t_strain(
i,
j) = t_inv_D(
i,
j,
k,
l) * t_stress(
k,
l);
1096 t_stress_symm_debug(
i,
j) = (t_stress(
i,
j) || t_stress(
j,
i)) / 2;
1098 t_stress_symm_debug_diff(
i,
j) =
1099 t_D(
i,
j,
k,
l) * t_strain(
k,
l) - t_stress_symm_debug(
i,
j);
1101 t_stress_symm_debug_diff(
i,
j) * t_stress_symm_debug_diff(
i,
j);
1102 double nrm0 = t_stress_symm_debug(
i,
j) * t_stress_symm_debug(
i,
j) +
1103 std::numeric_limits<double>::epsilon();
1104 constexpr double eps = 1e-10;
1105 if (std::fabs(std::sqrt(nrm / nrm0)) >
eps) {
1107 <<
"Stress symmetry check failed: " << std::endl
1108 << t_stress_symm_debug_diff << std::endl
1111 "Norm is too big: " + std::to_string(nrm / nrm0));
1124template <
typename OP_PTR>
1125std::tuple<std::string, VectorDouble>
1127 const std::string block_name) {
1129 auto nb_gauss_pts = op_ptr->getGaussPts().size2();
1131 auto ts_time = op_ptr->getTStime();
1132 auto ts_time_step = op_ptr->getTStimeStep();
1138 MatrixDouble m_ref_coords = op_ptr->getCoordsAtGaussPts();
1141 ts_time_step, ts_time, nb_gauss_pts, m_ref_coords, block_name);
1144 if (v_analytical_expr.size() != nb_gauss_pts)
1146 "Wrong number of integration pts");
1149 return std::make_tuple(block_name, v_analytical_expr);
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define FTENSOR_INDEX(DIM, I)
static PetscErrorCode ierr
constexpr int SPACE_DIM
[Define dimension]
Kronecker Delta class symmetric.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
auto get_D
Create deviatoric stress tensor.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
const double v
phase velocity of light in medium (cm/ns)
const double n
refractive index of diffusive medium
FTensor::Index< 'J', DIM1 > J
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
auto getDiffDiffMat(A &&t_val, B &&t_vec, Fun< double > f, Fun< double > d_f, Fun< double > dd_f, C &&t_S, const int nb)
Get the Diff Diff Mat object.
VectorDouble analytical_externalstrain_function(double delta_t, double t, int nb_gauss_pts, MatrixDouble &m_ref_coords, const std::string block_name)
auto diff_deviator(FTensor::Ddg< double, 3, 3 > &&t_diff_stress)
std::tuple< std::string, VectorDouble > getAnalyticalExternalStrain(OP_PTR op_ptr, VectorDouble &analytical_expr, const std::string block_name)
ForcesAndSourcesCore::UserDataOperator UserDataOperator
static constexpr auto size_symm
constexpr AssemblyType A
[Define dimension]
constexpr auto field_name
FTensor::Index< 'm', 3 > m
static enum StretchSelector stretchSelector
static double dynamicTime
static enum RotSelector gradApproximator
static PetscBool dynamicRelaxation
static boost::function< double(const double)> f
static boost::function< double(const double)> dd_f
static boost::function< double(const double)> d_f
Calculate energy density for Hencky material model.
boost::shared_ptr< double > totalEnergyPtr
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
OpCalculateEnergy(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< double > total_energy_ptr)
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
boost::shared_ptr< MatrixDouble > strainPtr
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
data at integration pts
boost::shared_ptr< HMHHencky > henckyPtr
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
boost::shared_ptr< MatrixDouble > stressPtr
OpCalculateStretchFromStress(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< MatrixDouble > strain_ptr, boost::shared_ptr< MatrixDouble > stress_ptr, boost::shared_ptr< HMHHencky > hencky_ptr)
MoFEMErrorCode evaluateRhs(EntData &data)
boost::shared_ptr< HMHHencky > henckyPtr
MoFEMErrorCode evaluateLhs(EntData &data)
OpHenckyJacobian(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< HMHHencky > hencky_ptr)
boost::shared_ptr< DataAtIntegrationPts > dataAtGaussPts
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
std::map< std::string, boost::shared_ptr< ScalingMethod > > scalingMethodsMap
boost::shared_ptr< ExternalStrainVec > externalStrainVecPtr
OpSpatialPhysicalExternalStrain(const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< ExternalStrainVec > &external_strain_vec_ptr, std::map< std::string, boost::shared_ptr< ScalingMethod > > smv)
MoFEMErrorCode integrate(EntData &data)
OpSpatialPhysical_du_du(std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha)
MoFEMErrorCode integrateHencky(EntData &row_data, EntData &col_data)
MoFEMErrorCode integratePolyconvexHencky(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integratePolyconvexHencky(EntData &data)
OpSpatialPhysical(const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha_u)
MoFEMErrorCode integrateHencky(EntData &data)
MoFEMErrorCode integrate(EntData &data)
virtual VolUserDataOperator * returnOpSpatialPhysical(const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha_u)
VolUserDataOperator * returnOpCalculateStretchFromStress(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
MoFEMErrorCode extractBlockData(Sev sev)
Sev getOptionsSeverityLevels
std::vector< BlockData > blockData
MoFEMErrorCode extractBlockData(std::vector< const CubitMeshSets * > meshset_vec_ptr, Sev sev)
HMHHencky(MoFEM::Interface &m_field, const double E, const double nu)
VolUserDataOperator * returnOpCalculateVarStretchFromStress(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
VolUserDataOperator * returnOpCalculateEnergy(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< double > total_energy_ptr)
MoFEMErrorCode getMatDPtr(boost::shared_ptr< MatrixDouble > mat_D_ptr, boost::shared_ptr< MatrixDouble > mat_axiator_D_ptr, boost::shared_ptr< MatrixDouble > mat_deviator_D_ptr, double bulk_modulus_K, double shear_modulus_G)
MoFEMErrorCode getOptions(boost::shared_ptr< DataAtIntegrationPts > data_ptr)
virtual UserDataOperator * returnOpJacobian(const int tag, const bool eval_rhs, const bool eval_lhs, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
VolUserDataOperator * returnOpSpatialPhysical_du_du(std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha)
MoFEM::Interface & mField
virtual VolUserDataOperator * returnOpSpatialPhysicalExternalStrain(const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< ExternalStrainVec > external_strain_vec_ptr, std::map< std::string, boost::shared_ptr< ScalingMethod > > smv)
MoFEMErrorCode recordTape(const int tag, DTensor2Ptr *t_h)
MoFEMErrorCode getInvMatDPtr(boost::shared_ptr< MatrixDouble > mat_inv_D_ptr, double bulk_modulus_K, double shear_modulus_G)
virtual moab::Interface & get_moab()=0
bool sYmm
If true assume that matrix is symmetric structure.
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.
EntityHandle getFEEntityHandle() const
Return finite element entity handle.
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
PetscReal ts_t
Current time value.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
double young_modulus
Young modulus.
double poisson_ratio
Poisson ratio.