1055 {
1057
1064
1065 auto nb_integration_pts =
stressPtr->size2();
1066#ifndef NDEBUG
1067 if (nb_integration_pts != getGaussPts().size2()) {
1069 "inconsistent number of integration points");
1070 }
1071#endif
1072
1073 auto get_D = [&]() {
1076
1077 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
1079 dataAtPts->lambda = b.bulkModulusK - 2 * b.shearModulusG / 3;
1082 dataAtPts->getMatDeviatorDPtr(), b.bulkModulusK, b.shearModulusG);
1084 b.bulkModulusK, b.shearModulusG);
1086 }
1087 }
1088
1091
1094
1097
1104 };
1105
1107
1109 auto t_strain = getFTensor2SymmetricFromMat<3>(*
strainPtr);
1110 auto t_stress = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*
stressPtr);
1111 auto t_inv_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
1113#ifndef NDEBUG
1114 auto t_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
1116#endif
1117
1119
1120
1121
1122 for (auto gg = 0; gg != nb_integration_pts; ++gg) {
1123 t_strain(
i,
j) = t_inv_D(
i,
j,
k,
l) * t_stress(
k,
l);
1124
1125#ifndef NDEBUG
1127 t_stress_symm_debug(
i,
j) = (t_stress(
i,
j) || t_stress(
j,
i)) / 2;
1129 t_stress_symm_debug_diff(
i,
j) =
1130 t_D(
i,
j,
k,
l) * t_strain(
k,
l) - t_stress_symm_debug(
i,
j);
1131 double nrm =
1132 t_stress_symm_debug_diff(
i,
j) * t_stress_symm_debug_diff(
i,
j);
1133 double nrm0 = t_stress_symm_debug(
i,
j) * t_stress_symm_debug(
i,
j) +
1134 std::numeric_limits<double>::epsilon();
1135 constexpr double eps = 1e-10;
1136 if (std::fabs(std::sqrt(nrm / nrm0)) >
eps) {
1138 << "Stress symmetry check failed: " << std::endl
1139 << t_stress_symm_debug_diff << std::endl
1140 << t_stress;
1142 "Norm is too big: " + std::to_string(nrm / nrm0));
1143 }
1144 ++t_D;
1145#endif
1146
1147 ++t_strain;
1148 ++t_stress;
1149 ++t_inv_D;
1150 }
1151
1153}
#define FTENSOR_INDEX(DIM, I)
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 ...
@ 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.
FTensor::Index< 'i', SPACE_DIM > i
const double n
refractive index of diffusive medium
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
static constexpr auto size_symm
FTensor::Index< 'm', 3 > m
std::vector< BlockData > blockData