v0.10.0
Public Member Functions | Private Attributes | List of all members
OpPlasticTools::OpPostProcPlastic Struct Reference

#include <users_modules/multifield_plasticity/src/PlasticOperators.hpp>

Inheritance diagram for OpPlasticTools::OpPostProcPlastic:
[legend]
Collaboration diagram for OpPlasticTools::OpPostProcPlastic:
[legend]

Public Member Functions

 OpPostProcPlastic (const std::string field_name, moab::Interface &post_proc_mesh, std::vector< EntityHandle > &map_gauss_pts, boost::shared_ptr< CommonData > common_data_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 [Postprocessing] More...
 
- Public Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase::UserDataOperator
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
double getVolume () const
 element volume (linear geometry) More...
 
doublegetVolume ()
 element volume (linear geometry) More...
 
FTensor::Tensor2< double *, 3, 3 > & getJac ()
 get element Jacobian More...
 
FTensor::Tensor2< double *, 3, 3 > & getInvJac ()
 get element inverse Jacobian More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
VectorDoublegetCoords ()
 nodal coordinates More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
MatrixDoublegetHoCoordsAtGaussPts ()
 coordinate at Gauss points (if hierarchical approximation of element geometry) More...
 
MatrixDoublegetHoGaussPtsJac ()
 
MatrixDoublegetHoGaussPtsInvJac ()
 
VectorDoublegetHoGaussPtsDetJac ()
 
auto getFTenosr0HoMeasure ()
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
auto getFTensor1HoCoordsAtGaussPts ()
 Get coordinates at integration points taking geometry from field. More...
 
auto getFTensor2HoGaussPtsJac ()
 
auto getFTensor2HoGaussPtsInvJac ()
 
VolumeElementForcesAndSourcesCoreBasegetVolumeFE () const
 return pointer to Generic Volume Finite Element object More...
 
MoFEMErrorCode getDivergenceOfHDivBaseFunctions (int side, EntityType type, DataForcesAndSourcesCore::EntData &data, int gg, VectorDouble &div)
 Get divergence of base functions at integration point. More...
 
MoFEMErrorCode getCurlOfHCurlBaseFunctions (int side, EntityType type, DataForcesAndSourcesCore::EntData &data, int gg, MatrixDouble &curl)
 Get curl of base functions at integration point. More...
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPLAST, const bool symm=true)
 
 UserDataOperator (const std::string &field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string &row_field_name, const std::string &col_field_name, const char type, const bool symm=true)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
boost::weak_ptr< SideNumber > getSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement ()
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
const std::string & getFEName () const
 Get name of the element. More...
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
DEPRECATED Vec getSnesF () const
 
DEPRECATED Vec getSnesX () const
 
DEPRECATED Mat getSnesA () const
 
DEPRECATED Mat getSnesB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Private Attributes

moab::Interface & postProcMesh
 
std::vector< EntityHandle > & mapGaussPts
 
boost::shared_ptr< CommonDatacommonDataPtr
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType { OPROW = 1 << 0, OPCOL = 1 << 1, OPROWCOL = 1 << 2, OPLAST = 1 << 3 }
 Controls loop over entities on element. More...
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity. More...
 
booldoVertices
 \deprectaed If false skip vertices More...
 
booldoEdges
 \deprectaed If false skip edges More...
 
booldoQuads
 \deprectaed More...
 
booldoTris
 \deprectaed More...
 
booldoTets
 \deprectaed More...
 
booldoPrisms
 \deprectaed More...
 
- Protected Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Definition at line 252 of file PlasticOperators.hpp.

Constructor & Destructor Documentation

◆ OpPostProcPlastic()

OpPlasticTools::OpPostProcPlastic::OpPostProcPlastic ( const std::string  field_name,
moab::Interface &  post_proc_mesh,
std::vector< EntityHandle > &  map_gauss_pts,
boost::shared_ptr< CommonData common_data_ptr 
)

Definition at line 968 of file PlasticOperators.cpp.

972  : DomainEleOp(field_name, DomainEleOp::OPROW), postProcMesh(post_proc_mesh),
973  mapGaussPts(map_gauss_pts), commonDataPtr(common_data_ptr) {
974  // Operator is only executed for vertices
975  std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
976 }

Member Function Documentation

◆ doWork()

MoFEMErrorCode OpPlasticTools::OpPostProcPlastic::doWork ( int  side,
EntityType  type,
EntData data 
)
virtual

[Postprocessing]

Reimplemented from MoFEM::DataOperator.

Definition at line 979 of file PlasticOperators.cpp.

980  {
982 
983  std::array<double, 9> def;
984  std::fill(def.begin(), def.end(), 0);
985 
986  auto get_tag = [&](const std::string name, size_t size) {
987  Tag th;
988  CHKERR postProcMesh.tag_get_handle(name.c_str(), size, MB_TYPE_DOUBLE, th,
989  MB_TAG_CREAT | MB_TAG_SPARSE,
990  def.data());
991  return th;
992  };
993 
994  MatrixDouble3by3 mat(3, 3);
995 
996  auto set_matrix_3d = [&](auto &t) -> MatrixDouble3by3 & {
997  mat.clear();
998  for (size_t r = 0; r != 3; ++r)
999  for (size_t c = 0; c != 3; ++c)
1000  mat(r, c) = t(r, c);
1001  return mat;
1002  };
1003 
1004  auto set_scalar = [&](auto t) -> MatrixDouble3by3 & {
1005  mat.clear();
1006  mat(0, 0) = t;
1007  return mat;
1008  };
1009 
1010  auto set_tag = [&](auto th, auto gg, MatrixDouble3by3 &mat) {
1011  return postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
1012  &*mat.data().begin());
1013  };
1014 
1015  auto th_plastic_surface = get_tag("PLASTIC_SURFACE", 1);
1016  auto th_tau = get_tag("PLASTIC_MULTIPLIER", 1);
1017 
1018  auto th_eqv_ep = get_tag("EQUIV_EP", 1);
1019  auto th_hardening = get_tag("HARDENING", 1);
1020 
1021  auto th_plastic_flow = get_tag("PLASTIC_FLOW", 9);
1022  string strain_name = "PLASTIC_STRAIN";
1023 
1024  auto th_plastic_strain = get_tag(strain_name, 9);
1025 
1026  auto t_flow =
1027  getFTensor2SymmetricFromMat<3>(*(commonDataPtr->plasticFlowPtr));
1028  auto t_plastic_strain =
1029  getFTensor2SymmetricFromMat<3>(*(commonDataPtr->plasticStrainPtr));
1030  auto t_stress = getFTensor2SymmetricFromMat<3>(*(commonDataPtr->mStressPtr));
1031 
1032  size_t gg = 0;
1033  for (; gg != commonDataPtr->plasticSurfacePtr->size(); ++gg) {
1034  const double f = (*(commonDataPtr->plasticSurfacePtr))[gg];
1035  const double tau = (*(commonDataPtr->plasticTauPtr))[gg];
1036 
1037  CHKERR set_tag(th_plastic_surface, gg, set_scalar(f - hardening(tau)));
1038  CHKERR set_tag(th_tau, gg, set_scalar(tau));
1039  CHKERR set_tag(th_plastic_flow, gg, set_matrix_3d(t_flow));
1040 
1041  // t_plastic_strain(i, j) *= 2.;
1042  // auto exp_plast_strain = exp_map(t_plastic_strain);
1043  // double det_g;
1044  // CHKERR determinantTensor3by3(exp_plast_strain, det_g);
1045  // CHKERR set_tag(th_det_g, gg, set_scalar(det_g));
1046 
1047  CHKERR set_tag(th_plastic_strain, gg, set_matrix_3d(t_plastic_strain));
1048  const double eqv_ep =
1049  std::sqrt(t_plastic_strain(i, j) * t_plastic_strain(i, j));
1050  CHKERR set_tag(th_eqv_ep, gg, set_scalar(eqv_ep));
1051  const double hard = hardening(tau) / (*cache).young_modulus_inv;
1052  CHKERR set_tag(th_hardening, gg, set_scalar(hard));
1053 
1054  ++t_flow;
1055  ++t_stress;
1056  ++t_plastic_strain;
1057  }
1058 
1060 }

Member Data Documentation

◆ commonDataPtr

boost::shared_ptr<CommonData> OpPlasticTools::OpPostProcPlastic::commonDataPtr
private

Definition at line 262 of file PlasticOperators.hpp.

◆ mapGaussPts

std::vector<EntityHandle>& OpPlasticTools::OpPostProcPlastic::mapGaussPts
private

Definition at line 261 of file PlasticOperators.hpp.

◆ postProcMesh

moab::Interface& OpPlasticTools::OpPostProcPlastic::postProcMesh
private

Definition at line 260 of file PlasticOperators.hpp.


The documentation for this struct was generated from the following files:
OpPlasticTools::hardening
auto hardening(double tau)
Definition: PlasticOperators.hpp:341
OpPlasticTools::OpPostProcPlastic::mapGaussPts
std::vector< EntityHandle > & mapGaussPts
Definition: PlasticOperators.hpp:261
OpPlasticTools::OpPostProcPlastic::postProcMesh
moab::Interface & postProcMesh
Definition: PlasticOperators.hpp:260
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:604
HenkyOps::f
auto f
Definition: HenkyOps.hpp:19
DomainEleOp
DomainEle::UserDataOperator DomainEleOp
Definition: PlasticOperators.cpp:24
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROW
@ OPROW
Definition: ForcesAndSourcesCore.hpp:99
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MoFEM::Types::MatrixDouble3by3
MatrixBoundedArray< double, 9 > MatrixDouble3by3
Definition: Types.hpp:102
OpPlasticTools::OpPostProcPlastic::commonDataPtr
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOperators.hpp:262
ElectroPhysiology::c
const double c
Definition: ElecPhysOperators.hpp:31
i
FTensor::Index< 'i', 3 > i
Definition: matrix_function.cpp:18
MoFEM::DataOperator::doEntities
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.
Definition: DataOperators.hpp:75
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
ReactionDiffusionEquation::r
const double r
rate factor
Definition: reaction_diffusion.cpp:33