2186 if (
tagSense != getSkeletonSense())
2189 auto get_tag = [&](
auto name) {
2190 auto &mob = getPtrFE()->mField.get_moab();
2196 auto get_tag_value = [&](
auto &&tag,
int dim) {
2197 auto &mob = getPtrFE()->mField.get_moab();
2198 auto face = getSidePtrFE()->getFEEntityHandle();
2199 std::vector<double> value(dim);
2200 CHK_MOAB_THROW(mob.tag_get_data(tag, &face, 1, value.data()),
"set tag");
2204 auto create_tag = [
this](
const std::string tag_name,
const int size) {
2205 double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
2208 th, MB_TAG_CREAT | MB_TAG_SPARSE,
2213 Tag th_cauchy_streess = create_tag(
"CauchyStress", 9);
2214 Tag th_detF = create_tag(
"detF", 1);
2215 Tag th_traction = create_tag(
"traction", 3);
2216 Tag th_disp_error = create_tag(
"DisplacementError", 1);
2218 Tag th_energy = create_tag(
"Energy", 1);
2220 auto t_w = getFTensor1FromMat<3>(
dataAtPts->wL2AtPts);
2221 auto t_h = getFTensor2FromMat<3, 3>(
dataAtPts->hAtPts);
2222 auto t_approx_P = getFTensor2FromMat<3, 3>(
dataAtPts->approxPAtPts);
2224 auto t_normal = getFTensor1NormalsAtGaussPts();
2225 auto t_disp = getFTensor1FromMat<3>(
dataAtPts->wH1AtPts);
2235 if (
dataAtPts->energyAtPts.size() == 0) {
2237 dataAtPts->energyAtPts.resize(getGaussPts().size2());
2247 auto set_float_precision = [](
const double x) {
2248 if (std::abs(x) < std::numeric_limits<float>::epsilon())
2255 auto save_scal_tag = [&](
auto &
th,
auto v,
const int gg) {
2257 v = set_float_precision(
v);
2265 auto save_vec_tag = [&](
auto &
th,
auto &t_d,
const int gg) {
2268 for (
auto &
a :
v.data())
2269 a = set_float_precision(
a);
2271 &*
v.data().begin());
2279 &
m(0, 0), &
m(0, 1), &
m(0, 2),
2281 &
m(1, 0), &
m(1, 1), &
m(1, 2),
2283 &
m(2, 0), &
m(2, 1), &
m(2, 2));
2285 auto save_mat_tag = [&](
auto &
th,
auto &t_d,
const int gg) {
2287 t_m(
i,
j) = t_d(
i,
j);
2288 for (
auto &
v :
m.data())
2289 v = set_float_precision(
v);
2291 &*
m.data().begin());
2295 const auto nb_gauss_pts = getGaussPts().size2();
2296 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
2299 t_traction(
i) = t_approx_P(
i,
j) * t_normal(
j) / t_normal.
l2();
2301 CHKERR save_vec_tag(th_traction, t_traction, gg);
2303 double u_error = sqrt((t_disp(
i) - t_w(
i)) * (t_disp(
i) - t_w(
i)));
2304 CHKERR save_scal_tag(th_disp_error, u_error, gg);
2305 CHKERR save_scal_tag(th_energy, t_energy, gg);
2309 t_cauchy(
i,
j) = (1. / jac) * (t_approx_P(
i,
k) * t_h(
j,
k));
2310 CHKERR save_mat_tag(th_cauchy_streess, t_cauchy, gg);