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

#include <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)
 

Protected Attributes

boost::shared_ptr< CommonDatacommonDataPtr
 
boost::shared_ptr< MatrixDouble > mDPtr
 

Detailed Description

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

Definition at line 457 of file PlasticOpsGeneric.hpp.

Constructor & Destructor Documentation

◆ OpCalculatePlasticityImpl()

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 
)
Examples
PlasticOpsGeneric.hpp.

Definition at line 469 of file PlasticOpsGeneric.hpp.

472  : DomainEleOp(field_name, DomainEleOp::OPROW),
473  commonDataPtr(common_data_ptr), mDPtr(m_D_ptr) {
474  // Opetor is only executed for vertices
475  std::fill(&DomainEleOp::doEntities[MBEDGE],
476  &DomainEleOp::doEntities[MBMAXTYPE], false);
477 }

Member Function Documentation

◆ doWork()

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

< material parameters

Examples
PlasticOpsGeneric.hpp.

Definition at line 480 of file PlasticOpsGeneric.hpp.

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

Member Data Documentation

◆ commonDataPtr

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

Definition at line 464 of file PlasticOpsGeneric.hpp.

◆ mDPtr

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

Definition at line 465 of file PlasticOpsGeneric.hpp.


The documentation for this struct was generated from the following file:
PlasticOps::CommonData::BISO
@ BISO
Definition: PlasticOps.hpp:52
PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >::commonDataPtr
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOpsGeneric.hpp:464
PlasticOps::w
double w(double eqiv, double dot_tau, double f, double sigma_y, double sigma_Y)
Definition: PlasticOpsGeneric.hpp:276
PlasticOps::J
FTensor::Index< 'J', 3 > J
Definition: PlasticOps.hpp:116
PlasticOps::diff_constrain_ddot_tau
double diff_constrain_ddot_tau(double sign, double eqiv, double dot_tau, double vis_H, double sigma_Y)
Definition: PlasticOpsGeneric.hpp:300
PlasticOps::diff_deviator
auto diff_deviator(FTensor::Ddg< double, DIM, DIM > &&t_diff_stress, FTensor::Number< DIM >)
Definition: PlasticOpsGeneric.hpp:125
PlasticOps::diff_constrain_df
auto diff_constrain_df(double sign)
Definition: PlasticOpsGeneric.hpp:310
PlasticOps::diff_tensor
auto diff_tensor(FTensor::Number< DIM >)
[Lambda functions]
Definition: PlasticOpsGeneric.hpp:10
PlasticOps::CommonData::C1_k
@ C1_k
Definition: PlasticOps.hpp:53
PlasticOps::equivalent_strain_dot
auto equivalent_strain_dot(FTensor::Tensor2_symmetric< T, DIM > &t_plastic_strain_dot)
Definition: PlasticOpsGeneric.hpp:338
PlasticOps::diff_equivalent_strain_dot
auto diff_equivalent_strain_dot(const T1 eqiv, T2 &t_plastic_strain_dot, T3 &t_diff_plastic_strain, FTensor::Number< DIM >)
Definition: PlasticOpsGeneric.hpp:349
iso_hardening_dtau
double iso_hardening_dtau(double tau, double H, double Qinf, double b_iso)
Definition: plastic.cpp:77
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
PlasticOps::N
FTensor::Index< 'N', 3 > N
Definition: PlasticOps.hpp:118
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
PlasticOps::M
FTensor::Index< 'M', 3 > M
Definition: PlasticOps.hpp:117
PlasticOps::CommonData::H
@ H
Definition: PlasticOps.hpp:49
PlasticOps::diff_constrain_deqiv
double diff_constrain_deqiv(double sign, double eqiv, double dot_tau, double sigma_Y)
Definition: PlasticOpsGeneric.hpp:305
FTensor::Number
Definition: Number.hpp:11
DomainEleOp
DomainEle::UserDataOperator DomainEleOp
Finire element operator type.
Definition: child_and_parent.cpp:36
a
constexpr double a
Definition: approx_sphere.cpp:30
PlasticOps::CommonData::activityData
static std::array< int, 5 > activityData
Definition: PlasticOps.hpp:107
kinematic_hardening
auto kinematic_hardening(FTensor::Tensor2_symmetric< T, DIM > &t_plastic_strain, double C1_k)
Definition: plastic.cpp:91
PlasticOps::constrain_abs
double constrain_abs(double x)
Definition: PlasticOpsGeneric.hpp:265
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
PlasticOps::deviator
auto deviator(FTensor::Tensor2_symmetric< T, DIM > &t_stress, double trace, FTensor::Tensor2_symmetric< double, DIM > &t_alpha, FTensor::Number< DIM >)
Definition: PlasticOpsGeneric.hpp:92
size_symm
constexpr auto size_symm
Definition: plastic.cpp:42
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
FTensor::Index< 'i', DIM >
PlasticOps::CommonData::QINF
@ QINF
Definition: PlasticOps.hpp:51
convert.n
n
Definition: convert.py:82
PlasticOps::OpCalculatePlasticityImpl< DIM, GAUSS, DomainEleOp >::mDPtr
boost::shared_ptr< MatrixDouble > mDPtr
Definition: PlasticOpsGeneric.hpp:465
iso_hardening
double iso_hardening(double tau, double H, double Qinf, double b_iso, double sigmaY)
Definition: plastic.cpp:72
HenckyOps::f
auto f
Definition: HenckyOps.hpp:15
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Ddg
Definition: Ddg_value.hpp:7
PlasticOps::constraint
double constraint(double eqiv, double dot_tau, double f, double sigma_y, double abs_w, double vis_H, double sigma_Y)
Definition: PlasticOpsGeneric.hpp:292
PlasticOps::CommonData::VIS_H
@ VIS_H
Definition: PlasticOps.hpp:50
PlasticOps::constrian_sign
double constrian_sign(double x)
Definition: PlasticOpsGeneric.hpp:251
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
PlasticOps::trace
double trace(FTensor::Tensor2_symmetric< T, 2 > &t_stress)
Definition: PlasticOpsGeneric.hpp:80
PlasticOps::I
FTensor::Index< 'I', 3 > I
[Common data]
Definition: PlasticOps.hpp:115
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
PlasticOps::diff_constrain_dsigma_y
auto diff_constrain_dsigma_y(double sign)
Definition: PlasticOpsGeneric.hpp:312
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
PlasticOps::CommonData::SIGMA_Y
@ SIGMA_Y
Definition: PlasticOps.hpp:48