1022 {
1024
1031
1032 auto nb_integration_pts =
stressPtr->size2();
1033#ifndef NDEBUG
1034 if (nb_integration_pts != getGaussPts().size2()) {
1036 "inconsistent number of integration points");
1037 }
1038#endif
1039
1040 auto get_D = [&]() {
1043
1044 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
1046 dataAtPts->lambda = b.bulkModulusK - 2 * b.shearModulusG / 3;
1049 dataAtPts->getMatDeviatorDPtr(), b.bulkModulusK, b.shearModulusG);
1051 b.bulkModulusK, b.shearModulusG);
1053 }
1054 }
1055
1058
1061
1064
1071 };
1072
1074
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>(
1080#ifndef NDEBUG
1081 auto t_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
1083#endif
1084
1088
1089
1090
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);
1093
1094#ifndef NDEBUG
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);
1100 double nrm =
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
1109 << t_stress;
1111 "Norm is too big: " + std::to_string(nrm / nrm0));
1112 }
1113 ++t_D;
1114#endif
1115
1116 ++t_strain;
1117 ++t_stress;
1118 ++t_inv_D;
1119 }
1120
1122}
#define FTENSOR_INDEX(DIM, I)
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 ...
@ 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