v0.16.3
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp > Struct Template Reference

#include "tutorials/adv-0_plasticity/src/PlasticOpsGeneric.hpp"

Inheritance diagram for PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >:
[legend]
Collaboration diagram for PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >:
[legend]

Public Member Functions

 OpCalculatePlasticityImpl (const std::string field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 
 OpCalculatePlasticityImpl (const std::string field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr, boost::shared_ptr< ThermoPlasticOps::ThermoPlasticBlockedParameters > tp_common_data_ptr=nullptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Protected Attributes

boost::shared_ptr< CommonData > commonDataPtr
 
boost::shared_ptr< MatrixDouble > mDPtr
 
boost::shared_ptr< ThermoPlasticOps::ThermoPlasticBlockedParameters > TPCommonDataPtr
 

Detailed Description

template<int DIM, typename DomainEleOp>
struct PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >

Definition at line 468 of file PlasticOpsGeneric.hpp.

Constructor & Destructor Documentation

◆ OpCalculatePlasticityImpl() [1/2]

template<int DIM, typename DomainEleOp >
PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >::OpCalculatePlasticityImpl ( const std::string  field_name,
boost::shared_ptr< CommonData >  common_data_ptr,
boost::shared_ptr< MatrixDouble >  m_D_ptr 
)

Definition at line 480 of file PlasticOpsGeneric.hpp.

483 : DomainEleOp(field_name, DomainEleOp::OPROW),
484 commonDataPtr(common_data_ptr), mDPtr(m_D_ptr) {
485 // Opetor is only executed for vertices
486 std::fill(&DomainEleOp::doEntities[MBEDGE],
487 &DomainEleOp::doEntities[MBMAXTYPE], false);
488}
DomainEle::UserDataOperator DomainEleOp
Finire element operator type.
constexpr auto field_name

◆ OpCalculatePlasticityImpl() [2/2]

template<int DIM, typename DomainEleOp >
PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >::OpCalculatePlasticityImpl ( const std::string  field_name,
boost::shared_ptr< CommonData >  common_data_ptr,
boost::shared_ptr< MatrixDouble >  m_D_ptr,
boost::shared_ptr< ThermoPlasticOps::ThermoPlasticBlockedParameters >  tp_common_data_ptr = nullptr 
)

Definition at line 502 of file PlasticOpsGeneric.hpp.

507 : DomainEleOp(field_name, DomainEleOp::OPROW),
508 commonDataPtr(common_data_ptr), mDPtr(m_D_ptr),
509 TPCommonDataPtr(tp_common_data_ptr) {
510 // Opetor is only executed for vertices
511 std::fill(&DomainEleOp::doEntities[MBEDGE],
512 &DomainEleOp::doEntities[MBMAXTYPE], false);
513}
boost::shared_ptr< ThermoPlasticOps::ThermoPlasticBlockedParameters > TPCommonDataPtr

Member Function Documentation

◆ doWork() [1/2]

template<int DIM, typename DomainEleOp >
MoFEMErrorCode PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >::doWork ( int  side,
EntityType  type,
EntData &  data 
)

< material parameters

< material parameters

Definition at line 491 of file PlasticOpsGeneric.hpp.

492 {
494
495 FTensor::Index<'i', DIM> i;
496 FTensor::Index<'j', DIM> j;
497 FTensor::Index<'k', DIM> k;
498 FTensor::Index<'l', DIM> l;
499 FTensor::Index<'m', DIM> m;
500 FTensor::Index<'n', DIM> n;
501
502 auto &params = commonDataPtr->blockParams; ///< material parameters
503
504 auto nb_gauss_pts = DomainEleOp::getGaussPts().size2();
505 auto t_w = DomainEleOp::getFTensor0IntegrationWeight();
506 auto t_tau = getFTensor0FromVec(commonDataPtr->plasticTau);
507 auto t_tau_dot = getFTensor0FromVec(commonDataPtr->plasticTauDot);
508 auto t_f = getFTensor0FromVec(commonDataPtr->plasticSurface);
509 auto t_flow = getFTensor2SymmetricFromMat<DIM>(commonDataPtr->plasticFlow);
510 auto t_plastic_strain =
511 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->plasticStrain);
512 auto t_plastic_strain_dot =
513 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->plasticStrainDot);
514 auto t_stress = getFTensor2SymmetricFromMat<DIM>(*(commonDataPtr->mStressPtr));
515
516 auto t_D = getFTensor4DdgFromMat<DIM, DIM, 0>(*commonDataPtr->mDPtr);
517 auto t_D_Op = getFTensor4DdgFromMat<DIM, DIM, 0>(*mDPtr);
518
519 auto t_diff_plastic_strain = diff_tensor(FTensor::Number<DIM>());
520 auto t_diff_deviator = diff_deviator(diff_tensor(FTensor::Number<DIM>()));
521
522 FTensor::Ddg<double, DIM, DIM> t_flow_dir_dstress;
523 FTensor::Ddg<double, DIM, DIM> t_flow_dir_dstrain;
524 t_flow_dir_dstress(i, j, k, l) =
525 1.5 * (t_diff_deviator(M, N, i, j) * t_diff_deviator(M, N, k, l));
526 t_flow_dir_dstrain(i, j, k, l) =
527 t_flow_dir_dstress(i, j, m, n) * t_D_Op(m, n, k, l);
528
529
530 auto t_alpha_dir =
531 kinematic_hardening_dplastic_strain<DIM>(params[CommonData::C1_k]);
532
533 commonDataPtr->resC.resize(nb_gauss_pts, false);
534 commonDataPtr->resCdTau.resize(nb_gauss_pts, false);
535 commonDataPtr->resCdStrain.resize(nb_gauss_pts, size_symm, false);
536 commonDataPtr->resCdPlasticStrain.resize(nb_gauss_pts, size_symm, false);
537 commonDataPtr->resFlow.resize(nb_gauss_pts, size_symm, false);
538 commonDataPtr->resFlowDtau.resize(nb_gauss_pts, size_symm, false);
539 commonDataPtr->resFlowDstrain.resize(nb_gauss_pts, size_symm * size_symm,
540 false);
541 commonDataPtr->resFlowDstrainDot.resize(nb_gauss_pts, size_symm * size_symm,
542 false);
543
544 commonDataPtr->resC.clear();
545 commonDataPtr->resCdTau.clear();
546 commonDataPtr->resCdStrain.clear();
547 commonDataPtr->resCdPlasticStrain.clear();
548 commonDataPtr->resFlow.clear();
549 commonDataPtr->resFlowDtau.clear();
550 commonDataPtr->resFlowDstrain.clear();
551 commonDataPtr->resFlowDstrainDot.clear();
552
553 auto t_res_c = getFTensor0FromVec(commonDataPtr->resC);
554 auto t_res_c_dtau = getFTensor0FromVec(commonDataPtr->resCdTau);
555 auto t_res_c_dstrain =
556 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->resCdStrain);
557 auto t_res_c_plastic_strain =
558 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->resCdPlasticStrain);
559 auto t_res_flow = getFTensor2SymmetricFromMat<DIM>(commonDataPtr->resFlow);
560 auto t_res_flow_dtau =
561 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->resFlowDtau);
562 auto t_res_flow_dstrain =
563 getFTensor4DdgFromMat<DIM, DIM>(commonDataPtr->resFlowDstrain);
564 auto t_res_flow_dplastic_strain =
565 getFTensor4DdgFromMat<DIM, DIM>(commonDataPtr->resFlowDstrainDot);
566
567 auto next = [&]() {
568 ++t_tau;
569 ++t_tau_dot;
570 ++t_f;
571 ++t_flow;
572 ++t_plastic_strain;
573 ++t_plastic_strain_dot;
574 ++t_stress;
575 ++t_res_c;
576 ++t_res_c_dtau;
577 ++t_res_c_dstrain;
578 ++t_res_c_plastic_strain;
579 ++t_res_flow;
580 ++t_res_flow_dtau;
581 ++t_res_flow_dstrain;
582 ++t_res_flow_dplastic_strain;
583 ++t_w;
584 };
585
586 auto get_avtive_pts = [&]() {
587 int nb_points_avtive_on_elem = 0;
588 int nb_points_on_elem = 0;
589
590 auto t_tau = getFTensor0FromVec(commonDataPtr->plasticTau);
591 auto t_tau_dot = getFTensor0FromVec(commonDataPtr->plasticTauDot);
592 auto t_f = getFTensor0FromVec(commonDataPtr->plasticSurface);
593 auto t_plastic_strain_dot =
594 getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->plasticStrainDot);
595
596 auto dt = this->getTStimeStep();
597
598 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
599 auto eqiv = equivalent_strain_dot(t_plastic_strain_dot);
600 const auto ww = w(
601 eqiv, t_tau_dot, t_f,
602 iso_hardening(t_tau, params[CommonData::H], params[CommonData::QINF],
603 params[CommonData::BISO], params[CommonData::SIGMA_Y]),
604 params[CommonData::SIGMA_Y]);
605 const auto sign_ww = constrian_sign(ww, dt);
606
607 ++nb_points_on_elem;
608 if (sign_ww > 0) {
609 ++nb_points_avtive_on_elem;
610 }
611
612 ++t_tau;
613 ++t_tau_dot;
614 ++t_f;
615 ++t_plastic_strain_dot;
616 }
617
618 int &active_points = PlasticOps::CommonData::activityData[0];
619 int &avtive_full_elems = PlasticOps::CommonData::activityData[1];
620 int &avtive_elems = PlasticOps::CommonData::activityData[2];
621 int &nb_points = PlasticOps::CommonData::activityData[3];
622 int &nb_elements = PlasticOps::CommonData::activityData[4];
623
624 ++nb_elements;
625 nb_points += nb_points_on_elem;
626 if (nb_points_avtive_on_elem > 0) {
627 ++avtive_elems;
628 active_points += nb_points_avtive_on_elem;
629 if (nb_points_avtive_on_elem == nb_points_on_elem) {
630 ++avtive_full_elems;
631 }
632 }
633
634 if (nb_points_avtive_on_elem != nb_points_on_elem)
635 return 1;
636 else
637 return 0;
638 };
639
640 if (DomainEleOp::getTSCtx() == TSMethod::TSContext::CTX_TSSETIJACOBIAN) {
641 get_avtive_pts();
642 }
643
644 auto dt = this->getTStimeStep();
645 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
646
647 auto eqiv = equivalent_strain_dot(t_plastic_strain_dot);
648 auto t_diff_eqiv = diff_equivalent_strain_dot(eqiv, t_plastic_strain_dot,
649 t_diff_plastic_strain,
651
652 const auto sigma_y =
653 iso_hardening(t_tau, params[CommonData::H], params[CommonData::QINF],
654 params[CommonData::BISO], params[CommonData::SIGMA_Y]);
655 const auto d_sigma_y =
656 iso_hardening_dtau(t_tau, params[CommonData::H],
657 params[CommonData::QINF], params[CommonData::BISO]);
658
659 auto ww = w(eqiv, t_tau_dot, t_f, sigma_y, params[CommonData::SIGMA_Y]);
660 auto abs_ww = constrain_abs(ww, dt);
661 auto sign_ww = constrian_sign(ww, dt);
662
663 auto c = constraint(eqiv, t_tau_dot, t_f, sigma_y, abs_ww,
664 params[CommonData::VIS_H], params[CommonData::SIGMA_Y]);
665 auto c_dot_tau = diff_constrain_ddot_tau(sign_ww, eqiv, t_tau_dot,
666 params[CommonData::VIS_H],
667 params[CommonData::SIGMA_Y]);
668 auto c_equiv = diff_constrain_deqiv(sign_ww, eqiv, t_tau_dot,
669 params[CommonData::SIGMA_Y]);
670 auto c_sigma_y = diff_constrain_dsigma_y(sign_ww);
671 auto c_f = diff_constrain_df(sign_ww);
672
673 auto t_dev_stress = deviator(
674
675 t_stress, trace(t_stress),
676
677 kinematic_hardening(t_plastic_strain, params[CommonData::C1_k])
678
679 );
680
682 t_flow_dir(k, l) = 1.5 * (t_dev_stress(I, J) * t_diff_deviator(I, J, k, l));
684 t_flow_dstrain(i, j) = t_flow(k, l) * t_D_Op(k, l, i, j);
685
686 auto get_res_c = [&]() { return c; };
687
688 auto get_res_c_dstrain = [&](auto &t_diff_res) {
689 t_diff_res(i, j) = c_f * t_flow_dstrain(i, j);
690 };
691
692 auto get_res_c_dplastic_strain = [&](auto &t_diff_res) {
693 t_diff_res(i, j) = (this->getTSa() * c_equiv) * t_diff_eqiv(i, j);
694 t_diff_res(k, l) -= c_f * t_flow(i, j) * t_alpha_dir(i, j, k, l);
695 };
696
697 auto get_res_c_dtau = [&]() {
698 return this->getTSa() * c_dot_tau + c_sigma_y * d_sigma_y;
699 };
700
701 auto get_res_c_plastic_strain = [&](auto &t_diff_res) {
702 t_diff_res(k, l) = -c_f * t_flow(i, j) * t_alpha_dir(i, j, k, l);
703 };
704
705 auto get_res_flow = [&](auto &t_res_flow) {
706 const auto a = sigma_y;
707 const auto b = t_tau_dot;
708 t_res_flow(k, l) = a * t_plastic_strain_dot(k, l) - b * t_flow_dir(k, l);
709 };
710
711 auto get_res_flow_dtau = [&](auto &t_res_flow_dtau) {
712 const auto da = d_sigma_y;
713 const auto db = this->getTSa();
714 t_res_flow_dtau(k, l) =
715 da * t_plastic_strain_dot(k, l) - db * t_flow_dir(k, l);
716 };
717
718 auto get_res_flow_dstrain = [&](auto &t_res_flow_dstrain) {
719 const auto b = t_tau_dot;
720 t_res_flow_dstrain(m, n, k, l) = -t_flow_dir_dstrain(m, n, k, l) * b;
721 };
722
723 auto get_res_flow_dplastic_strain = [&](auto &t_res_flow_dplastic_strain) {
724 const auto a = sigma_y;
725 t_res_flow_dplastic_strain(m, n, k, l) =
726 (a * this->getTSa()) * t_diff_plastic_strain(m, n, k, l);
727 const auto b = t_tau_dot;
728 t_res_flow_dplastic_strain(m, n, i, j) +=
729 (t_flow_dir_dstrain(m, n, k, l) * t_alpha_dir(k, l, i, j)) * b;
730 };
731
732 t_res_c = get_res_c();
733 get_res_flow(t_res_flow);
734
735 if (this->getTSCtx() == TSMethod::TSContext::CTX_TSSETIJACOBIAN) {
736 t_res_c_dtau = get_res_c_dtau();
737 get_res_c_dstrain(t_res_c_dstrain);
738 get_res_c_dplastic_strain(t_res_c_plastic_strain);
739 get_res_flow_dtau(t_res_flow_dtau);
740 get_res_flow_dstrain(t_res_flow_dstrain);
741 get_res_flow_dplastic_strain(t_res_flow_dplastic_strain);
742 }
743
744 next();
745 }
746
748}
constexpr double a
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FTensor::Index< 'i', SPACE_DIM > i
double dt
const double c
speed of light (cm/ns)
const double n
refractive index of diffusive medium
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
FTensor::Index< 'N', 3 > N
double diff_constrain_ddot_tau(double sign, double eqiv, double dot_tau, double vis_H, double sigma_Y)
double constrian_sign(double x, double dt)
FTensor::Index< 'J', 3 > J
double diff_constrain_deqiv(double sign, double eqiv, double dot_tau, double sigma_Y)
FTensor::Index< 'M', 3 > M
auto diff_equivalent_strain_dot(const T1 eqiv, T2 &t_plastic_strain_dot, T3 &t_diff_plastic_strain, FTensor::Number< DIM >)
double constraint(double eqiv, double dot_tau, double f, double sigma_y, double abs_w, double vis_H, double sigma_Y)
auto diff_constrain_df(double sign)
auto diff_constrain_dsigma_y(double sign)
auto diff_tensor(FTensor::Number< DIM >)
[Lambda functions]
FTensor::Index< 'I', 3 > I
[Common data]
auto diff_deviator(FTensor::Ddg< double, DIM, DIM > &&t_diff_stress, FTensor::Number< DIM >)
double trace(FTensor::Tensor2_symmetric< T, 2 > &t_stress)
auto deviator(FTensor::Tensor2_symmetric< T, DIM > &t_stress, double trace, FTensor::Tensor2_symmetric< double, DIM > &t_alpha, FTensor::Number< DIM >)
double w(double eqiv, double dot_tau, double f, double sigma_y, double sigma_Y)
auto equivalent_strain_dot(FTensor::Tensor2_symmetric< T, DIM > &t_plastic_strain_dot)
double constrain_abs(double x, double dt)
FTensor::Index< 'm', 3 > m
static std::array< int, 5 > activityData
auto kinematic_hardening(FTensor::Tensor2_symmetric< T, DIM > &t_plastic_strain, double C1_k)
Definition plastic.cpp:92
double iso_hardening_dtau(double tau, double H, double Qinf, double b_iso)
Definition plastic.cpp:78
constexpr auto size_symm
Definition plastic.cpp:42
double iso_hardening(double tau, double H, double Qinf, double b_iso, double sigmaY)
Definition plastic.cpp:73

◆ doWork() [2/2]

template<int DIM, typename DomainEleOp >
MoFEMErrorCode PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >::doWork ( int  side,
EntityType  type,
EntData &  data 
)

Member Data Documentation

◆ commonDataPtr

template<int DIM, typename DomainEleOp >
boost::shared_ptr< CommonData > PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >::commonDataPtr
protected

Definition at line 475 of file PlasticOpsGeneric.hpp.

◆ mDPtr

template<int DIM, typename DomainEleOp >
boost::shared_ptr< MatrixDouble > PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >::mDPtr
protected

Definition at line 476 of file PlasticOpsGeneric.hpp.

◆ TPCommonDataPtr

template<int DIM, typename DomainEleOp >
boost::shared_ptr<ThermoPlasticOps::ThermoPlasticBlockedParameters> PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >::TPCommonDataPtr
protected

Definition at line 497 of file PlasticOpsGeneric.hpp.


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