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};
4072 th, MB_TAG_CREAT | MB_TAG_SPARSE,
4073 def_VAL);
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
4094
4095 if (
dataAtPts->energyAtPts.size() == 0) {
4096
4097 dataAtPts->energyAtPts.resize(nb_gauss_pts);
4099 }
4102 t_youngs_modulus;
4103 if (
dataAtPts->physicsPtr->getFeatures().test(
4104 PhysicalEquations::NON_HOMOGENEOUS_MATERIAL)) {
4105 if (
dataAtPts->youngModulusAtPts.size() != nb_gauss_pts)
4107 "Young's modulus postprocessing requires current material data");
4108 t_youngs_modulus.emplace(
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
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
4136 auto save_scal_tag = [&](
auto &
th,
auto v,
const int gg) {
4138 v = set_float_precision(
v);
4141 };
4142
4143
4146 auto save_vec_tag = [&](
auto &
th,
auto &t_d,
const int gg) {
4149 for (
auto &
a :
v.data())
4150 a = set_float_precision(
a);
4152 &*
v.data().begin());
4154 };
4155
4156
4157
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);
4172 &*
m.data().begin());
4174 };
4175
4176 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
4177
4179 t_traction(
i) = t_approx_P(
i,
j) * t_normal(
j) / t_normal.
l2();
4180
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
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);
4197
4198 next();
4199 }
4200
4202}
#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
#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
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