v0.16.0
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 896 of file EshelbianOperators.hpp.

Member Typedef Documentation

◆ OP

using OpPostProcDataStructure::OP = VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator

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

909 : OP(NOSPACE, UserDataOperator::OPSPACE), postProcMesh(post_proc_mesh),
910 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 3360 of file EshelbianOperators.cpp.

3361 {
3363
3364 if (tagSense != getSkeletonSense())
3366
3367 auto get_tag = [&](auto name) {
3368 auto &mob = getPtrFE()->mField.get_moab();
3369 Tag tag;
3370 CHK_MOAB_THROW(mob.tag_get_handle(name, tag), "get tag");
3371 return tag;
3372 };
3373
3374 auto get_tag_value = [&](auto &&tag, int dim) {
3375 auto &mob = getPtrFE()->mField.get_moab();
3376 auto face = getSidePtrFE()->getFEEntityHandle();
3377 std::vector<double> value(dim);
3378 CHK_MOAB_THROW(mob.tag_get_data(tag, &face, 1, value.data()), "set tag");
3379 return value;
3380 };
3381
3382 auto create_tag = [this](const std::string tag_name, const int size) {
3383 double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
3384 Tag th;
3385 CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
3386 th, MB_TAG_CREAT | MB_TAG_SPARSE,
3387 def_VAL);
3388 return th;
3389 };
3390
3391 Tag th_cauchy_streess = create_tag("CauchyStress", 9);
3392 Tag th_detF = create_tag("detF", 1);
3393 Tag th_traction = create_tag("traction", 3);
3394 Tag th_disp_error = create_tag("DisplacementError", 1);
3395
3396 Tag th_energy = create_tag("Energy", 1);
3397 Tag th_young_modulus = create_tag("YoungModulus", 1);
3398
3399 const auto nb_gauss_pts = getGaussPts().size2();
3400 auto t_w = dataAtPts->getFTensorSmallWL2(nb_gauss_pts);
3401 auto t_h = dataAtPts->getFTensorSmallH(nb_gauss_pts);
3402 auto t_approx_P = dataAtPts->getFTensorApproxP(nb_gauss_pts);
3403
3404 auto t_normal = getFTensor1NormalsAtGaussPts();
3405 auto t_disp = dataAtPts->getFTensorSmallWH1(nb_gauss_pts);
3406
3407 // auto sense = getSkeletonSense();
3408
3409 if (dataAtPts->energyAtPts.size() == 0) {
3410 // that is for case that energy is not calculated
3411 dataAtPts->energyAtPts.resize(nb_gauss_pts);
3412 dataAtPts->energyAtPts.clear();
3413 }
3414 auto t_energy = getFTensor0FromVec(dataAtPts->energyAtPts);
3415 auto t_youngs_modulus = getFTensor0FromVec(dataAtPts->youngModulusAtPts);
3416
3417 auto next = [&]() {
3418 ++t_w;
3419 ++t_h;
3420 ++t_approx_P;
3421 ++t_normal;
3422 ++t_disp;
3423 ++t_youngs_modulus;
3424 ++t_energy;
3425 };
3426
3427 FTensor::Index<'i', 3> i;
3428 FTensor::Index<'j', 3> j;
3429 FTensor::Index<'k', 3> k;
3430 FTensor::Index<'l', 3> l;
3431
3432 auto set_float_precision = [](const double x) {
3433 if (std::abs(x) < std::numeric_limits<float>::epsilon())
3434 return 0.;
3435 else
3436 return x;
3437 };
3438
3439 // scalars
3440 auto save_scal_tag = [&](auto &th, auto v, const int gg) {
3442 v = set_float_precision(v);
3443 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, &v);
3445 };
3446
3447 // vectors
3448 VectorDouble3 v(3);
3449 FTensor::Tensor1<FTensor::PackPtr<double *, 0>, 3> t_v(&v[0], &v[1], &v[2]);
3450 auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
3452 t_v(i) = t_d(i);
3453 for (auto &a : v.data())
3454 a = set_float_precision(a);
3455 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
3456 &*v.data().begin());
3458 };
3459
3460 // tensors
3461
3462 MatrixDouble3by3 m(3, 3);
3464 &m(0, 0), &m(0, 1), &m(0, 2),
3465
3466 &m(1, 0), &m(1, 1), &m(1, 2),
3467
3468 &m(2, 0), &m(2, 1), &m(2, 2));
3469
3470 auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
3472 t_m(i, j) = t_d(i, j);
3473 for (auto &v : m.data())
3474 v = set_float_precision(v);
3475 CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
3476 &*m.data().begin());
3478 };
3479
3480 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
3481
3482 FTensor::Tensor1<double, 3> t_traction;
3483 t_traction(i) = t_approx_P(i, j) * t_normal(j) / t_normal.l2();
3484 // vectors
3485 t_traction(i) *= tagSense;
3486 CHKERR save_vec_tag(th_traction, t_traction, gg);
3487
3488 double u_error = sqrt((t_disp(i) - t_w(i)) * (t_disp(i) - t_w(i)));
3489 if (!std::isfinite(u_error))
3490 u_error = -1.;
3491 CHKERR save_scal_tag(th_disp_error, u_error, gg);
3492 CHKERR save_scal_tag(th_energy, t_energy, gg);
3494 CHKERR save_scal_tag(th_young_modulus, t_youngs_modulus, gg);
3495
3496 const double jac = determinantTensor3by3(t_h);
3498 t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
3499 CHKERR save_mat_tag(th_cauchy_streess, t_cauchy, gg);
3500 CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
3501
3502 next();
3503 }
3504
3506}
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(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
static bool hasNonHomogeneousMaterialBlock

Member Data Documentation

◆ dataAtPts

boost::shared_ptr<DataAtIntegrationPts> OpPostProcDataStructure::dataAtPts

Definition at line 903 of file EshelbianOperators.hpp.

◆ mapGaussPts

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

Definition at line 902 of file EshelbianOperators.hpp.

◆ postProcMesh

moab::Interface& OpPostProcDataStructure::postProcMesh

Definition at line 901 of file EshelbianOperators.hpp.

◆ tagSense

int OpPostProcDataStructure::tagSense
private

Definition at line 915 of file EshelbianOperators.hpp.


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