43struct CommonData :
public boost::enable_shared_from_this<CommonData> {
61 return boost::shared_ptr<BlockParams>(shared_from_this(), &
blockParams);
65 boost::shared_ptr<MatrixDouble>
mDPtr;
88 return boost::shared_ptr<VectorDouble>(shared_from_this(), &
plasticSurface);
91 return boost::shared_ptr<VectorDouble>(shared_from_this(), &
plasticTau);
94 return boost::shared_ptr<VectorDouble>(shared_from_this(), &
plasticTauDot);
97 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
plasticStrain);
100 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
104 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
plasticFlow);
120template <
int DIM, IntegrationType I,
typename DomainEleOp>
123template <
int DIM, IntegrationType I,
typename DomainEleOp>
126template <
int DIM, IntegrationType I,
typename DomainEleOp>
129template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
132template <IntegrationType I,
typename AssemblyDomainEleOp>
135template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
138template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
141template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
144template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
147template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
150template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
153template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
156template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
159template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
162template <IntegrationType I,
typename AssemblyDomainEleOp>
166 template <
int DIM, IntegrationType I>
170 template <
int DIM, IntegrationType I>
173 template <
int DIM, IntegrationType I>
181 template <
int DIM, IntegrationType I>
185 template <IntegrationType I>
189 template <
int DIM, IntegrationType I>
193 template <
int DIM, IntegrationType I>
198 template <
int DIM, IntegrationType I>
202 template <
int DIM, IntegrationType I>
206 template <
int DIM, IntegrationType I>
210 template <
int DIM, IntegrationType I>
214 template <
int DIM, IntegrationType I>
218 template <
int DIM, IntegrationType I>
222 template <
int DIM, IntegrationType I>
226 template <IntegrationType I>
242using Pip = boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator>;
249 boost::shared_ptr<MatrixDouble> mat_D_Ptr,
250 boost::shared_ptr<CommonData::BlockParams> mat_params_ptr,
251 double scale_value, Sev sev) {
255 OpMatBlocks(boost::shared_ptr<MatrixDouble> m_D_ptr,
256 boost::shared_ptr<CommonData::BlockParams> mat_params_ptr,
258 std::vector<const CubitMeshSets *> meshset_vec_ptr)
260 matParamsPtr(mat_params_ptr), scaleVal(scale_value) {
262 "Can not get data from block");
265 MoFEMErrorCode doWork(
int side, EntityType type,
266 EntitiesFieldData::EntData &data) {
269 auto getK = [](
auto &p) {
275 auto getG = [](
auto &p) {
281 auto scale_fun = [
this](
auto &p) {
282 p[CommonData::YOUNG_MODULUS] *= scaleVal;
283 p[CommonData::SIGMA_Y] *= scaleVal;
284 p[CommonData::H] *= scaleVal;
285 p[CommonData::VIS_H] *= scaleVal;
286 p[CommonData::QINF] *= scaleVal;
287 p[CommonData::C1_k] *= scaleVal;
290 for (
auto &b : blockData) {
291 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
292 *matParamsPtr = b.bParams;
293 scale_fun(*matParamsPtr);
294 CHKERR getMatDPtr(matDPtr, getK(*matParamsPtr), getG(*matParamsPtr));
301 scale_fun(*matParamsPtr);
302 CHKERR getMatDPtr(matDPtr, getK(*matParamsPtr), getG(*matParamsPtr));
308 boost::shared_ptr<MatrixDouble> matDPtr;
309 boost::shared_ptr<CommonData::BlockParams> matParamsPtr;
310 const double scaleVal;
313 std::array<double, CommonData::LAST_PARAM> bParams;
316 std::vector<BlockData> blockData;
328 std::vector<const CubitMeshSets *> meshset_vec_ptr,
332 for (
auto m : meshset_vec_ptr) {
334 std::vector<double> block_data;
335 CHKERR m->getAttributes(block_data);
336 if (block_data.size() != CommonData::LAST_PARAM) {
338 "Wrong number of block attribute");
340 auto get_block_ents = [&]() {
348 for (
auto i = 0;
i != CommonData::LAST_PARAM; ++
i) {
349 block_params[
i] = block_data[
i];
353 <<
"E = " << block_params[CommonData::YOUNG_MODULUS]
354 <<
" nu = " << block_params[CommonData::POISSON_RATIO];
357 <<
"sigma_y = " << block_params[CommonData::SIGMA_Y] << std::endl
358 <<
"h = " << block_params[CommonData::H] << std::endl
359 <<
"vis_h = " << block_params[CommonData::VIS_H] << std::endl
360 <<
"qinf = " << block_params[CommonData::QINF] << std::endl
361 <<
"biso = " << block_params[CommonData::BISO] << std::endl
362 <<
"C1_k = " << block_params[CommonData::C1_k] << std::endl;
364 blockData.push_back({block_params, get_block_ents()});
381 MoFEMErrorCode getMatDPtr(boost::shared_ptr<MatrixDouble> mat_D_ptr,
385 auto set_material_stiffness = [&]() {
391 double A = (DIM == 2)
395 auto t_D = getFTensor4DdgFromMat<DIM, DIM, 0>(*mat_D_ptr);
402 constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
404 set_material_stiffness();
410 pip.push_back(
new OpMatBlocks(
411 mat_D_Ptr, mat_params_ptr, scale_value, m_field, sev,
414 m_field.
getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
416 (boost::format(
"%s(.*)") % block_name).str()
425template <
int DIM, IntegrationType I,
typename DomainEleOp>
428 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
429 std::string u, std::string ep, std::string tau,
double scale, Sev sev) {
433 auto common_plastic_ptr = boost::make_shared<PlasticOps::CommonData>();
435 constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
436 auto make_d_mat = []() {
440 common_plastic_ptr->mDPtr = make_d_mat();
441 common_plastic_ptr->mGradPtr = boost::make_shared<MatrixDouble>();
442 common_plastic_ptr->mStrainPtr = boost::make_shared<MatrixDouble>();
443 common_plastic_ptr->mStressPtr = boost::make_shared<MatrixDouble>();
445 auto m_D_ptr = common_plastic_ptr->mDPtr;
448 common_plastic_ptr->getParamsPtr(),
450 "add mat block ops");
452 pip.push_back(
new OpCalculateScalarFieldValues(
453 tau, common_plastic_ptr->getPlasticTauPtr()));
454 pip.push_back(
new OpCalculateTensor2SymmetricFieldValues<DIM>(
455 ep, common_plastic_ptr->getPlasticStrainPtr()));
456 pip.push_back(
new OpCalculateVectorFieldGradient<DIM, DIM>(
457 u, common_plastic_ptr->mGradPtr));
462 common_hencky_ptr = boost::make_shared<HenckyOps::CommonData>();
463 common_hencky_ptr->matGradPtr = common_plastic_ptr->mGradPtr;
464 common_hencky_ptr->matDPtr = common_plastic_ptr->mDPtr;
465 common_hencky_ptr->matLogCPlastic =
466 common_plastic_ptr->getPlasticStrainPtr();
467 common_plastic_ptr->mStrainPtr = boost::shared_ptr<MatrixDouble>(
468 common_hencky_ptr->getMatLogC().get(),
470 common_plastic_ptr->mStressPtr = boost::shared_ptr<MatrixDouble>(
471 common_hencky_ptr->getMatHenckyStress().get(),
476 pip.push_back(
new typename H::template OpCalculateEigenVals<DIM, I>(
477 u, common_hencky_ptr));
479 new typename H::template OpCalculateLogC<DIM, I>(u, common_hencky_ptr));
480 pip.push_back(
new typename H::template OpCalculateLogC_dC<DIM, I>(
481 u, common_hencky_ptr));
483 new typename H::template OpCalculateHenckyPlasticStress<DIM, I, 0>(
484 u, common_hencky_ptr, m_D_ptr));
485 pip.push_back(
new typename H::template OpCalculatePiolaStress<DIM, I, 0>(
486 u, common_hencky_ptr));
489 pip.push_back(
new OpSymmetrizeTensor<SPACE_DIM>(
490 common_plastic_ptr->mGradPtr, common_plastic_ptr->mStrainPtr));
491 pip.push_back(
new typename P::template OpPlasticStress<DIM, I>(
492 common_plastic_ptr, m_D_ptr));
495 pip.push_back(
new typename P::template OpCalculatePlasticSurface<DIM, I>(
496 u, common_plastic_ptr));
498 return std::make_tuple(common_plastic_ptr, common_hencky_ptr);
501template <
int DIM, AssemblyType A, IntegrationType I,
typename DomainEleOp>
504 std::string u, std::string ep, std::string tau) {
507 using B =
typename FormsIntegrators<DomainEleOp>::template Assembly<
510 typename B::template OpGradTimesSymTensor<1, DIM, DIM>;
516 auto [common_plastic_ptr, common_hencky_ptr] =
517 createCommonPlasticOps<DIM, I, DomainEleOp>(m_field, block_name, pip, u,
518 ep, tau,
scale, Sev::inform);
520 auto m_D_ptr = common_plastic_ptr->mDPtr;
522 pip.push_back(
new OpCalculateTensor2SymmetricFieldValuesDot<DIM>(
523 ep, common_plastic_ptr->getPlasticStrainDotPtr()));
524 pip.push_back(
new OpCalculateScalarFieldValuesDot(
525 tau, common_plastic_ptr->getPlasticTauDotPtr()));
526 pip.push_back(
new typename P::template OpCalculatePlasticity<DIM, I>(
527 u, common_plastic_ptr, m_D_ptr));
530 if (common_hencky_ptr) {
532 u, common_hencky_ptr->getMatFirstPiolaStress()));
539 typename P::template Assembly<A>::template OpCalculateConstraintsRhs<I>(
540 tau, common_plastic_ptr, m_D_ptr));
542 new typename P::template Assembly<A>::template OpCalculatePlasticFlowRhs<
543 DIM,
I>(ep, common_plastic_ptr, m_D_ptr));
548template <
int DIM, AssemblyType A, IntegrationType I,
typename DomainEleOp>
551 std::string u, std::string ep, std::string tau) {
556 using B =
typename FormsIntegrators<DomainEleOp>::template Assembly<
558 using OpKPiola =
typename B::template OpGradTensorGrad<1, DIM, DIM, 1>;
559 using OpKCauchy =
typename B::template OpGradSymTensorGrad<1, DIM, DIM, 0>;
563 auto [common_plastic_ptr, common_hencky_ptr] =
564 createCommonPlasticOps<DIM, I, DomainEleOp>(m_field, block_name, pip, u,
565 ep, tau,
scale, Sev::verbose);
567 auto m_D_ptr = common_plastic_ptr->mDPtr;
569 pip.push_back(
new OpCalculateTensor2SymmetricFieldValuesDot<DIM>(
570 ep, common_plastic_ptr->getPlasticStrainDotPtr()));
571 pip.push_back(
new OpCalculateScalarFieldValuesDot(
572 tau, common_plastic_ptr->getPlasticTauDotPtr()));
573 pip.push_back(
new typename P::template OpCalculatePlasticity<DIM, I>(
574 u, common_plastic_ptr, m_D_ptr));
576 if (common_hencky_ptr) {
578 pip.push_back(
new typename H::template OpHenckyTangent<DIM, I, 0>(
579 u, common_hencky_ptr, m_D_ptr));
580 pip.push_back(
new OpKPiola(u, u, common_hencky_ptr->getMatTangent()));
582 new typename P::template Assembly<A>::
583 template OpCalculatePlasticInternalForceLhs_LogStrain_dEP<DIM, I>(
584 u, ep, common_plastic_ptr, common_hencky_ptr, m_D_ptr));
586 pip.push_back(
new OpKCauchy(u, u, m_D_ptr));
587 pip.push_back(
new typename P::template Assembly<A>::
588 template OpCalculatePlasticInternalForceLhs_dEP<DIM, I>(
589 u, ep, common_plastic_ptr, m_D_ptr));
592 if (common_hencky_ptr) {
594 new typename P::template Assembly<A>::
595 template OpCalculateConstraintsLhs_LogStrain_dU<DIM, I>(
596 tau, u, common_plastic_ptr, common_hencky_ptr, m_D_ptr));
598 new typename P::template Assembly<A>::
599 template OpCalculatePlasticFlowLhs_LogStrain_dU<DIM, I>(
600 ep, u, common_plastic_ptr, common_hencky_ptr, m_D_ptr));
604 typename P::template Assembly<A>::template OpCalculateConstraintsLhs_dU<
605 DIM,
I>(tau, u, common_plastic_ptr, m_D_ptr));
608 typename P::template Assembly<A>::template OpCalculatePlasticFlowLhs_dU<
609 DIM,
I>(ep, u, common_plastic_ptr, m_D_ptr));
614 typename P::template Assembly<A>::template OpCalculatePlasticFlowLhs_dEP<
615 DIM,
I>(ep, ep, common_plastic_ptr, m_D_ptr));
618 typename P::template Assembly<A>::template OpCalculatePlasticFlowLhs_dTAU<
619 DIM,
I>(ep, tau, common_plastic_ptr, m_D_ptr));
622 typename P::template Assembly<A>::template OpCalculateConstraintsLhs_dEP<
623 DIM,
I>(tau, ep, common_plastic_ptr, m_D_ptr));
626 typename P::template Assembly<A>::template OpCalculateConstraintsLhs_dTAU<
627 I>(tau, tau, common_plastic_ptr));
632template <
int DIM, AssemblyType A, IntegrationType I,
typename DomainEleOp>
634 std::string block_name,
Pip &pip,
635 std::string u, std::string ep,
639 using B =
typename FormsIntegrators<DomainEleOp>::template Assembly<
642 typename B::template OpGradTimesSymTensor<1, DIM, DIM>;
646 auto [common_plastic_ptr, common_hencky_ptr] =
647 createCommonPlasticOps<DIM, I, DomainEleOp>(m_field, block_name, pip, u,
648 ep, tau, 1., Sev::inform);
651 if (common_hencky_ptr) {
653 u, common_hencky_ptr->getMatFirstPiolaStress()));
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
DomainEle::UserDataOperator DomainEleOp
Finire element operator type.
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.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
auto createCommonPlasticOps(MoFEM::Interface &m_field, std::string block_name, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string u, std::string ep, std::string tau, double scale, Sev sev)
FTensor::Index< 'N', 3 > N
boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > Pip
MoFEMErrorCode opFactoryDomainReactions(MoFEM::Interface &m_field, std::string block_name, Pip &pip, std::string u, std::string ep, std::string tau)
MoFEMErrorCode opFactoryDomainRhs(MoFEM::Interface &m_field, std::string block_name, Pip &pip, std::string u, std::string ep, std::string tau)
boost::shared_ptr< HenckyOps::CommonData > CommonHenckyPtr
FTensor::Index< 'J', 3 > J
MoFEMErrorCode addMatBlockOps(MoFEM::Interface &m_field, std::string block_name, Pip &pip, boost::shared_ptr< MatrixDouble > mat_D_Ptr, boost::shared_ptr< CommonData::BlockParams > mat_params_ptr, double scale_value, Sev sev)
FTensor::Index< 'M', 3 > M
MoFEMErrorCode opFactoryDomainLhs(MoFEM::Interface &m_field, std::string block_name, Pip &pip, std::string u, std::string ep, std::string tau)
boost::shared_ptr< PlasticOps::CommonData > CommonPlasticPtr
FTensor::Index< 'I', 3 > I
[Common data]
FormsIntegrators< DomainEleOp >::Assembly< A >::LinearForm< I >::OpGradTimesTensor< 1, FIELD_DIM, SPACE_DIM > OpGradTimesTensor
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForcePiola
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradTensorGrad< 1, SPACE_DIM, SPACE_DIM, 1 > OpKPiola
[Only used for dynamics]
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpGradTimesSymTensor< 1, SPACE_DIM, SPACE_DIM > OpInternalForceCauchy
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradSymTensorGrad< 1, SPACE_DIM, SPACE_DIM, 0 > OpKCauchy
[Only used with Hooke equation (linear material model)]
FTensor::Index< 'm', 3 > m
virtual moab::Interface & get_moab()=0
Deprecated interface functions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
MatrixDouble resFlowDstrainDot
boost::shared_ptr< MatrixDouble > mStressPtr
auto getPlasticStrainPtr()
boost::shared_ptr< MatrixDouble > mDPtr
[Common data set externally]
auto getPlasticStrainDotPtr()
static std::array< int, 5 > activityData
boost::shared_ptr< MatrixDouble > mGradPtr
auto getPlasticTauDotPtr()
MatrixDouble resFlowDstrain
VectorDouble plasticTauDot
boost::shared_ptr< MatrixDouble > mStrainPtr
VectorDouble plasticSurface
[Common data set externally]
MatrixDouble resCdPlasticStrain
auto getPlasticSurfacePtr()
MatrixDouble plasticStrainDot
std::array< double, LAST_PARAM > BlockParams
MatrixDouble plasticStrain
double young_modulus
Young modulus.
double C1_k
Kinematic hardening.
double Qinf
Saturation yield stress.
double visH
Viscous hardening.
double poisson_ratio
Poisson ratio.
double b_iso
Saturation exponent.
PetscBool is_large_strains
Large strains.
double sigmaY
Yield stress.