v0.14.0
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
OpPostProcDataStructure Struct Reference

#include <users_modules/eshelbian_plasticit/src/EshelbianOperators.hpp>

Inheritance diagram for OpPostProcDataStructure:
[legend]
Collaboration diagram for OpPostProcDataStructure:
[legend]

Public Types

using OP = VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator
 

Public Member Functions

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

Public Attributes

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

Private Attributes

int tagSense
 

Detailed Description

Examples
EshelbianPlasticity.cpp.

Definition at line 527 of file EshelbianOperators.hpp.

Member Typedef Documentation

◆ OP

Definition at line 530 of file EshelbianOperators.hpp.

Constructor & Destructor Documentation

◆ OpPostProcDataStructure()

OpPostProcDataStructure::OpPostProcDataStructure ( moab::Interface &  post_proc_mesh,
std::vector< EntityHandle > &  map_gauss_pts,
boost::shared_ptr< DataAtIntegrationPts data_ptr,
int  sense 
)
inline

Definition at line 536 of file EshelbianOperators.hpp.

540  : OP(NOSPACE, UserDataOperator::OPSPACE), postProcMesh(post_proc_mesh),
541  mapGaussPts(map_gauss_pts), dataAtPts(data_ptr), tagSense(sense) {}

Member Function Documentation

◆ doWork()

MoFEMErrorCode OpPostProcDataStructure::doWork ( int  side,
EntityType  type,
EntData data 
)
Examples
EshelbianOperators.cpp.

Definition at line 2182 of file EshelbianOperators.cpp.

2183  {
2185 
2186  if (tagSense != getSkeletonSense())
2188 
2189  auto get_tag = [&](auto name) {
2190  auto &mob = getPtrFE()->mField.get_moab();
2191  Tag tag;
2192  CHK_MOAB_THROW(mob.tag_get_handle(name, tag), "get tag");
2193  return tag;
2194  };
2195 
2196  auto get_tag_value = [&](auto &&tag, int dim) {
2197  auto &mob = getPtrFE()->mField.get_moab();
2198  auto face = getSidePtrFE()->getFEEntityHandle();
2199  std::vector<double> value(dim);
2200  CHK_MOAB_THROW(mob.tag_get_data(tag, &face, 1, value.data()), "set tag");
2201  return value;
2202  };
2203 
2204  auto create_tag = [this](const std::string tag_name, const int size) {
2205  double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
2206  Tag th;
2207  CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
2208  th, MB_TAG_CREAT | MB_TAG_SPARSE,
2209  def_VAL);
2210  return th;
2211  };
2212 
2213  Tag th_cauchy_streess = create_tag("CauchyStress", 9);
2214  Tag th_detF = create_tag("detF", 1);
2215  Tag th_traction = create_tag("traction", 3);
2216  Tag th_disp_error = create_tag("DisplacementError", 1);
2217 
2218  Tag th_energy = create_tag("Energy", 1);
2219 
2220  auto t_w = getFTensor1FromMat<3>(dataAtPts->wL2AtPts);
2221  auto t_h = getFTensor2FromMat<3, 3>(dataAtPts->hAtPts);
2222  auto t_approx_P = getFTensor2FromMat<3, 3>(dataAtPts->approxPAtPts);
2223 
2224  auto t_normal = getFTensor1NormalsAtGaussPts();
2225  auto t_disp = getFTensor1FromMat<3>(dataAtPts->wH1AtPts);
2226 
2227  auto next = [&]() {
2228  ++t_w;
2229  ++t_h;
2230  ++t_approx_P;
2231  ++t_normal;
2232  ++t_disp;
2233  };
2234 
2235  if (dataAtPts->energyAtPts.size() == 0) {
2236  // that is for case that energy is not calculated
2237  dataAtPts->energyAtPts.resize(getGaussPts().size2());
2238  dataAtPts->energyAtPts.clear();
2239  }
2240  auto t_energy = getFTensor0FromVec(dataAtPts->energyAtPts);
2241 
2246 
2247  auto set_float_precision = [](const double x) {
2248  if (std::abs(x) < std::numeric_limits<float>::epsilon())
2249  return 0.;
2250  else
2251  return x;
2252  };
2253 
2254  // scalars
2255  auto save_scal_tag = [&](auto &th, auto v, const int gg) {
2257  v = set_float_precision(v);
2258  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, &v);
2260  };
2261 
2262  // vectors
2263  VectorDouble3 v(3);
2264  FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
2265  auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
2267  t_v(i) = t_d(i);
2268  for (auto &a : v.data())
2269  a = set_float_precision(a);
2270  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2271  &*v.data().begin());
2273  };
2274 
2275  // tensors
2276 
2277  MatrixDouble3by3 m(3, 3);
2279  &m(0, 0), &m(0, 1), &m(0, 2),
2280 
2281  &m(1, 0), &m(1, 1), &m(1, 2),
2282 
2283  &m(2, 0), &m(2, 1), &m(2, 2));
2284 
2285  auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
2287  t_m(i, j) = t_d(i, j);
2288  for (auto &v : m.data())
2289  v = set_float_precision(v);
2290  CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
2291  &*m.data().begin());
2293  };
2294 
2295  const auto nb_gauss_pts = getGaussPts().size2();
2296  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
2297 
2298  FTensor::Tensor1<double, 3> t_traction;
2299  t_traction(i) = t_approx_P(i, j) * t_normal(j) / t_normal.l2();
2300  // vectors
2301  CHKERR save_vec_tag(th_traction, t_traction, gg);
2302 
2303  double u_error = sqrt((t_disp(i) - t_w(i)) * (t_disp(i) - t_w(i)));
2304  CHKERR save_scal_tag(th_disp_error, u_error, gg);
2305  CHKERR save_scal_tag(th_energy, t_energy, gg);
2306 
2307  const double jac = determinantTensor3by3(t_h);
2309  t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
2310  CHKERR save_mat_tag(th_cauchy_streess, t_cauchy, gg);
2311  CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
2312 
2313  next();
2314  }
2315 
2317 }

Member Data Documentation

◆ dataAtPts

boost::shared_ptr<DataAtIntegrationPts> OpPostProcDataStructure::dataAtPts

Definition at line 534 of file EshelbianOperators.hpp.

◆ mapGaussPts

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

Definition at line 533 of file EshelbianOperators.hpp.

◆ postProcMesh

moab::Interface& OpPostProcDataStructure::postProcMesh

Definition at line 532 of file EshelbianOperators.hpp.

◆ tagSense

int OpPostProcDataStructure::tagSense
private

Definition at line 546 of file EshelbianOperators.hpp.


The documentation for this struct was generated from the following files:
NOSPACE
@ NOSPACE
Definition: definitions.h:83
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
CHK_MOAB_THROW
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:589
MoFEM::Types::VectorDouble3
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:92
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPSPACE
@ OPSPACE
operator do Work is execute on space data
Definition: ForcesAndSourcesCore.hpp:570
OpPostProcDataStructure::tagSense
int tagSense
Definition: EshelbianOperators.hpp:546
OpPostProcDataStructure::dataAtPts
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
Definition: EshelbianOperators.hpp:534
FTensor::Tensor1::l2
T l2() const
Definition: Tensor1_value.hpp:84
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
OpPostProcDataStructure::postProcMesh
moab::Interface & postProcMesh
Definition: EshelbianOperators.hpp:532
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 3 >
MoFEM::determinantTensor3by3
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:1540
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MoFEM::Types::MatrixDouble3by3
MatrixBoundedArray< double, 9 > MatrixDouble3by3
Definition: Types.hpp:105
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
OpPostProcDataStructure::OP
VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator OP
Definition: EshelbianOperators.hpp:530
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
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
OpPostProcDataStructure::mapGaussPts
std::vector< EntityHandle > & mapGaussPts
Definition: EshelbianOperators.hpp:533