v0.8.23
Public Member Functions | Public Attributes | List of all members
EshelbianPlasticity::OpPostProcDataStructure Struct Reference

#include <users_modules/eshelbian_plasticty/src/EshelbianPlasticity.hpp>

Inherits VolUserDataOperator.

Public Member Functions

 OpPostProcDataStructure (moab::Interface &post_proc_mesh, std::vector< EntityHandle > &map_gauss_pts, const std::string field_name, boost::shared_ptr< DataAtIntegrationPts > &data_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Public Attributes

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

Detailed Description

Definition at line 1136 of file EshelbianPlasticity.hpp.

Constructor & Destructor Documentation

◆ OpPostProcDataStructure()

EshelbianPlasticity::OpPostProcDataStructure::OpPostProcDataStructure ( moab::Interface &  post_proc_mesh,
std::vector< EntityHandle > &  map_gauss_pts,
const std::string  field_name,
boost::shared_ptr< DataAtIntegrationPts > &  data_ptr 
)

Definition at line 1142 of file EshelbianPlasticity.hpp.

1146  : VolUserDataOperator(field_name, UserDataOperator::OPROW),
1147  postProcMesh(post_proc_mesh), mapGaussPts(map_gauss_pts),
1148  dataAtPts(data_ptr) {}
std::vector< EntityHandle > & mapGaussPts
VolumeElementForcesAndSourcesCore::UserDataOperator VolUserDataOperator
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
moab::Interface & postProcMesh

Member Function Documentation

◆ doWork()

MoFEMErrorCode EshelbianPlasticity::OpPostProcDataStructure::doWork ( int  side,
EntityType  type,
EntData data 
)

Definition at line 2450 of file EshelbianOperators.cpp.

2451  {
2453  if (type != MBVERTEX)
2455 
2456  auto create_tag = [this](const std::string tag_name, const int size) {
2457  double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
2458  Tag th;
2459  CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
2460  th, MB_TAG_CREAT | MB_TAG_SPARSE,
2461  def_VAL);
2462  return th;
2463  };
2464 
2465  Tag th_w = create_tag("SpatialDisplacement", 3);
2466  Tag th_omega = create_tag("Omega", 3);
2467  Tag th_approxP = create_tag("Piola2Stress", 9);
2468  Tag th_sigma = create_tag("CauchyStress", 9);
2469  Tag th_u = create_tag("SpatialStreach", 9);
2470  Tag th_h = create_tag("h", 9);
2471  Tag th_x = create_tag("x", 3);
2472  Tag th_X = create_tag("X", 3);
2473  Tag th_detF = create_tag("detF", 1);
2474  Tag th_angular_momentum = create_tag("AngularMomentum", 3);
2475 
2476  int nb_gauss_pts = data.getN().size1();
2477  if (mapGaussPts.size() != (unsigned int)nb_gauss_pts) {
2478  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2479  "Nb. of integration points is not equal to number points on "
2480  "post-processing mesh");
2481  }
2482 
2483  auto t_w = getFTensor1FromMat<3>(*(dataAtPts->wAtPts));
2484  auto t_x = getFTensor1FromMat<3>(*(dataAtPts->xAtPts));
2485  auto t_omega = getFTensor1FromMat<3>(*(dataAtPts->rotAxisAtPts));
2486  auto t_h = getFTensor2FromMat<3, 3>(*(dataAtPts->hAtPts));
2487  auto t_u = getFTensor2SymmetricFromMat<3>(*(dataAtPts->streachTensorAtPts));
2488  auto t_R = getFTensor2FromMat<3, 3>(*(dataAtPts->rotMatAtPts));
2489  auto t_approx_P = getFTensor2FromMat<3, 3>(*(dataAtPts->approxPAtPts));
2490  auto t_coords = getFTensor1CoordsAtGaussPts();
2491 
2496 
2497  // vectors
2498  VectorDouble3 v(3);
2499  FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
2500  auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
2502  t_v(i) = t_d(i);
2503  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2504  &*v.data().begin());
2506  };
2507 
2508  MatrixDouble3by3 m(3, 3);
2510  &m(0, 0), &m(0, 1), &m(0, 2),
2511 
2512  &m(1, 0), &m(1, 1), &m(1, 2),
2513 
2514  &m(2, 0), &m(2, 1), &m(2, 2));
2515 
2516  auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
2518  t_m(i, j) = t_d(i, j);
2519  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2520  &*m.data().begin());
2522  };
2523 
2524  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
2525 
2526  // vetors
2527  CHKERR save_vec_tag(th_w, t_w, gg);
2528  CHKERR save_vec_tag(th_x, t_x, gg);
2529  CHKERR save_vec_tag(th_X, t_coords, gg);
2530  CHKERR save_vec_tag(th_omega, t_omega, gg);
2531 
2532  // tensors
2533  CHKERR save_mat_tag(th_h, t_h, gg);
2535  for (int ii = 0; ii != 3; ++ii)
2536  for (int jj = 0; jj != 3; ++jj)
2537  t_u_tmp(ii, jj) = t_u(ii, jj);
2538  CHKERR save_mat_tag(th_u, t_u_tmp, gg);
2539  CHKERR save_mat_tag(th_approxP, t_approx_P, gg);
2540 
2541  const double jac = dEterminant(t_h);
2543  t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
2544  CHKERR save_mat_tag(th_sigma, t_cauchy, gg);
2545  CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
2546 
2548  t_PhT(i, k) = t_approx_P(i, j) * t_R(k, j);
2549  FTensor::Tensor1<double, 3> t_leviPRT;
2550  t_leviPRT(k) = levi_civita(i, l, k) * t_PhT(i, l);
2551 
2552  CHKERR postProcMesh.tag_set_data(th_angular_momentum, &mapGaussPts[gg], 1,
2553  &t_leviPRT(0));
2554 
2555  ++t_w;
2556  ++t_x;
2557  ++t_h;
2558  ++t_u;
2559  ++t_omega;
2560  ++t_R;
2561  ++t_approx_P;
2562  ++t_coords;
2563  }
2564 
2566 }
std::vector< EntityHandle > & mapGaussPts
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507
static double dEterminant(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:325
MatrixBoundedArray< double, 9 > MatrixDouble3by3
Definition: Types.hpp:98
#define CHKERR
Inline error check.
Definition: definitions.h:595
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:88
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
moab::Interface & postProcMesh
constexpr std::enable_if<(Dim0<=2 &&Dim1<=2), Tensor2_Expr< Levi_Civita< T >, T, Dim0, Dim1, i, j > >::type levi_civita(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
levi_civita functions to make for easy adhoc use

Member Data Documentation

◆ dataAtPts

boost::shared_ptr<DataAtIntegrationPts> EshelbianPlasticity::OpPostProcDataStructure::dataAtPts

Definition at line 1140 of file EshelbianPlasticity.hpp.

◆ mapGaussPts

std::vector<EntityHandle>& EshelbianPlasticity::OpPostProcDataStructure::mapGaussPts

Definition at line 1139 of file EshelbianPlasticity.hpp.

◆ postProcMesh

moab::Interface& EshelbianPlasticity::OpPostProcDataStructure::postProcMesh

Definition at line 1138 of file EshelbianPlasticity.hpp.


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