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;
90 return boost::shared_ptr<VectorDouble>(shared_from_this(),
94 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
98 return boost::shared_ptr<VectorDouble>(shared_from_this(), &
plasticSurface);
101 return boost::shared_ptr<VectorDouble>(shared_from_this(), &
plasticTau);
104 return boost::shared_ptr<VectorDouble>(shared_from_this(), &
plasticTauDot);
110 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
114 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
plasticFlow);
129template <
int DIM, IntegrationType I,
typename DomainEleOp>
132template <
int DIM, IntegrationType I,
typename DomainEleOp>
135template <
int DIM, IntegrationType I,
typename DomainEleOp>
138template <
int DIM, IntegrationType I,
typename DomainEleOp>
141template <
int DIM, IntegrationType I,
typename DomainEleOp>
144template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
147template <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 <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
165template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
168template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
171template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
174template <
int DIM, IntegrationType I,
typename AssemblyDomainEleOp>
177template <IntegrationType I,
typename AssemblyDomainEleOp>
181 template <
int DIM, IntegrationType I>
185 template <
int DIM, IntegrationType I>
189 template <
int DIM, IntegrationType I>
192 template <
int DIM, IntegrationType I>
196 template <
int DIM, IntegrationType I>
204 template <
int DIM, IntegrationType I>
208 template <IntegrationType I>
212 template <
int DIM, IntegrationType I>
216 template <
int DIM, IntegrationType I>
221 template <
int DIM, IntegrationType I>
225 template <
int DIM, IntegrationType I>
229 template <
int DIM, IntegrationType I>
233 template <
int DIM, IntegrationType I>
237 template <
int DIM, IntegrationType I>
241 template <
int DIM, IntegrationType I>
245 template <
int DIM, IntegrationType I>
249 template <IntegrationType I>
264using Pip = boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator>;
271 boost::shared_ptr<MatrixDouble> mat_D_Ptr,
272 boost::shared_ptr<CommonData::BlockParams> mat_params_ptr,
273 double scale_value, Sev sev) {
277 OpMatBlocks(boost::shared_ptr<MatrixDouble> m_D_ptr,
278 boost::shared_ptr<CommonData::BlockParams> mat_params_ptr,
280 std::vector<const CubitMeshSets *> meshset_vec_ptr)
282 matParamsPtr(mat_params_ptr), scaleVal(scale_value) {
284 "Can not get data from block");
288 EntitiesFieldData::EntData &data) {
291 auto getK = [](
auto &p) {
297 auto getG = [](
auto &p) {
303 auto scale_fun = [
this](
auto &p) {
304 p[CommonData::YOUNG_MODULUS] *= scaleVal;
305 p[CommonData::SIGMA_Y] *= scaleVal;
306 p[CommonData::H] *= scaleVal;
307 p[CommonData::VIS_H] *= scaleVal;
308 p[CommonData::QINF] *= scaleVal;
309 p[CommonData::C1_k] *= scaleVal;
312 for (
auto &b : blockData) {
313 if (b.blockEnts.find(getFEEntityHandle()) != b.blockEnts.end()) {
314 *matParamsPtr = b.bParams;
315 scale_fun(*matParamsPtr);
316 CHKERR getMatDPtr(matDPtr, getK(*matParamsPtr), getG(*matParamsPtr));
323 scale_fun(*matParamsPtr);
324 CHKERR getMatDPtr(matDPtr, getK(*matParamsPtr), getG(*matParamsPtr));
330 boost::shared_ptr<MatrixDouble> matDPtr;
331 boost::shared_ptr<CommonData::BlockParams> matParamsPtr;
332 const double scaleVal;
335 std::array<double, CommonData::LAST_PARAM> bParams;
338 std::vector<BlockData> blockData;
350 std::vector<const CubitMeshSets *> meshset_vec_ptr,
354 for (
auto m : meshset_vec_ptr) {
356 std::vector<double> block_data;
357 CHKERR m->getAttributes(block_data);
358 if (block_data.size() != CommonData::LAST_PARAM) {
360 "Wrong number of block attribute");
362 auto get_block_ents = [&]() {
369 CommonData::BlockParams block_params;
370 for (
auto i = 0;
i != CommonData::LAST_PARAM; ++
i) {
371 block_params[
i] = block_data[
i];
375 <<
"E = " << block_params[CommonData::YOUNG_MODULUS]
376 <<
" nu = " << block_params[CommonData::POISSON_RATIO];
379 <<
"sigma_y = " << block_params[CommonData::SIGMA_Y] << std::endl
380 <<
"h = " << block_params[CommonData::H] << std::endl
381 <<
"vis_h = " << block_params[CommonData::VIS_H] << std::endl
382 <<
"qinf = " << block_params[CommonData::QINF] << std::endl
383 <<
"biso = " << block_params[CommonData::BISO] << std::endl
384 <<
"C1_k = " << block_params[CommonData::C1_k] << std::endl;
386 blockData.push_back({block_params, get_block_ents()});
403 MoFEMErrorCode getMatDPtr(boost::shared_ptr<MatrixDouble> mat_D_ptr,
407 auto set_material_stiffness = [&]() {
413 double A = (DIM == 2)
417 auto t_D = getFTensor4DdgFromMat<DIM, DIM, 0>(*mat_D_ptr);
424 constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
426 set_material_stiffness();
432 pip.push_back(
new OpMatBlocks(
433 mat_D_Ptr, mat_params_ptr, scale_value, m_field, sev,
436 m_field.
getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
438 (boost::format(
"%s(.*)") % block_name).str()
447template <
int DIM, IntegrationType I,
typename DomainEleOp>
450 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
451 std::string u, std::string ep, std::string tau,
double scale, Sev sev) {
453 using P = PlasticityIntegrators<DomainEleOp>;
455 auto common_plastic_ptr = boost::make_shared<PlasticOps::CommonData>();
456 common_plastic_ptr = boost::make_shared<PlasticOps::CommonData>();
458 constexpr auto size_symm = (DIM * (DIM + 1)) / 2;
459 auto make_d_mat = []() {
463 common_plastic_ptr->mDPtr = make_d_mat();
464 common_plastic_ptr->mGradPtr = boost::make_shared<MatrixDouble>();
465 common_plastic_ptr->mStrainPtr = boost::make_shared<MatrixDouble>();
466 common_plastic_ptr->mStressPtr = boost::make_shared<MatrixDouble>();
468 auto m_D_ptr = common_plastic_ptr->mDPtr;
471 common_plastic_ptr->getParamsPtr(),
473 "add mat block ops");
475 pip.push_back(
new OpCalculateScalarFieldValues(
476 tau, common_plastic_ptr->getPlasticTauPtr()));
477 pip.push_back(
new OpCalculateTensor2SymmetricFieldValues<DIM>(
478 ep, common_plastic_ptr->getPlasticStrainPtr()));
479 pip.push_back(
new OpCalculateVectorFieldGradient<DIM, DIM>(
480 u, common_plastic_ptr->mGradPtr));
485 common_hencky_ptr = boost::make_shared<HenckyOps::CommonData>();
486 common_hencky_ptr->matGradPtr = common_plastic_ptr->mGradPtr;
487 common_hencky_ptr->matDPtr = common_plastic_ptr->mDPtr;
488 common_hencky_ptr->matLogCPlastic =
489 common_plastic_ptr->getPlasticStrainPtr();
490 common_plastic_ptr->mStrainPtr = common_hencky_ptr->getMatLogC();
491 common_plastic_ptr->mStressPtr = common_hencky_ptr->getMatHenckyStress();
495 pip.push_back(
new typename H::template OpCalculateEigenVals<DIM, I>(
496 u, common_hencky_ptr));
498 new typename H::template OpCalculateLogC<DIM, I>(u, common_hencky_ptr));
499 pip.push_back(
new typename H::template OpCalculateLogC_dC<DIM, I>(
500 u, common_hencky_ptr));
502 new typename H::template OpCalculateHenckyPlasticStress<DIM, I, 0>(
503 u, common_hencky_ptr, m_D_ptr));
504 pip.push_back(
new typename H::template OpCalculatePiolaStress<DIM, I, 0>(
505 u, common_hencky_ptr));
508 pip.push_back(
new OpSymmetrizeTensor<SPACE_DIM>(
509 common_plastic_ptr->mGradPtr, common_plastic_ptr->mStrainPtr));
510 pip.push_back(
new typename P::template OpPlasticStress<DIM, I>(
511 common_plastic_ptr, m_D_ptr));
514 pip.push_back(
new typename P::template OpCalculatePlasticSurface<DIM, I>(
515 u, common_plastic_ptr));
517 return std::make_tuple(common_plastic_ptr, common_hencky_ptr);
520template <
int DIM, AssemblyType A, IntegrationType I,
typename DomainEleOp>
523 std::string u, std::string ep, std::string tau) {
526 using B =
typename FormsIntegrators<DomainEleOp>::template Assembly<
529 typename B::template OpGradTimesSymTensor<1, DIM, DIM>;
533 using P = PlasticityIntegrators<DomainEleOp>;
535 auto [common_plastic_ptr, common_hencky_ptr] =
536 createCommonPlasticOps<DIM, I, DomainEleOp>(m_field, block_name, pip, u,
537 ep, tau,
scale, Sev::inform);
539 auto m_D_ptr = common_plastic_ptr->mDPtr;
541 pip.push_back(
new OpCalculateTensor2SymmetricFieldValuesDot<DIM>(
542 ep, common_plastic_ptr->getPlasticStrainDotPtr()));
544 tau, common_plastic_ptr->getPlasticTauDotPtr()));
545 pip.push_back(
new typename P::template OpCalculatePlasticity<DIM, I>(
546 u, common_plastic_ptr, m_D_ptr));
549 if (common_hencky_ptr) {
551 u, common_hencky_ptr->getMatFirstPiolaStress()));
558 typename P::template Assembly<A>::template OpCalculateConstraintsRhs<I>(
559 tau, common_plastic_ptr, m_D_ptr));
561 new typename P::template Assembly<A>::template OpCalculatePlasticFlowRhs<
562 DIM,
I>(ep, common_plastic_ptr, m_D_ptr));
567template <
int DIM, AssemblyType A, IntegrationType I,
typename DomainEleOp>
570 std::string u, std::string ep, std::string tau) {
575 using B =
typename FormsIntegrators<DomainEleOp>::template Assembly<
577 using OpKPiola =
typename B::template OpGradTensorGrad<1, DIM, DIM, 1>;
578 using OpKCauchy =
typename B::template OpGradSymTensorGrad<1, DIM, DIM, 0>;
580 using P = PlasticityIntegrators<DomainEleOp>;
582 auto [common_plastic_ptr, common_hencky_ptr] =
583 createCommonPlasticOps<DIM, I, DomainEleOp>(m_field, block_name, pip, u,
584 ep, tau,
scale, Sev::verbose);
586 auto m_D_ptr = common_plastic_ptr->mDPtr;
588 pip.push_back(
new OpCalculateTensor2SymmetricFieldValuesDot<DIM>(
589 ep, common_plastic_ptr->getPlasticStrainDotPtr()));
591 tau, common_plastic_ptr->getPlasticTauDotPtr()));
592 pip.push_back(
new typename P::template OpCalculatePlasticity<DIM, I>(
593 u, common_plastic_ptr, m_D_ptr));
595 if (common_hencky_ptr) {
597 pip.push_back(
new typename H::template OpHenckyTangent<DIM, I, 0>(
598 u, common_hencky_ptr, m_D_ptr));
599 pip.push_back(
new OpKPiola(u, u, common_hencky_ptr->getMatTangent()));
601 new typename P::template Assembly<A>::
602 template OpCalculatePlasticInternalForceLhs_LogStrain_dEP<DIM,
I>(
603 u, ep, common_plastic_ptr, common_hencky_ptr, m_D_ptr));
605 pip.push_back(
new OpKCauchy(u, u, m_D_ptr));
606 pip.push_back(
new typename P::template Assembly<A>::
607 template OpCalculatePlasticInternalForceLhs_dEP<DIM,
I>(
608 u, ep, common_plastic_ptr, m_D_ptr));
611 if (common_hencky_ptr) {
613 new typename P::template Assembly<A>::
614 template OpCalculateConstraintsLhs_LogStrain_dU<DIM,
I>(
615 tau, u, common_plastic_ptr, common_hencky_ptr, m_D_ptr));
617 new typename P::template Assembly<A>::
618 template OpCalculatePlasticFlowLhs_LogStrain_dU<DIM,
I>(
619 ep, u, common_plastic_ptr, common_hencky_ptr, m_D_ptr));
623 typename P::template Assembly<A>::template OpCalculateConstraintsLhs_dU<
624 DIM,
I>(tau, u, common_plastic_ptr, m_D_ptr));
627 typename P::template Assembly<A>::template OpCalculatePlasticFlowLhs_dU<
628 DIM,
I>(ep, u, common_plastic_ptr, m_D_ptr));
633 typename P::template Assembly<A>::template OpCalculatePlasticFlowLhs_dEP<
634 DIM,
I>(ep, ep, common_plastic_ptr, m_D_ptr));
637 typename P::template Assembly<A>::template OpCalculatePlasticFlowLhs_dTAU<
638 DIM,
I>(ep, tau, common_plastic_ptr, m_D_ptr));
641 typename P::template Assembly<A>::template OpCalculateConstraintsLhs_dEP<
642 DIM,
I>(tau, ep, common_plastic_ptr, m_D_ptr));
645 typename P::template Assembly<A>::template OpCalculateConstraintsLhs_dTAU<
646 I>(tau, tau, common_plastic_ptr));
651template <
int DIM, AssemblyType A, IntegrationType I,
typename DomainEleOp>
653 std::string block_name,
Pip &pip,
654 std::string u, std::string ep,
658 using B =
typename FormsIntegrators<DomainEleOp>::template Assembly<
661 typename B::template OpGradTimesSymTensor<1, DIM, DIM>;
665 auto [common_plastic_ptr, common_hencky_ptr] =
666 createCommonPlasticOps<DIM, I, DomainEleOp>(m_field, block_name, pip, u,
667 ep, tau, 1., Sev::inform);
670 if (common_hencky_ptr) {
672 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
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
OpCalculateScalarFieldValuesFromPetscVecImpl< PetscData::CTX_SET_X_T > OpCalculateScalarFieldValuesDot
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
constexpr AssemblyType A
[Define dimension]
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
MatrixDouble plasticKinHardening
auto getPlasticIsoHardeningPtr()
VectorDouble plasticIsoHardening
[Common data set externally]
auto getPlasticTauDotPtr()
MatrixDouble resFlowDstrain
VectorDouble plasticTauDot
boost::shared_ptr< MatrixDouble > mStrainPtr
VectorDouble plasticSurface
[Common data set externally]
MatrixDouble resCdPlasticStrain
auto getPlasticSurfacePtr()
auto getPlasticKinHardeningPtr()
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.