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

#include <users_modules/tutorials/adv-0/src/PlasticOps.hpp>

Inheritance diagram for PlasticOps::OpPostProcPlastic:
[legend]
Collaboration diagram for PlasticOps::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...
 
double & getVolume ()
 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...
 
VectorDoublegetCoords ()
 nodal coordinates More...
 
VolumeElementForcesAndSourcesCoreBasegetVolumeFE () const
 return pointer to Generic Volume Finite Element object More...
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, 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...
 
int getFEDim () const
 Get dimension of finite element. More...
 
EntityType getFEType () const
 Get dimension of finite element. More...
 
boost::weak_ptr< SideNumbergetSideNumberPtr (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 () const
 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
 
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...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
double getMeasure () const
 get measure of element More...
 
double & getMeasure ()
 get measure of element More...
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User call this function to loop over elements on the side of face. This function calls finite element with is operator to do calculations. More...
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User call this function to loop over parent elements. This function calls finite element with is operator to do calculations. More...
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User call this function to loop over parent elements. This function calls finite element with is operator to do calculations. More...
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User call this function to loop over parent elements. This function calls finite element with is operator to do calculations. More...
 
- 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, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &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 , OPSPACE = 1 << 3 }
 Controls loop over entities on element. More...
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
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...
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
- Protected Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Definition at line 279 of file PlasticOps.hpp.

Constructor & Destructor Documentation

◆ OpPostProcPlastic()

PlasticOps::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 
)
Examples
PlasticOps.hpp, and PlasticOpsMonitor.hpp.

Definition at line 21 of file PlasticOpsMonitor.hpp.

25  : DomainEleOp(field_name, DomainEleOp::OPROW), postProcMesh(post_proc_mesh),
26  mapGaussPts(map_gauss_pts), commonDataPtr(common_data_ptr) {
27  // Opetor is only executed for vertices
28  std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
29 }
DomainEle::UserDataOperator DomainEleOp
Finire element operator type.
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.
boost::shared_ptr< CommonData > commonDataPtr
Definition: PlasticOps.hpp:289
std::vector< EntityHandle > & mapGaussPts
Definition: PlasticOps.hpp:288
moab::Interface & postProcMesh
Definition: PlasticOps.hpp:287

Member Function Documentation

◆ doWork()

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

[Postprocessing]

Reimplemented from MoFEM::DataOperator.

Examples
PlasticOps.hpp, and PlasticOpsMonitor.hpp.

Definition at line 32 of file PlasticOpsMonitor.hpp.

33  {
35 
36  std::array<double, 9> def;
37  std::fill(def.begin(), def.end(), 0);
38 
39  auto get_tag = [&](const std::string name, size_t size) {
40  Tag th;
41  CHKERR postProcMesh.tag_get_handle(name.c_str(), size, MB_TYPE_DOUBLE, th,
42  MB_TAG_CREAT | MB_TAG_SPARSE,
43  def.data());
44  return th;
45  };
46 
47  MatrixDouble3by3 mat(3, 3);
48 
49  auto set_matrix_3d = [&](auto &t) -> MatrixDouble3by3 & {
50  mat.clear();
51  for (size_t r = 0; r != SPACE_DIM; ++r)
52  for (size_t c = 0; c != SPACE_DIM; ++c)
53  mat(r, c) = t(r, c);
54  return mat;
55  };
56 
57  auto set_scalar = [&](auto t) -> MatrixDouble3by3 & {
58  mat.clear();
59  mat(0, 0) = t;
60  return mat;
61  };
62 
63  auto set_float_precision = [](const double x) {
64  if (std::abs(x) < std::numeric_limits<float>::epsilon())
65  return 0.;
66  else
67  return x;
68  };
69 
70  auto set_tag = [&](auto th, auto gg, MatrixDouble3by3 &mat) {
71  for (auto &v : mat.data())
72  v = set_float_precision(v);
73  return postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
74  &*mat.data().begin());
75  };
76 
77  auto th_plastic_surface = get_tag("PLASTIC_SURFACE", 1);
78  auto th_hardening = get_tag("HARDENING", 1);
79  auto th_tau = get_tag("PLASTIC_MULTIPLIER", 1);
80  auto th_temperature = get_tag("TEMPERATURE", 1);
81  auto th_plastic_flow = get_tag("PLASTIC_FLOW", 9);
82  auto th_plastic_strain = get_tag("PLASTIC_STRAIN", 9);
83 
84  auto t_flow =
85  getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->plasticFlow);
86  auto t_plastic_strain =
87  getFTensor2SymmetricFromMat<SPACE_DIM>(commonDataPtr->plasticStrain);
88  if (commonDataPtr->tempVal.size() != commonDataPtr->plasticSurface.size()) {
89  commonDataPtr->tempVal.resize(commonDataPtr->plasticSurface.size(), 0);
90  commonDataPtr->tempVal.clear();
91  }
92 
93  size_t gg = 0;
94  for (int gg = 0; gg != commonDataPtr->plasticSurface.size(); ++gg) {
95  const double temp = (commonDataPtr->tempVal)[gg];
96  const double tau = (commonDataPtr->plasticTau)[gg];
97  const double f = (commonDataPtr->plasticSurface)[gg];
98  const double h = hardening(tau, temp);
99  CHKERR set_tag(th_plastic_surface, gg, set_scalar(f));
100  CHKERR set_tag(th_hardening, gg, set_scalar(h));
101  CHKERR set_tag(th_tau, gg, set_scalar(tau));
102  CHKERR set_tag(th_temperature, gg, set_scalar(temp));
103  CHKERR set_tag(th_plastic_flow, gg, set_matrix_3d(t_flow));
104  CHKERR set_tag(th_plastic_strain, gg, set_matrix_3d(t_plastic_strain));
105  ++t_flow;
106  ++t_plastic_strain;
107  }
108 
110 }
constexpr int SPACE_DIM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
void temp(int x, int y=10)
Definition: simple.cpp:4
double v
phase velocity of light in medium (cm/ns)
MatrixBoundedArray< double, 9 > MatrixDouble3by3
Definition: Types.hpp:116
auto hardening(long double tau)
const double r
rate factor
double h
convective heat coefficient
constexpr double t
plate stiffness
Definition: plate.cpp:76

Member Data Documentation

◆ commonDataPtr

boost::shared_ptr<CommonData> PlasticOps::OpPostProcPlastic::commonDataPtr
private
Examples
PlasticOps.hpp, and PlasticOpsMonitor.hpp.

Definition at line 289 of file PlasticOps.hpp.

◆ mapGaussPts

std::vector<EntityHandle>& PlasticOps::OpPostProcPlastic::mapGaussPts
private
Examples
PlasticOps.hpp, and PlasticOpsMonitor.hpp.

Definition at line 288 of file PlasticOps.hpp.

◆ postProcMesh

moab::Interface& PlasticOps::OpPostProcPlastic::postProcMesh
private
Examples
PlasticOps.hpp, and PlasticOpsMonitor.hpp.

Definition at line 287 of file PlasticOps.hpp.


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