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

#include <users_modules/basic_finite_elements/lessons/src/PlasticOps.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...
 

Private Attributes

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

Detailed Description

Examples
lesson7_plastic.cpp.

Definition at line 203 of file PlasticOps.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 1131 of file PlasticOps.hpp.

1135  : DomainEleOp(field_name, DomainEleOp::OPROW), postProcMesh(post_proc_mesh),
1136  mapGaussPts(map_gauss_pts), commonDataPtr(common_data_ptr) {
1137  // Opetor is only executed for vertices
1138  std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
1139 }
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOps.hpp:213
moab::Interface & postProcMesh
Definition: PlasticOps.hpp:211
std::vector< EntityHandle > & mapGaussPts
Definition: PlasticOps.hpp:212
DomainEle::UserDataOperator DomainEleOp

Member Function Documentation

◆ doWork()

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

[Postprocessing]

Definition at line 1142 of file PlasticOps.hpp.

1143  {
1145 
1146  std::array<double, 9> def;
1147  std::fill(def.begin(), def.end(), 0);
1148 
1149  auto get_tag = [&](const std::string name, size_t size) {
1150  Tag th;
1151  CHKERR postProcMesh.tag_get_handle(name.c_str(), size, MB_TYPE_DOUBLE, th,
1152  MB_TAG_CREAT | MB_TAG_SPARSE,
1153  def.data());
1154  return th;
1155  };
1156 
1157  MatrixDouble3by3 mat(3, 3);
1158 
1159  auto set_matrix_2d = [&](auto &t) -> MatrixDouble3by3 & {
1160  mat.clear();
1161  for (size_t r = 0; r != 2; ++r)
1162  for (size_t c = 0; c != 2; ++c)
1163  mat(r, c) = t(r, c);
1164  return mat;
1165  };
1166 
1167  auto set_matrix_3d = [&](auto &t) -> MatrixDouble3by3 & {
1168  mat.clear();
1169  for (size_t r = 0; r != 3; ++r)
1170  for (size_t c = 0; c != 3; ++c)
1171  mat(r, c) = t(r, c);
1172  return mat;
1173  };
1174 
1175  auto set_matrix_2d_symm = [&](auto &t) -> MatrixDouble3by3 & {
1176  mat.clear();
1177  for (size_t r = 0; r != 2; ++r)
1178  for (size_t c = 0; c != 2; ++c)
1179  mat(r, c) = t(r, c);
1180  return mat;
1181  };
1182 
1183  auto set_scalar = [&](auto t) -> MatrixDouble3by3 & {
1184  mat.clear();
1185  mat(0, 0) = t;
1186  return mat;
1187  };
1188 
1189  auto set_tag = [&](auto th, auto gg, MatrixDouble3by3 &mat) {
1190  return postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
1191  &*mat.data().begin());
1192  };
1193 
1194  auto th_plastic_surface = get_tag("PLASTIC_SURFACE", 1);
1195  auto th_tau = get_tag("PLASTIC_MULTIPLIER", 1);
1196  auto th_plastic_flow = get_tag("PLASTIC_FLOW", 9);
1197  auto th_plastic_strain = get_tag("PLASTIC_STRAIN", 9);
1198 
1199  auto t_flow =
1200  getFTensor2SymmetricFromMat<2>(*(commonDataPtr->plasticFlowPtr));
1201  auto t_plastic_strain =
1202  getFTensor2SymmetricFromMat<2>(*(commonDataPtr->plasticStrainPtr));
1203  size_t gg = 0;
1204  for (int gg = 0; gg != commonDataPtr->plasticSurfacePtr->size(); ++gg) {
1205  const double f = (*(commonDataPtr->plasticSurfacePtr))[gg];
1206  const double tau = (*(commonDataPtr->plasticTauPtr))[gg];
1207  CHKERR set_tag(th_plastic_surface, gg, set_scalar(f - hardening(tau)));
1208  CHKERR set_tag(th_tau, gg, set_scalar(tau));
1209  CHKERR set_tag(th_plastic_flow, gg, set_matrix_2d(t_flow));
1210  CHKERR set_tag(th_plastic_strain, gg, set_matrix_2d(t_plastic_strain));
1211  ++t_flow;
1212  ++t_plastic_strain;
1213  }
1214 
1216 }
auto hardening(double tau)
Definition: PlasticOps.hpp:281
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOps.hpp:213
moab::Interface & postProcMesh
Definition: PlasticOps.hpp:211
std::vector< EntityHandle > & mapGaussPts
Definition: PlasticOps.hpp:212
MatrixBoundedArray< double, 9 > MatrixDouble3by3
Definition: Types.hpp:101
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413

Member Data Documentation

◆ commonDataPtr

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

Definition at line 213 of file PlasticOps.hpp.

◆ mapGaussPts

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

Definition at line 212 of file PlasticOps.hpp.

◆ postProcMesh

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

Definition at line 211 of file PlasticOps.hpp.


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