v0.15.0
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
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 178 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 1012 of file HMHHencky.cpp.

1017 : VolUserDataOperator(NOSPACE, OPSPACE), dataAtPts(data_ptr),
1018 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 1020 of file HMHHencky.cpp.

1022 {
1024
1031
1032 auto nb_integration_pts = stressPtr->size2();
1033#ifndef NDEBUG
1034 if (nb_integration_pts != getGaussPts().size2()) {
1035 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1036 "inconsistent number of integration points");
1037 }
1038#endif // NDEBUG
1039
1040 auto get_D = [&]() {
1042 for (auto &b : henckyPtr->blockData) {
1043
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);
1053 }
1054 }
1055
1056 const auto E = henckyPtr->E;
1057 const auto nu = henckyPtr->nu;
1058
1059 double bulk_modulus_K = E / (3 * (1 - 2 * nu));
1060 double shear_modulus_G = E / (2 * (1 + nu));
1061
1063 dataAtPts->lambda = bulk_modulus_K - 2 * shear_modulus_G / 3;
1064
1065 CHKERR henckyPtr->getMatDPtr(
1066 dataAtPts->getMatDPtr(), dataAtPts->getMatAxiatorDPtr(),
1067 dataAtPts->getMatDeviatorDPtr(), bulk_modulus_K, shear_modulus_G);
1068 CHKERR henckyPtr->getInvMatDPtr(dataAtPts->getMatInvDPtr(), bulk_modulus_K,
1071 };
1072
1073 CHKERR get_D();
1074
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());
1080#ifndef NDEBUG
1081 auto t_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
1082 &*dataAtPts->matD.data().begin());
1083#endif
1084
1085 const double lambda = dataAtPts->lambda;
1086 const double mu = dataAtPts->mu;
1088
1089 // note: add rotation, so we can extract rigid body motion, work then with
1090 // symmetric part.
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
1095 FTensor::Tensor2_symmetric<double, 3> t_stress_symm_debug;
1096 t_stress_symm_debug(i, j) = (t_stress(i, j) || t_stress(j, i)) / 2;
1097 FTensor::Tensor2_symmetric<double, 3> t_stress_symm_debug_diff;
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) {
1106 MOFEM_LOG("SELF", Sev::error)
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)
static const double eps
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
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
Create deviatoric stress tensor.
#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
std::vector< BlockData > blockData

Member Data Documentation

◆ dataAtPts

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

data at integration pts

Definition at line 188 of file HMHHencky.cpp.

◆ henckyPtr

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

Definition at line 191 of file HMHHencky.cpp.

◆ strainPtr

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

Definition at line 189 of file HMHHencky.cpp.

◆ stressPtr

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

Definition at line 190 of file HMHHencky.cpp.


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