v0.15.0
Loading...
Searching...
No Matches
EshelbianPlasticity::HMHHencky::OpCalculateStretchFromStress Struct Reference
Inheritance diagram for EshelbianPlasticity::HMHHencky::OpCalculateStretchFromStress:
[legend]
Collaboration diagram for EshelbianPlasticity::HMHHencky::OpCalculateStretchFromStress:
[legend]

Public Member Functions

 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 doWork (int side, EntityType type, EntData &data)
 

Private Attributes

boost::shared_ptr< DataAtIntegrationPtsdataAtPts
 data at integration pts
 
boost::shared_ptr< MatrixDouble > strainPtr
 
boost::shared_ptr< MatrixDouble > stressPtr
 
boost::shared_ptr< HMHHenckyhenckyPtr
 

Detailed Description

Definition at line 177 of file HMHHencky.cpp.

Constructor & Destructor Documentation

◆ OpCalculateStretchFromStress()

EshelbianPlasticity::HMHHencky::OpCalculateStretchFromStress::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 )

Definition at line 995 of file HMHHencky.cpp.

1000 : VolUserDataOperator(NOSPACE, OPSPACE), dataAtPts(data_ptr),
1001 strainPtr(strain_ptr), stressPtr(stress_ptr), henckyPtr(hencky_ptr) {}
@ NOSPACE
Definition definitions.h:83
VolumeElementForcesAndSourcesCore::UserDataOperator VolUserDataOperator
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
data at integration pts

Member Function Documentation

◆ doWork()

MoFEMErrorCode EshelbianPlasticity::HMHHencky::OpCalculateStretchFromStress::doWork ( int side,
EntityType type,
EntData & data )

Definition at line 1003 of file HMHHencky.cpp.

1005 {
1007
1014
1015 auto nb_integration_pts = stressPtr->size2();
1016#ifndef NDEBUG
1017 if (nb_integration_pts != getGaussPts().size2()) {
1018 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1019 "inconsistent number of integration points");
1020 }
1021#endif // NDEBUG
1022
1023 auto get_D = [&]() {
1025 for (auto &b : henckyPtr->blockData) {
1026
1027 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
1028 dataAtPts->mu = b.shearModulusG;
1029 dataAtPts->lambda = b.bulkModulusK - 2 * b.shearModulusG / 3;
1030 CHKERR henckyPtr->getMatDPtr(
1031 dataAtPts->getMatDPtr(), dataAtPts->getMatAxiatorDPtr(),
1032 dataAtPts->getMatDeviatorDPtr(), b.bulkModulusK, b.shearModulusG);
1033 CHKERR henckyPtr->getInvMatDPtr(dataAtPts->getMatInvDPtr(),
1034 b.bulkModulusK, b.shearModulusG);
1036 }
1037 }
1038
1039 const auto E = henckyPtr->E;
1040 const auto nu = henckyPtr->nu;
1041
1042 double bulk_modulus_K = E / (3 * (1 - 2 * nu));
1043 double shear_modulus_G = E / (2 * (1 + nu));
1044
1046 dataAtPts->lambda = bulk_modulus_K - 2 * shear_modulus_G / 3;
1047
1048 CHKERR henckyPtr->getMatDPtr(
1049 dataAtPts->getMatDPtr(), dataAtPts->getMatAxiatorDPtr(),
1050 dataAtPts->getMatDeviatorDPtr(), bulk_modulus_K, shear_modulus_G);
1051 CHKERR henckyPtr->getInvMatDPtr(dataAtPts->getMatInvDPtr(), bulk_modulus_K,
1054 };
1055
1056 CHKERR get_D();
1057
1058 strainPtr->resize(size_symm, nb_integration_pts, false);
1059 auto t_strain = getFTensor2SymmetricFromMat<3>(*strainPtr);
1060 auto t_stress = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(*stressPtr);
1061 auto t_inv_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
1062 &*dataAtPts->matInvD.data().begin());
1063#ifndef NDEBUG
1064 auto t_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
1065 &*dataAtPts->matD.data().begin());
1066#endif
1067
1068 const double lambda = dataAtPts->lambda;
1069 const double mu = dataAtPts->mu;
1071
1072 // note: add rotation, so we can extract rigid body motion, work then with
1073 // symmetric part.
1074 for (auto gg = 0; gg != nb_integration_pts; ++gg) {
1075 t_strain(i, j) = t_inv_D(i, j, k, l) * t_stress(k, l);
1076
1077#ifndef NDEBUG
1078 FTensor::Tensor2_symmetric<double, 3> t_stress_symm_debug;
1079 t_stress_symm_debug(i, j) = (t_stress(i, j) || t_stress(j, i)) / 2;
1080 FTensor::Tensor2_symmetric<double, 3> t_stress_symm_debug_diff;
1081 t_stress_symm_debug_diff(i, j) =
1082 t_D(i, j, k, l) * t_strain(k, l) - t_stress_symm_debug(i, j);
1083 double nrm =
1084 t_stress_symm_debug_diff(i, j) * t_stress_symm_debug_diff(i, j);
1085 double nrm0 = t_stress_symm_debug(i, j) * t_stress_symm_debug(i, j) +
1086 std::numeric_limits<double>::epsilon();
1087 constexpr double eps = 1e-10;
1088 if (std::fabs(std::sqrt(nrm / nrm0)) > eps) {
1089 MOFEM_LOG("SELF", Sev::error)
1090 << "Stress symmetry check failed: " << std::endl
1091 << t_stress_symm_debug_diff << std::endl
1092 << t_stress;
1094 "Norm is too big: " + std::to_string(nrm / nrm0));
1095 }
1096 ++t_D;
1097#endif
1098
1099 ++t_strain;
1100 ++t_stress;
1101 ++t_inv_D;
1102 }
1103
1105}
#define FTENSOR_INDEX(DIM, I)
static const double eps
constexpr int SPACE_DIM
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
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
double bulk_modulus_K
double shear_modulus_G
constexpr auto t_kd
auto get_D
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
static double lambda
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

Member Data Documentation

◆ dataAtPts

boost::shared_ptr<DataAtIntegrationPts> EshelbianPlasticity::HMHHencky::OpCalculateStretchFromStress::dataAtPts
private

data at integration pts

Definition at line 187 of file HMHHencky.cpp.

◆ henckyPtr

boost::shared_ptr<HMHHencky> EshelbianPlasticity::HMHHencky::OpCalculateStretchFromStress::henckyPtr
private

Definition at line 190 of file HMHHencky.cpp.

◆ strainPtr

boost::shared_ptr<MatrixDouble> EshelbianPlasticity::HMHHencky::OpCalculateStretchFromStress::strainPtr
private

Definition at line 188 of file HMHHencky.cpp.

◆ stressPtr

boost::shared_ptr<MatrixDouble> EshelbianPlasticity::HMHHencky::OpCalculateStretchFromStress::stressPtr
private

Definition at line 189 of file HMHHencky.cpp.


The documentation for this struct was generated from the following file: