v0.15.5
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 883 of file EshelbianOperators.hpp.

Member Typedef Documentation

◆ OP

using OpPostProcDataStructure::OP = VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator

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

896 : OP(NOSPACE, UserDataOperator::OPSPACE), postProcMesh(post_proc_mesh),
897 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
mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianOperators.cpp.

Definition at line 3073 of file EshelbianOperators.cpp.

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

◆ mapGaussPts

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

Definition at line 889 of file EshelbianOperators.hpp.

◆ postProcMesh

moab::Interface& OpPostProcDataStructure::postProcMesh

Definition at line 888 of file EshelbianOperators.hpp.

◆ tagSense

int OpPostProcDataStructure::tagSense
private

Definition at line 902 of file EshelbianOperators.hpp.


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