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

#include "users_modules/multifield-thermoplasticity-private/tutorials/adv-0/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< CommonDatacommonDataPtr
 
boost::shared_ptr< MatrixDouble > mDPtr
 
boost::shared_ptr< ThermoPlasticOps::ThermoPlasticBlockedParametersTPCommonDataPtr
 

Detailed Description

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

Definition at line 469 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 481 of file PlasticOpsGeneric.hpp.

486 : public DomainEleOp {
487 OpCalculatePlasticSurfaceImpl(const std::string field_name,
488 boost::shared_ptr<CommonData> common_data_ptr);
489 MoFEMErrorCode doWork(int side, EntityType type, EntData &data);
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
constexpr auto field_name
Data on single entity (This is passed as argument to DataOperator::doWork)
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)

◆ 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 572 of file PlasticOpsGeneric.hpp.

577 : DomainEleOp(field_name, DomainEleOp::OPROW),
578 commonDataPtr(common_data_ptr), mDPtr(m_D_ptr),
579 TPCommonDataPtr(tp_common_data_ptr) {
580 // Opetor is only executed for vertices
581 std::fill(&DomainEleOp::doEntities[MBEDGE],
582 &DomainEleOp::doEntities[MBMAXTYPE], false);
583}
DomainEle::UserDataOperator DomainEleOp
Finire element operator type.
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 492 of file PlasticOpsGeneric.hpp.

499 : DomainEleOp(field_name, DomainEleOp::OPROW),
500 commonDataPtr(common_data_ptr) {
501 // Operator is only executed for vertices
502 std::fill(&DomainEleOp::doEntities[MBEDGE],
503 &DomainEleOp::doEntities[MBMAXTYPE], false);
504}
505
506template <int DIM, typename DomainEleOp>
507MoFEMErrorCode OpCalculatePlasticSurfaceImpl<DIM, GAUSS, DomainEleOp>::doWork(
508 int side, EntityType type, EntData &data) {
510
511 FTensor::Index<'i', DIM> i;
512 FTensor::Index<'j', DIM> j;
513
514 const size_t nb_gauss_pts = commonDataPtr->mStressPtr->size2();
515 auto t_stress =
516 getFTensor2SymmetricFromMat<DIM>(*(commonDataPtr->mStressPtr));
517 auto t_plastic_strain =
518 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->plasticStrain);
519
520 commonDataPtr->plasticSurface.resize(nb_gauss_pts, false);
521 commonDataPtr->plasticFlow.resize(size_symm, nb_gauss_pts, false);
522 auto t_flow = getFTensor2SymmetricFromMat<DIM>(commonDataPtr->plasticFlow);
523
524 auto &params = commonDataPtr->blockParams;
525
526 for (auto &f : commonDataPtr->plasticSurface) {
527
529
530 deviator(
531 t_stress, trace(t_stress),
532 kinematic_hardening(t_plastic_strain, params[CommonData::C1_k]))
533
534 );
535
536 auto t_flow_tmp =
537 plastic_flow(f,
538
539 deviator(t_stress, trace(t_stress),
540 kinematic_hardening(t_plastic_strain,
541 params[CommonData::C1_k])),
542
544 t_flow(i, j) = t_flow_tmp(i, j);
545
546 ++t_plastic_strain;
547 ++t_flow;
548 ++t_stress;
549 }
550
552}
553
554template <int DIM, typename DomainEleOp>
556 OpCalculatePlasticityImpl(
557 const std::string field_name,
558 boost::shared_ptr<CommonData> common_data_ptr,
559 boost::shared_ptr<MatrixDouble> m_D_ptr,
560 boost::shared_ptr<ThermoPlasticOps::ThermoPlasticBlockedParameters>
561 tp_common_data_ptr = nullptr);
562 MoFEMErrorCode doWork(int side, EntityType type, EntData &data);
563
564protected:
565 boost::shared_ptr<CommonData> commonDataPtr;
566 boost::shared_ptr<ThermoPlasticOps::ThermoPlasticBlockedParameters>
567 TPCommonDataPtr;
568 boost::shared_ptr<MatrixDouble> mDPtr;
569};
570
571template <int DIM, typename DomainEleOp>
572OpCalculatePlasticityImpl<DIM, GAUSS, DomainEleOp>::OpCalculatePlasticityImpl(
573 const std::string field_name, boost::shared_ptr<CommonData> common_data_ptr,
574 boost::shared_ptr<MatrixDouble> m_D_ptr,
575 boost::shared_ptr<ThermoPlasticOps::ThermoPlasticBlockedParameters>
576 tp_common_data_ptr)
578 commonDataPtr(common_data_ptr), mDPtr(m_D_ptr),
579 TPCommonDataPtr(tp_common_data_ptr) {
580 // Opetor is only executed for vertices
581 std::fill(&DomainEleOp::doEntities[MBEDGE],
582 &DomainEleOp::doEntities[MBMAXTYPE], false);
583}
584
585template <int DIM, typename DomainEleOp>
586MoFEMErrorCode OpCalculatePlasticityImpl<DIM, GAUSS, DomainEleOp>::doWork(
587 int side, EntityType type, EntData &data) {
589
590 FTensor::Index<'i', DIM> i;
591 FTensor::Index<'j', DIM> j;
592 FTensor::Index<'k', DIM> k;
593 FTensor::Index<'l', DIM> l;
594 FTensor::Index<'m', DIM> m;
595 FTensor::Index<'n', DIM> n;
596
597 auto &params = commonDataPtr->blockParams; ///< material parameters
598
599 auto nb_gauss_pts = DomainEleOp::getGaussPts().size2();
600 auto t_w = DomainEleOp::getFTensor0IntegrationWeight();
601 auto t_tau = getFTensor0FromVec(commonDataPtr->plasticTau);
602 auto t_tau_dot = getFTensor0FromVec(commonDataPtr->plasticTauDot);
603 auto t_f = getFTensor0FromVec(commonDataPtr->plasticSurface);
604 auto t_flow = getFTensor2SymmetricFromMat<DIM>(commonDataPtr->plasticFlow);
605 auto t_plastic_strain =
606 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->plasticStrain);
607 auto t_plastic_strain_dot =
608 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->plasticStrainDot);
609 auto t_stress =
610 getFTensor2SymmetricFromMat<DIM>(*(commonDataPtr->mStressPtr));
611
612 auto t_D = getFTensor4DdgFromMat<DIM, DIM, 0>(*commonDataPtr->mDPtr);
613 auto t_D_Op = getFTensor4DdgFromMat<DIM, DIM, 0>(*mDPtr);
614
615 auto t_temp = getFTensor0FromVec(TPCommonDataPtr->temperature);
616
617 auto t_diff_plastic_strain = diff_tensor(FTensor::Number<DIM>());
618 auto t_diff_deviator = diff_deviator(diff_tensor(FTensor::Number<DIM>()));
619
620 FTensor::Ddg<double, DIM, DIM> t_flow_dir_dstress;
621 FTensor::Ddg<double, DIM, DIM> t_flow_dir_dstrain;
622 t_flow_dir_dstress(i, j, k, l) =
623 1.5 * (t_diff_deviator(M, N, i, j) * t_diff_deviator(M, N, k, l));
624 t_flow_dir_dstrain(i, j, k, l) =
625 t_flow_dir_dstress(i, j, m, n) * t_D_Op(m, n, k, l);
626
627 auto t_alpha_dir =
628 kinematic_hardening_dplastic_strain<DIM>(params[CommonData::C1_k]);
629
630 commonDataPtr->resC.resize(nb_gauss_pts, false);
631 commonDataPtr->resCdTau.resize(nb_gauss_pts, false);
632 commonDataPtr->resCdStrain.resize(size_symm, nb_gauss_pts, false);
633 commonDataPtr->resCdPlasticStrain.resize(size_symm, nb_gauss_pts, false);
634 TPCommonDataPtr->resCdTemperature.resize(nb_gauss_pts, false);
635 commonDataPtr->resFlow.resize(size_symm, nb_gauss_pts, false);
636 commonDataPtr->resFlowDtau.resize(size_symm, nb_gauss_pts, false);
637 commonDataPtr->resFlowDstrain.resize(size_symm * size_symm, nb_gauss_pts,
638 false);
639 commonDataPtr->resFlowDstrainDot.resize(size_symm * size_symm, nb_gauss_pts,
640 false);
641 TPCommonDataPtr->resFlowDtemp.resize(size_symm, nb_gauss_pts, false);
642
643 commonDataPtr->resC.clear();
644 commonDataPtr->resCdTau.clear();
645 commonDataPtr->resCdStrain.clear();
646 commonDataPtr->resCdPlasticStrain.clear();
647 TPCommonDataPtr->resCdTemperature.clear();
648 commonDataPtr->resFlow.clear();
649 commonDataPtr->resFlowDtau.clear();
650 commonDataPtr->resFlowDstrain.clear();
651 commonDataPtr->resFlowDstrainDot.clear();
652 TPCommonDataPtr->resFlowDtemp.clear();
653
654 auto t_res_c = getFTensor0FromVec(commonDataPtr->resC);
655 auto t_res_c_dtau = getFTensor0FromVec(commonDataPtr->resCdTau);
656 auto t_res_c_dstrain =
657 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->resCdStrain);
658 auto t_res_c_plastic_strain =
659 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->resCdPlasticStrain);
660 auto t_res_c_temperature =
661 getFTensor0FromVec(TPCommonDataPtr->resCdTemperature);
662 auto t_res_flow = getFTensor2SymmetricFromMat<DIM>(commonDataPtr->resFlow);
663 auto t_res_flow_dtau =
664 getFTensor2SymmetricFromMat<DIM>(commonDataPtr->resFlowDtau);
665 auto t_res_flow_dstrain =
666 getFTensor4DdgFromMat<DIM, DIM>(commonDataPtr->resFlowDstrain);
667 auto t_res_flow_dplastic_strain =
668 getFTensor4DdgFromMat<DIM, DIM>(commonDataPtr->resFlowDstrainDot);
669 auto t_res_flow_dtemp =
670 getFTensor2SymmetricFromMat<DIM>(TPCommonDataPtr->resFlowDtemp);
671
672 auto next = [&]() {
673 ++t_tau;
674 ++t_tau_dot;
675 ++t_f;
676 ++t_flow;
677 ++t_plastic_strain;
678 ++t_plastic_strain_dot;
679 ++t_stress;
680 ++t_res_c;
681 ++t_res_c_dtau;
682 ++t_res_c_dstrain;
683 ++t_res_c_plastic_strain;
684 ++t_res_c_temperature;
685 ++t_res_flow;
686 ++t_res_flow_dtau;
687 ++t_res_flow_dstrain;
688 ++t_res_flow_dplastic_strain;
689 ++t_res_flow_dtemp;
690 ++t_w;
691 ++t_temp;
692 };
693
694 auto get_avtive_pts = [&]() {
695 int nb_points_avtive_on_elem = 0;
696 int nb_points_on_elem = 0;
697
698 auto t_tau = getFTensor0FromVec(commonDataPtr->plasticTau);
699 auto t_tau_dot = getFTensor0FromVec(commonDataPtr->plasticTauDot);
700 auto t_f = getFTensor0FromVec(commonDataPtr->plasticSurface);
701 auto t_plastic_strain_dot =
702 getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->plasticStrainDot);
703 auto t_temp = getFTensor0FromVec(TPCommonDataPtr->temperature);
704
705 auto dt = this->getTStimeStep();
706
707 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
708 auto eqiv = equivalent_strain_dot(t_plastic_strain_dot);
709 const auto ww =
710 w(eqiv, t_tau_dot, t_f,
711 iso_hardening(t_tau, params[CommonData::H], TPCommonDataPtr->omega0,
712 params[CommonData::QINF], TPCommonDataPtr->omegaH,
713 params[CommonData::BISO], params[CommonData::SIGMA_Y],
714 TPCommonDataPtr->temp0, t_temp),
715 params[CommonData::SIGMA_Y]);
716 const auto sign_ww = constrian_sign(ww, dt);
717
718 ++nb_points_on_elem;
719 if (sign_ww > 0) {
720 ++nb_points_avtive_on_elem;
721 }
722
723 ++t_tau;
724 ++t_tau_dot;
725 ++t_f;
726 ++t_plastic_strain_dot;
727 ++t_temp;
728 }
729
730 int &active_points = PlasticOps::CommonData::activityData[0];
731 int &avtive_full_elems = PlasticOps::CommonData::activityData[1];
732 int &avtive_elems = PlasticOps::CommonData::activityData[2];
733 int &nb_points = PlasticOps::CommonData::activityData[3];
734 int &nb_elements = PlasticOps::CommonData::activityData[4];
735
736 ++nb_elements;
737 nb_points += nb_points_on_elem;
738 if (nb_points_avtive_on_elem > 0) {
739 ++avtive_elems;
740 active_points += nb_points_avtive_on_elem;
741 if (nb_points_avtive_on_elem == nb_points_on_elem) {
742 ++avtive_full_elems;
743 }
744 }
745
746 if (nb_points_avtive_on_elem != nb_points_on_elem)
747 return 1;
748 else
749 return 0;
750 };
#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()
@ GAUSS
Gaussian quadrature integration.
FTensor::Index< 'i', SPACE_DIM > i
double dt
const double n
refractive index of diffusive medium
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
double platsic_surface(FTensor::Tensor2_symmetric< double, 3 > &&t_stress_deviator)
double constrian_sign(double x, double dt)
auto diff_tensor(FTensor::Number< DIM >)
[Lambda functions]
auto diff_deviator(FTensor::Ddg< double, DIM, DIM > &&t_diff_stress, FTensor::Number< DIM >)
double trace(FTensor::Tensor2_symmetric< T, 2 > &t_stress)
auto plastic_flow(long double f, FTensor::Tensor2_symmetric< double, 3 > &&t_dev_stress, FTensor::Ddg< double, 3, DIM > &&t_diff_deviator)
auto deviator(FTensor::Tensor2_symmetric< T, DIM > &t_stress, double trace, FTensor::Tensor2_symmetric< double, DIM > &t_alpha, FTensor::Number< DIM >)
auto equivalent_strain_dot(FTensor::Tensor2_symmetric< T, DIM > &t_plastic_strain_dot)
FTensor::Index< 'm', 3 > m
const int N
Definition speed_test.cpp:3
static std::array< int, 5 > activityData
OpCalculatePlasticityImpl(const std::string field_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< MatrixDouble > m_D_ptr)
auto kinematic_hardening(FTensor::Tensor2_symmetric< T, DIM > &t_plastic_strain, double C1_k)
Definition plastic.cpp:92
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 476 of file PlasticOpsGeneric.hpp.

◆ mDPtr

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

Definition at line 477 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 567 of file PlasticOpsGeneric.hpp.


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