1712 auto create_tag = [
this](
const std::string tag_name,
const int size) {
1713 double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
1716 th, MB_TAG_CREAT | MB_TAG_SPARSE,
1721 Tag th_w = create_tag(
"SpatialDisplacement", 3);
1722 Tag th_omega = create_tag(
"Omega", 3);
1723 Tag th_approxP = create_tag(
"Piola1Stress", 9);
1724 Tag th_calcSigma = create_tag(
"EshelbyStress", 9);
1725 Tag th_sigma = create_tag(
"CauchyStress", 9);
1726 Tag th_log_u = create_tag(
"LogSpatialStretch", 9);
1727 Tag th_u = create_tag(
"SpatialStretch", 9);
1728 Tag th_h = create_tag(
"h", 9);
1729 Tag th_X = create_tag(
"X", 3);
1730 Tag th_detF = create_tag(
"detF", 1);
1731 Tag th_angular_momentum = create_tag(
"AngularMomentum", 3);
1735 Tag th_traction = create_tag(
"traction", 3);
1737 Tag th_disp = create_tag(
"H1Displacement", 3);
1738 Tag th_disp_error = create_tag(
"DisplacementError", 1);
1739 Tag th_lambda_disp = create_tag(
"ContactDisplacement", 3);
1741 Tag th_energy = create_tag(
"Energy", 1);
1743 auto t_w = getFTensor1FromMat<3>(
dataAtPts->wL2AtPts);
1744 auto t_omega = getFTensor1FromMat<3>(
dataAtPts->rotAxisAtPts);
1745 auto t_h = getFTensor2FromMat<3, 3>(
dataAtPts->hAtPts);
1747 getFTensor2SymmetricFromMat<3>(
dataAtPts->logStretchTensorAtPts);
1748 auto t_u = getFTensor2SymmetricFromMat<3>(
dataAtPts->stretchTensorAtPts);
1749 auto t_R = getFTensor2FromMat<3, 3>(
dataAtPts->rotMatAtPts);
1750 auto t_approx_P = getFTensor2FromMat<3, 3>(
dataAtPts->approxPAtPts);
1754 dataAtPts->approxPAtPts.size2(),
false);
1758 auto t_calcSigma_P = getFTensor2FromMat<3, 3>(
dataAtPts->SigmaAtPts);
1759 auto t_levi_kirchoff = getFTensor1FromMat<3>(
dataAtPts->leviKirchhoffAtPts);
1760 auto t_coords = getFTensor1FromMat<3>(
dataAtPts->XH1AtPts);
1761 auto t_normal = getFTensor1NormalsAtGaussPts();
1762 auto t_disp = getFTensor1FromMat<3>(
dataAtPts->wH1AtPts);
1763 auto t_lambda_disp = getFTensor1FromMat<3>(
dataAtPts->contactL2AtPts);
1765 if (
dataAtPts->energyAtPts.size() == 0) {
1767 dataAtPts->energyAtPts.resize(getGaussPts().size2());
1777 auto set_float_precision = [](
const double x) {
1778 if (std::abs(x) < std::numeric_limits<float>::epsilon())
1785 auto save_scal_tag = [&](
auto &
th,
auto v,
const int gg) {
1787 v = set_float_precision(
v);
1795 auto save_vec_tag = [&](
auto &
th,
auto &t_d,
const int gg) {
1798 for (
auto &
a :
v.data())
1799 a = set_float_precision(
a);
1801 &*
v.data().begin());
1809 &
m(0, 0), &
m(0, 1), &
m(0, 2),
1811 &
m(1, 0), &
m(1, 1), &
m(1, 2),
1813 &
m(2, 0), &
m(2, 1), &
m(2, 2));
1815 auto save_mat_tag = [&](
auto &
th,
auto &t_d,
const int gg) {
1817 t_m(
i,
j) = t_d(
i,
j);
1818 for (
auto &
v :
m.data())
1819 v = set_float_precision(
v);
1821 &*
m.data().begin());
1825 const auto nb_gauss_pts = getGaussPts().size2();
1826 for (
auto gg = 0; gg != nb_gauss_pts; ++gg) {
1829 t_traction(
i) = t_approx_P(
i,
j) * t_normal(
j) / t_normal.
l2();
1832 CHKERR save_vec_tag(th_w, t_w, gg);
1833 CHKERR save_vec_tag(th_X, t_coords, gg);
1834 CHKERR save_vec_tag(th_omega, t_omega, gg);
1835 CHKERR save_vec_tag(th_traction, t_traction, gg);
1838 CHKERR save_mat_tag(th_h, t_h, gg);
1841 for (
int ii = 0; ii != 3; ++ii)
1842 for (
int jj = 0; jj != 3; ++jj)
1843 t_log_u_tmp(ii, jj) = t_log_u(ii, jj);
1845 CHKERR save_mat_tag(th_log_u, t_log_u_tmp, gg);
1848 for (
int ii = 0; ii != 3; ++ii)
1849 for (
int jj = 0; jj != 3; ++jj)
1850 t_u_tmp(ii, jj) = t_u(ii, jj);
1852 CHKERR save_mat_tag(th_u, t_u_tmp, gg);
1853 CHKERR save_mat_tag(th_approxP, t_approx_P, gg);
1854 CHKERR save_mat_tag(th_calcSigma, t_calcSigma_P, gg);
1855 CHKERR save_vec_tag(th_disp, t_disp, gg);
1856 CHKERR save_vec_tag(th_lambda_disp, t_lambda_disp, gg);
1858 double u_error = sqrt((t_disp(
i) - t_w(
i)) * (t_disp(
i) - t_w(
i)));
1859 CHKERR save_scal_tag(th_disp_error, u_error, gg);
1860 CHKERR save_scal_tag(th_energy, t_energy, gg);
1864 t_cauchy(
i,
j) = (1. / jac) * (t_approx_P(
i,
k) * t_h(
j,
k));
1865 CHKERR save_mat_tag(th_sigma, t_cauchy, gg);
1869 t_levi(
k) = t_levi_kirchoff(
k);
1873 auto get_eiegn_vector_symmetric = [&](
auto &t_u) {
1893 CHKERR get_eiegn_vector_symmetric(t_u);