v0.16.3
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
OpPostProcDataStructure Struct Reference

#include "users_modules/eshelbian_plasticity/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< DataAtIntegrationPts > dataAtPts
 

Private Attributes

int tagSense
 

Detailed Description

Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 964 of file EshelbianOperators.hpp.

Member Typedef Documentation

◆ OP

using OpPostProcDataStructure::OP = VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator

Definition at line 967 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 973 of file EshelbianOperators.hpp.

977 : OP(NOSPACE, UserDataOperator::OPSPACE), postProcMesh(post_proc_mesh),
978 mapGaussPts(map_gauss_pts), dataAtPts(data_ptr), tagSense(sense) {}
@ NOSPACE
Definition definitions.h:83
std::vector< EntityHandle > & mapGaussPts
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator OP

Member Function Documentation

◆ doWork()

MoFEMErrorCode OpPostProcDataStructure::doWork ( int  side,
EntityType  type,
EntData &  data 
)
Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianOperators.cpp.

Definition at line 4061 of file EshelbianOperators.cpp.

4062 {
4064
4065 if (tagSense != getSkeletonSense())
4067
4068 auto create_tag = [this](const std::string tag_name, const int size) {
4069 double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
4070 Tag th;
4071 CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
4072 th, MB_TAG_CREAT | MB_TAG_SPARSE,
4073 def_VAL);
4074 return th;
4075 };
4076
4077 Tag th_cauchy_streess = create_tag("CauchyStress", 9);
4078 Tag th_detF = create_tag("detF", 1);
4079 Tag th_traction = create_tag("traction", 3);
4080 Tag th_disp_error = create_tag("DisplacementError", 1);
4081
4082 Tag th_energy = create_tag("Energy", 1);
4083 Tag th_young_modulus = create_tag("YoungModulus", 1);
4084
4085 const auto nb_gauss_pts = getGaussPts().size2();
4086 auto t_w = dataAtPts->getFTensorSmallWL2(nb_gauss_pts);
4087 auto t_h = dataAtPts->getFTensorSmallH(nb_gauss_pts);
4088 auto t_approx_P = dataAtPts->getFTensorApproxP(nb_gauss_pts);
4089
4090 auto t_normal = getFTensor1NormalsAtGaussPts();
4091 auto t_disp = dataAtPts->getFTensorSmallWH1(nb_gauss_pts);
4092
4093 // auto sense = getSkeletonSense();
4094
4095 if (dataAtPts->energyAtPts.size() == 0) {
4096 // that is for case that energy is not calculated
4097 dataAtPts->energyAtPts.resize(nb_gauss_pts);
4098 dataAtPts->energyAtPts.clear();
4099 }
4100 auto t_energy = getFTensor0FromVec(dataAtPts->energyAtPts);
4101 std::optional<decltype(getFTensor0FromVec(dataAtPts->youngModulusAtPts))>
4102 t_youngs_modulus;
4103 if (dataAtPts->physicsPtr->getFeatures().test(
4104 PhysicalEquations::NON_HOMOGENEOUS_MATERIAL)) {
4105 if (dataAtPts->youngModulusAtPts.size() != nb_gauss_pts)
4106 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
4107 "Young's modulus postprocessing requires current material data");
4108 t_youngs_modulus.emplace(
4109 getFTensor0FromVec(dataAtPts->youngModulusAtPts));
4110 }
4111
4112 auto next = [&]() {
4113 ++t_w;
4114 ++t_h;
4115 ++t_approx_P;
4116 ++t_normal;
4117 ++t_disp;
4118 if (t_youngs_modulus)
4119 ++*t_youngs_modulus;
4120 ++t_energy;
4121 };
4122
4123 FTensor::Index<'i', 3> i;
4124 FTensor::Index<'j', 3> j;
4125 FTensor::Index<'k', 3> k;
4126 FTensor::Index<'l', 3> l;
4127
4128 auto set_float_precision = [](const double x) {
4129 if (std::abs(x) < std::numeric_limits<float>::epsilon())
4130 return 0.;
4131 else
4132 return x;
4133 };
4134
4135 // scalars
4136 auto save_scal_tag = [&](auto &th, auto v, const int gg) {
4138 v = set_float_precision(v);
4139 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, &v);
4141 };
4142
4143 // vectors
4144 VectorDouble3 v(3);
4145 FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
4146 auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
4148 t_v(i) = t_d(i);
4149 for (auto &a : v.data())
4150 a = set_float_precision(a);
4151 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
4152 &*v.data().begin());
4154 };
4155
4156 // tensors
4157
4158 MatrixDouble3by3 m(3, 3);
4160 &m(0, 0), &m(0, 1), &m(0, 2),
4161
4162 &m(1, 0), &m(1, 1), &m(1, 2),
4163
4164 &m(2, 0), &m(2, 1), &m(2, 2));
4165
4166 auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
4168 t_m(i, j) = t_d(i, j);
4169 for (auto &v : m.data())
4170 v = set_float_precision(v);
4171 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
4172 &*m.data().begin());
4174 };
4175
4176 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
4177
4178 FTensor::Tensor1<double, 3> t_traction;
4179 t_traction(i) = t_approx_P(i, j) * t_normal(j) / t_normal.l2();
4180 // vectors
4181 t_traction(i) *= tagSense;
4182 CHKERR save_vec_tag(th_traction, t_traction, gg);
4183
4184 double u_error = sqrt((t_disp(i) - t_w(i)) * (t_disp(i) - t_w(i)));
4185 if (!std::isfinite(u_error))
4186 u_error = -1.;
4187 CHKERR save_scal_tag(th_disp_error, u_error, gg);
4188 CHKERR save_scal_tag(th_energy, t_energy, gg);
4189 if (t_youngs_modulus)
4190 CHKERR save_scal_tag(th_young_modulus, *t_youngs_modulus, gg);
4191
4192 const double jac = determinantTensor3by3(t_h);
4194 t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
4195 CHKERR save_mat_tag(th_cauchy_streess, t_cauchy, gg);
4196 CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
4197
4198 next();
4199 }
4200
4202}
constexpr double a
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
const double v
phase velocity of light in medium (cm/ns)
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
VectorBoundedArray< double, 3 > VectorDouble3
Definition Types.hpp:92
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
FTensor::Index< 'm', 3 > m

Member Data Documentation

◆ dataAtPts

boost::shared_ptr<DataAtIntegrationPts> OpPostProcDataStructure::dataAtPts

Definition at line 971 of file EshelbianOperators.hpp.

◆ mapGaussPts

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

Definition at line 970 of file EshelbianOperators.hpp.

◆ postProcMesh

moab::Interface& OpPostProcDataStructure::postProcMesh

Definition at line 969 of file EshelbianOperators.hpp.

◆ tagSense

int OpPostProcDataStructure::tagSense
private

Definition at line 983 of file EshelbianOperators.hpp.


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