v0.15.4
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< DataAtIntegrationPtsdataAtPts
 

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 879 of file EshelbianOperators.hpp.

Member Typedef Documentation

◆ OP

using OpPostProcDataStructure::OP = VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator

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

893 mapGaussPts(map_gauss_pts), dataAtPts(data_ptr), tagSense(sense) {}
@ NOSPACE
Definition definitions.h:83
@ OPSPACE
operator do Work is execute on space data
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
mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianOperators.cpp.

Definition at line 3065 of file EshelbianOperators.cpp.

3066 {
3068
3069 if (tagSense != getSkeletonSense())
3071
3072 auto get_tag = [&](auto name) {
3073 auto &mob = getPtrFE()->mField.get_moab();
3074 Tag tag;
3075 CHK_MOAB_THROW(mob.tag_get_handle(name, tag), "get tag");
3076 return tag;
3077 };
3078
3079 auto get_tag_value = [&](auto &&tag, int dim) {
3080 auto &mob = getPtrFE()->mField.get_moab();
3081 auto face = getSidePtrFE()->getFEEntityHandle();
3082 std::vector<double> value(dim);
3083 CHK_MOAB_THROW(mob.tag_get_data(tag, &face, 1, value.data()), "set tag");
3084 return value;
3085 };
3086
3087 auto create_tag = [this](const std::string tag_name, const int size) {
3088 double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
3089 Tag th;
3090 CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
3091 th, MB_TAG_CREAT | MB_TAG_SPARSE,
3092 def_VAL);
3093 return th;
3094 };
3095
3096 Tag th_cauchy_streess = create_tag("CauchyStress", 9);
3097 Tag th_detF = create_tag("detF", 1);
3098 Tag th_traction = create_tag("traction", 3);
3099 Tag th_disp_error = create_tag("DisplacementError", 1);
3100
3101 Tag th_energy = create_tag("Energy", 1);
3102
3103 auto t_w = getFTensor1FromMat<3>(dataAtPts->wL2AtPts);
3104 auto t_h = getFTensor2FromMat<3, 3>(dataAtPts->hAtPts);
3105 auto t_approx_P = getFTensor2FromMat<3, 3>(dataAtPts->approxPAtPts);
3106
3107 auto t_normal = getFTensor1NormalsAtGaussPts();
3108 auto t_disp = getFTensor1FromMat<3>(dataAtPts->wH1AtPts);
3109
3110 // auto sense = getSkeletonSense();
3111
3112 auto next = [&]() {
3113 ++t_w;
3114 ++t_h;
3115 ++t_approx_P;
3116 ++t_normal;
3117 ++t_disp;
3118 };
3119
3120 if (dataAtPts->energyAtPts.size() == 0) {
3121 // that is for case that energy is not calculated
3122 dataAtPts->energyAtPts.resize(getGaussPts().size2());
3123 dataAtPts->energyAtPts.clear();
3124 }
3125 auto t_energy = getFTensor0FromVec(dataAtPts->energyAtPts);
3126
3127 FTensor::Index<'i', 3> i;
3128 FTensor::Index<'j', 3> j;
3129 FTensor::Index<'k', 3> k;
3130 FTensor::Index<'l', 3> l;
3131
3132 auto set_float_precision = [](const double x) {
3133 if (std::abs(x) < std::numeric_limits<float>::epsilon())
3134 return 0.;
3135 else
3136 return x;
3137 };
3138
3139 // scalars
3140 auto save_scal_tag = [&](auto &th, auto v, const int gg) {
3142 v = set_float_precision(v);
3143 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, &v);
3145 };
3146
3147 // vectors
3148 VectorDouble3 v(3);
3149 FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
3150 auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
3152 t_v(i) = t_d(i);
3153 for (auto &a : v.data())
3154 a = set_float_precision(a);
3155 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
3156 &*v.data().begin());
3158 };
3159
3160 // tensors
3161
3162 MatrixDouble3by3 m(3, 3);
3164 &m(0, 0), &m(0, 1), &m(0, 2),
3165
3166 &m(1, 0), &m(1, 1), &m(1, 2),
3167
3168 &m(2, 0), &m(2, 1), &m(2, 2));
3169
3170 auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
3172 t_m(i, j) = t_d(i, j);
3173 for (auto &v : m.data())
3174 v = set_float_precision(v);
3175 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
3176 &*m.data().begin());
3178 };
3179
3180 const auto nb_gauss_pts = getGaussPts().size2();
3181 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
3182
3183 FTensor::Tensor1<double, 3> t_traction;
3184 t_traction(i) = t_approx_P(i, j) * t_normal(j) / t_normal.l2();
3185 // vectors
3186 t_traction(i) *= tagSense;
3187 CHKERR save_vec_tag(th_traction, t_traction, gg);
3188
3189 double u_error = sqrt((t_disp(i) - t_w(i)) * (t_disp(i) - t_w(i)));
3190 CHKERR save_scal_tag(th_disp_error, u_error, gg);
3191 CHKERR save_scal_tag(th_energy, t_energy, gg);
3192
3193 const double jac = determinantTensor3by3(t_h);
3195 t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
3196 CHKERR save_mat_tag(th_cauchy_streess, t_cauchy, gg);
3197 CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
3198
3199 next();
3200 }
3201
3203}
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 ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
#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(ublas::vector< T, A > &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 886 of file EshelbianOperators.hpp.

◆ mapGaussPts

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

Definition at line 885 of file EshelbianOperators.hpp.

◆ postProcMesh

moab::Interface& OpPostProcDataStructure::postProcMesh

Definition at line 884 of file EshelbianOperators.hpp.

◆ tagSense

int OpPostProcDataStructure::tagSense
private

Definition at line 898 of file EshelbianOperators.hpp.


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