v0.16.0
Loading...
Searching...
No Matches
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianOperators.cpp

Implementation of operators.

Implementation of operators mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianOperators.cpp

/**
* \file EshelbianOperators.cpp
* \example
* mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianOperators.cpp
*
* \brief Implementation of operators
*/
#include <MoFEM.hpp>
using namespace MoFEM;
#include <boost/math/constants/constants.hpp>
#include <EshelbianAux.hpp>
#include <lapack_wrap.h>
#include <Lie.hpp>
EntData &data) {
int nb_integration_pts = getGaussPts().size2();
auto t_P = dataAtPts->getFTensorApproxP(getGaussPts().size2());
auto t_F = dataAtPts->getFTensorSmallH(getGaussPts().size2());
auto t_energy = getFTensor0FromVec(dataAtPts->energyAtPts);
auto get_eshelby_stress =
DL>::size(dataAtPts->SigmaAtPts, nb_integration_pts);
auto t_eshelby_stress = get_eshelby_stress();
for (auto gg = 0; gg != nb_integration_pts; ++gg) {
t_eshelby_stress(i, j) = t_energy * t_kd(i, j) - t_F(m, i) * t_P(m, j);
++t_energy;
++t_P;
++t_F;
++t_eshelby_stress;
}
}
EntityType type,
EntData &data) {
auto ts_ctx = getTSCtx();
int nb_integration_pts = getGaussPts().size2();
// space size indices
// sym size indices
auto t_L = symm_L_tensor();
*dataAtPts->getStretchTensorAtPts(), nb_integration_pts);
*dataAtPts->getDiffStretchTensorAtPts(), nb_integration_pts);
*dataAtPts->getStretchH1AtPts(), nb_integration_pts);
MatrixSizeHelper<GetFTensor4FromMatType<3, 3, 3, 3, -1, DL>, DL>::size(
*dataAtPts->getDiffStretchH1AtPts(), nb_integration_pts);
*dataAtPts->getAdjointPdstretchAtPts(), nb_integration_pts);
*dataAtPts->getAdjointPdUAtPts(), nb_integration_pts);
*dataAtPts->getAdjointPdUdPAtPts(), nb_integration_pts);
*dataAtPts->getAdjointPdUdOmegaAtPts(), nb_integration_pts);
*dataAtPts->getDeformationGradient(), nb_integration_pts);
dataAtPts->hdOmegaAtPts, nb_integration_pts);
dataAtPts->hdLogStretchAtPts, nb_integration_pts);
dataAtPts->leviKirchhoffAtPts, nb_integration_pts);
dataAtPts->leviKirchhoffdOmegaAtPts, nb_integration_pts);
dataAtPts->leviKirchhoffdLogStreatchAtPts, nb_integration_pts);
dataAtPts->leviKirchhoffPAtPts, nb_integration_pts);
dataAtPts->rotMatAtPts, nb_integration_pts);
*dataAtPts->getEigenVals(), nb_integration_pts);
*dataAtPts->getEigenVecs(), nb_integration_pts);
dataAtPts->nbUniq.resize(nb_integration_pts, false);
dataAtPts->eigenValsC, nb_integration_pts);
dataAtPts->eigenVecsC, nb_integration_pts);
dataAtPts->nbUniqC.resize(nb_integration_pts, false);
dataAtPts->logStretch2H1AtPts, nb_integration_pts);
dataAtPts->logStretchTotalTensorAtPts, nb_integration_pts);
dataAtPts->internalStressAtPts, nb_integration_pts);
dataAtPts->internalStressAtPts.clear();
// Calculated values
auto t_h = dataAtPts->getFTensorSmallH(getGaussPts().size2());
auto t_h_domega = dataAtPts->getFTensorSmallHdOmega(getGaussPts().size2());
auto t_h_dlog_u =
dataAtPts->getFTensorSmallHdLogStretch(getGaussPts().size2());
auto t_levi_kirchhoff =
dataAtPts->getFTensorLeviKirchhoff(getGaussPts().size2());
auto t_levi_kirchhoff_domega =
dataAtPts->getFTensorLeviKirchhoffdOmega(getGaussPts().size2());
auto t_levi_kirchhoff_dstreach =
dataAtPts->getFTensorLeviKirchhoffdLogStretch(getGaussPts().size2());
auto t_levi_kirchhoff_dP =
dataAtPts->getFTensorLeviKirchhoffP(getGaussPts().size2());
auto t_approx_P_adjoint_dstretch =
dataAtPts->getFTensorAdjointPdstretch(getGaussPts().size2());
auto t_approx_P_adjoint_log_du =
dataAtPts->getFTensorAdjointPdU(getGaussPts().size2());
auto t_approx_P_adjoint_log_du_dP =
dataAtPts->getFTensorAdjointPdUdP(getGaussPts().size2());
auto t_approx_P_adjoint_log_du_domega =
dataAtPts->getFTensorAdjointPdUdOmega(getGaussPts().size2());
auto t_R = dataAtPts->getFTensorRotMat(getGaussPts().size2());
auto t_u = dataAtPts->getFTensorStretch(getGaussPts().size2());
auto t_diff_u = dataAtPts->getFTensorDiffStretch(getGaussPts().size2());
auto t_eigen_vals = dataAtPts->getFTensorEigenVals(getGaussPts().size2());
auto t_eigen_vecs = dataAtPts->getFTensorEigenVecs(getGaussPts().size2());
auto &nbUniq = dataAtPts->nbUniq;
auto t_nb_uniq =
auto t_eigen_vals_C = dataAtPts->getFTensorEigenValsC(nb_integration_pts);
auto t_eigen_vecs_C = dataAtPts->getFTensorEigenVecsC(nb_integration_pts);
auto &nbUniqC = dataAtPts->nbUniqC;
auto t_nb_uniq_C =
auto t_u_h1 = dataAtPts->getFTensorStretchH1(getGaussPts().size2());
auto t_diff_u_h1 = dataAtPts->getFTensorDiffStretchH1(getGaussPts().size2());
auto t_log_stretch_total =
dataAtPts->getFTensorLogStretchTotal(getGaussPts().size2());
auto t_log_u2_h1 = dataAtPts->getFTensorLogStretch2H1(getGaussPts().size2());
// Field values
auto t_grad_h1 = dataAtPts->getFTensorSmallWGradH1(getGaussPts().size2());
auto t_omega = dataAtPts->getFTensorRotAxis(getGaussPts().size2());
auto t_approx_P = dataAtPts->getFTensorApproxP(getGaussPts().size2());
auto t_log_u = dataAtPts->getFTensorLogStretch(getGaussPts().size2());
// Rot axis 0
auto t_omega0 = dataAtPts->getFTensorRotAxis0(getGaussPts().size2());
auto next = [&]() {
// calculated values
++t_h;
++t_h_domega;
++t_h_dlog_u;
++t_levi_kirchhoff;
++t_levi_kirchhoff_domega;
++t_levi_kirchhoff_dstreach;
++t_levi_kirchhoff_dP;
++t_approx_P_adjoint_dstretch;
++t_approx_P_adjoint_log_du;
++t_approx_P_adjoint_log_du_dP;
++t_approx_P_adjoint_log_du_domega;
++t_R;
++t_u;
++t_diff_u;
++t_eigen_vals;
++t_eigen_vecs;
++t_nb_uniq;
++t_eigen_vals_C;
++t_eigen_vecs_C;
++t_nb_uniq_C;
++t_u_h1;
++t_diff_u_h1;
++t_log_u2_h1;
++t_log_stretch_total;
// field values
++t_omega;
++t_omega0;
++t_grad_h1;
++t_approx_P;
++t_log_u;
};
auto bound_eig = [&](auto &eig) {
const auto zero = std::exp(std::numeric_limits<double>::min_exponent);
const auto large = std::exp(std::numeric_limits<double>::max_exponent);
for (int ii = 0; ii != 3; ++ii) {
eig(ii) = std::min(std::max(zero, eig(ii)), large);
}
};
auto calculate_log_stretch = [&]() {
eigen_vec(i, j) = t_log_u(i, j);
if (computeEigenValuesSymmetric(eigen_vec, eig) != MB_SUCCESS) {
MOFEM_LOG("SELF", Sev::error) << "Failed to compute eigen values";
}
// CHKERR bound_eig(eig);
// rare case when two eigen values are equal
t_nb_uniq = get_uniq_nb<3>(&eig(0));
if (t_nb_uniq < 3) {
sort_eigen_vals(eig, eigen_vec);
}
t_eigen_vals(i) = eig(i);
t_eigen_vecs(i, j) = eigen_vec(i, j);
t_u(i, j) =
EigenMatrix::getMat(t_eigen_vals, t_eigen_vecs, EshelbianCore::f)(i, j);
auto get_t_diff_u = [&]() {
return EigenMatrix::getDiffMat(t_eigen_vals, t_eigen_vecs,
t_nb_uniq);
};
t_diff_u(i, j, k, l) = get_t_diff_u()(i, j, k, l);
t_Ldiff_u(i, j, L) = t_diff_u(i, j, m, n) * t_L(m, n, L);
// return t_Ldiff_u;
};
auto calculate_total_stretch = [&](auto &t_h1) {
t_log_u2_h1(i, j) = 0;
t_log_stretch_total(i, j) = t_log_u(i, j);
} else {
t_C_h1(i, j) = t_h1(k, i) * t_h1(k, j);
t_eigen_vec(i, j) = t_C_h1(i, j);
if (computeEigenValuesSymmetric(t_eigen_vec, t_eig) != MB_SUCCESS) {
MOFEM_LOG("SELF", Sev::error) << "Failed to compute eigen values";
}
// rare case when two eigen values are equal
t_nb_uniq_C = get_uniq_nb<3>(&t_eig(0));
if (t_nb_uniq_C < 3) {
sort_eigen_vals(t_eig, t_eigen_vec);
}
CHKERR bound_eig(t_eig);
}
t_eigen_vals_C(i) = t_eig(i);
t_eigen_vecs_C(i, j) = t_eigen_vec(i, j);
t_log_u2_h1(i, j) =
EigenMatrix::getMat(t_eig, t_eigen_vec, EshelbianCore::inv_f)(i, j);
t_log_stretch_total(i, j) = t_log_u2_h1(i, j) / 2 + t_log_u(i, j);
}
};
auto no_h1_loop = [&]() {
case LARGE_ROT:
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"no_h1_loop is implemented only for LARGE_ROT");
};
for (int gg = 0; gg != nb_integration_pts; ++gg) {
t_h1(i, j) = t_kd(i, j);
// calculate streach
CHKERR calculate_log_stretch();
// calculate total stretch
CHKERR calculate_total_stretch(t_h1);
t_u_h1(i, j) = t_u(i, j);
t_diff_u_h1(i, j, k, l) = t_diff_u(i, j, k, l);
t_Ldiff_u(i, j, L) = t_diff_u(i, j, m, n) * t_L(m, n, L);
auto large_rot = [&]() {
t_R(i, j) = LieGroups::SO3::exp(t_omega, t_omega.l2())(i, j);
t_diff_R(i, j, k) =
LieGroups::SO3::diffExp(t_omega, t_omega.l2())(i, j, k);
t_diff_diff_R(i, j, k, l) =
LieGroups::SO3::diffDiffExp(t_omega, t_omega.l2())(i, j, k, l);
t_h(i, k) = t_R(i, l) * t_u(l, k);
t_approx_P_adjoint_dstretch(l, k) = t_R(i, l) * t_approx_P(i, k);
t_approx_P_adjoint_log_du(L) =
t_approx_P_adjoint_dstretch(l, k) * t_Ldiff_u(l, k, L);
t_levi_kirchhoff(m) =
t_diff_R(i, l, m) * (t_u(l, k) * t_approx_P(i, k));
if (ts_ctx == TSMethod::CTX_TSSETIJACOBIAN) {
t_h_domega(i, k, m) = t_diff_R(i, l, m) * t_u(l, k);
t_h_dlog_u(i, k, L) = t_R(i, l) * t_Ldiff_u(l, k, L);
t_approx_P_adjoint_log_du_dP(i, k, L) =
t_R(i, l) * t_Ldiff_u(l, k, L);
t_A(k, l, m) = t_diff_R(i, l, m) * t_approx_P(i, k);
t_approx_P_adjoint_log_du_domega(m, L) =
t_A(k, l, m) * t_Ldiff_u(k, l, L);
t_levi_kirchhoff_dstreach(m, L) =
t_diff_R(i, l, m) * (t_Ldiff_u(l, k, L) * t_approx_P(i, k));
t_levi_kirchhoff_dP(m, i, k) = t_diff_R(i, l, m) * t_u(l, k);
t_levi_kirchhoff_domega(m, n) =
t_diff_diff_R(i, l, m, n) * (t_u(l, k) * t_approx_P(i, k));
}
};
auto moderate_rot = [&]() {
t_delta_omega(m) = t_omega(m) - t_omega0(m);
t_R0(i, j) = LieGroups::SO3::exp(t_omega0, t_omega0.l2())(i, j);
// Store the base rotation and add only the linearised increment to F.
t_R(i, j) = t_R0(i, j);
t_h(i, k) =
t_R0(i, l) *
(t_u(l, k) + levi_civita(l, k, m) * t_delta_omega(m));
t_approx_P_adjoint_dstretch(l, k) = t_R0(i, l) * t_approx_P(i, k);
t_approx_P_adjoint_log_du(L) =
t_approx_P_adjoint_dstretch(l, k) * t_Ldiff_u(l, k, L);
t_levi_kirchhoff(m) = t_R0(i, l) * levi_civita(l, k, m) *
t_approx_P(i, k);
if (ts_ctx == TSMethod::CTX_TSSETIJACOBIAN) {
t_h_domega(i, k, m) = t_R0(i, l) * levi_civita(l, k, m);
t_h_dlog_u(i, k, L) = t_R0(i, l) * t_Ldiff_u(l, k, L);
t_approx_P_adjoint_log_du_dP(i, k, L) =
t_R0(i, l) * t_Ldiff_u(l, k, L);
t_approx_P_adjoint_log_du_domega(m, L) = 0;
t_levi_kirchhoff_dstreach(m, L) = 0;
t_levi_kirchhoff_dP(m, i, k) =
t_R0(i, l) * levi_civita(l, k, m);
t_levi_kirchhoff_domega(m, n) = 0;
}
};
// rotation
case LARGE_ROT:
large_rot();
break;
moderate_rot();
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"rotationSelector not handled");
}
next();
}
};
auto large_loop = [&]() {
case LARGE_ROT:
break;
case SMALL_ROT:
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"rotSelector should be large or small");
};
for (int gg = 0; gg != nb_integration_pts; ++gg) {
case LARGE_ROT:
t_h1(i, j) = t_grad_h1(i, j) + t_kd(i, j);
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Selected grad approximator not handled");
};
// calculate streach
CHKERR calculate_log_stretch();
// calculate total stretch
CHKERR calculate_total_stretch(t_h1);
t_u_h1(l, k) = t_u(l, o) * t_h1(o, k);
t_diff_u_h1(i, j, k, l) = t_diff_u(i, o, k, l) * t_h1(o, j);
t_Ldiff_u_h1(l, k, L) = t_diff_u_h1(l, k, i, j) * t_L(i, j, L);
// rotation
case SMALL_ROT:
t_R(i, k) = t_kd(i, k) + levi_civita(i, k, l) * t_omega(l);
t_diff_R(i, j, k) = levi_civita(i, j, k);
t_diff_diff_R(i, j, l, m) = 0;
break;
case LARGE_ROT:
t_R(i, j) = LieGroups::SO3::exp(t_omega, t_omega.l2())(i, j);
t_diff_R(i, j, k) =
LieGroups::SO3::diffExp(t_omega, t_omega.l2())(i, j, k);
t_diff_diff_R(i, j, k, l) =
LieGroups::SO3::diffDiffExp(t_omega, t_omega.l2())(i, j, k, l);
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"rotationSelector not handled");
}
// calculate gradient
t_h(i, k) = t_R(i, l) * t_u_h1(l, k);
// Adjoint stress
t_approx_P_adjoint_dstretch(l, o) =
(t_R(i, l) * t_approx_P(i, k)) * t_h1(o, k);
t_approx_P_adjoint_log_du(L) =
t_R(i, l) * t_approx_P(i, k) * t_Ldiff_u_h1(l, k, L);
// Kirchhoff stress
t_levi_kirchhoff(m) = t_diff_R(i, l, m) * t_u_h1(l, k) * t_approx_P(i, k);
if (ts_ctx == TSMethod::CTX_TSSETIJACOBIAN) {
t_h_domega(i, k, m) = t_diff_R(i, l, m) * t_u_h1(l, k);
t_h_dlog_u(i, k, L) = t_R(i, l) * t_Ldiff_u_h1(l, k, L);
t_approx_P_adjoint_log_du_dP(i, k, L) =
t_R(i, l) * t_Ldiff_u_h1(l, k, L);
t_A(m, L, i, k) = t_diff_R(i, l, m) * t_Ldiff_u_h1(l, k, L);
t_approx_P_adjoint_log_du_domega(m, L) =
t_A(m, L, i, k) * t_approx_P(i, k);
t_levi_kirchhoff_dstreach(m, L) =
t_diff_R(i, l, m) * (t_Ldiff_u_h1(l, k, L) * t_approx_P(i, k));
t_levi_kirchhoff_dP(m, i, k) = t_diff_R(i, l, m) * t_u_h1(l, k);
t_levi_kirchhoff_domega(m, n) =
t_diff_diff_R(i, l, m, n) * (t_u_h1(l, k) * t_approx_P(i, k));
}
next();
}
};
auto moderate_loop = [&]() {
case LARGE_ROT:
break;
case SMALL_ROT:
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"rotSelector should be large or small");
};
for (int gg = 0; gg != nb_integration_pts; ++gg) {
t_h1(i, j) = t_grad_h1(i, j) + t_kd(i, j);
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Selected grad approximator not handled");
};
// calculate streach
CHKERR calculate_log_stretch();
// calculate total stretch
CHKERR calculate_total_stretch(t_h1);
auto t_diff = diff_tensor();
t_u_h1(l, k) = (t_kd(l, o) + t_log_u(l, o)) * t_h1(o, k);
t_diff_u_h1(i, j, k, l) = t_diff(i, o, k, l) * t_h1(o, j);
t_Ldiff_u_h1(l, k, L) = t_diff_u_h1(l, k, i, j) * t_L(i, j, L);
// rotation
case SMALL_ROT:
t_R(i, k) = t_kd(i, k) + levi_civita(i, k, l) * t_omega(l);
t_diff_R(i, j, k) = levi_civita(i, j, k);
t_diff_diff_R(i, j, l, m) = 0;
break;
case LARGE_ROT:
t_R(i, j) = LieGroups::SO3::exp(t_omega, t_omega.l2())(i, j);
t_diff_R(i, j, k) =
LieGroups::SO3::diffExp(t_omega, t_omega.l2())(i, j, k);
t_diff_diff_R(i, j, k, l) =
LieGroups::SO3::diffDiffExp(t_omega, t_omega.l2())(i, j, k, l);
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"rotationSelector not handled");
}
// calculate gradient
t_h(i, k) = t_R(i, l) * t_u_h1(l, k);
// Adjoint stress
t_approx_P_adjoint_dstretch(l, o) =
(t_R(i, l) * t_approx_P(i, k)) * t_h1(o, k);
t_approx_P_adjoint_log_du(L) =
t_R(i, l) * t_approx_P(i, k) * t_Ldiff_u_h1(l, k, L);
// Kirchhoff stress
t_levi_kirchhoff(m) = t_diff_R(i, l, m) * t_u_h1(l, k) * t_approx_P(i, k);
if (ts_ctx == TSMethod::CTX_TSSETIJACOBIAN) {
t_h_domega(i, k, m) = t_diff_R(i, l, m) * t_u_h1(l, k);
t_h_dlog_u(i, k, L) = t_R(i, l) * t_Ldiff_u_h1(l, k, L);
t_approx_P_adjoint_log_du_dP(i, k, L) =
t_R(i, l) * t_Ldiff_u_h1(l, k, L);
t_A(m, L, i, k) = t_diff_R(i, l, m) * t_Ldiff_u_h1(l, k, L);
t_approx_P_adjoint_log_du_domega(m, L) =
t_A(m, L, i, k) * t_approx_P(i, k);
t_levi_kirchhoff_dstreach(m, L) =
t_diff_R(i, l, m) * (t_Ldiff_u_h1(l, k, L) * t_approx_P(i, k));
t_levi_kirchhoff_dP(m, i, k) = t_diff_R(i, l, m) * t_u_h1(l, k);
t_levi_kirchhoff_domega(m, n) =
t_diff_diff_R(i, l, m, n) * (t_u_h1(l, k) * t_approx_P(i, k));
}
next();
}
};
auto small_loop = [&]() {
case SMALL_ROT:
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"rotSelector should be small");
};
for (int gg = 0; gg != nb_integration_pts; ++gg) {
case SMALL_ROT:
t_h1(i, j) = t_kd(i, j);
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"gradApproximator not handled");
};
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"stretchSelector should be linear for small loop");
} else {
t_u(i, j) = t_symm_kd(i, j) + t_log_u(i, j);
t_u_h1(i, j) = t_u(i, j);
t_diff_u_h1(i, j, k, l) =
(t_kd(i, k) * t_kd(j, l) + t_kd(i, l) * t_kd(j, k));
t_diff_u_h1(i, j, k, l) /= 2.;
t_Ldiff_u(i, j, L) = t_L(i, j, L);
}
t_log_u2_h1(i, j) = 0;
t_log_stretch_total(i, j) = t_log_u(i, j);
t_R(i, j) = t_kd(i, j) + levi_civita(i, j, k) * t_omega(k);
t_h(i, j) = levi_civita(i, j, k) * t_omega(k) + t_u(i, j);
t_h_domega(i, j, k) = levi_civita(i, j, k);
t_h_dlog_u(i, j, L) = t_Ldiff_u(i, j, L);
// Adjoint stress
t_approx_P_adjoint_dstretch(i, j) = t_approx_P(i, j);
t_approx_P_adjoint_log_du(L) =
t_approx_P_adjoint_dstretch(i, j) * t_Ldiff_u(i, j, L);
t_approx_P_adjoint_log_du_dP(i, j, L) = t_Ldiff_u(i, j, L);
t_approx_P_adjoint_log_du_domega(m, L) = 0;
// Kirchhoff stress
t_levi_kirchhoff(k) = levi_civita(i, j, k) * t_approx_P(i, j);
t_levi_kirchhoff_dstreach(m, L) = 0;
t_levi_kirchhoff_dP(k, i, j) = levi_civita(i, j, k);
t_levi_kirchhoff_domega(m, n) = 0;
next();
}
};
CHKERR no_h1_loop();
break;
case LARGE_ROT:
CHKERR large_loop();
break;
CHKERR moderate_loop();
break;
case SMALL_ROT:
CHKERR small_loop();
break;
default:
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"gradApproximator not handled");
break;
};
}
EntData &data) {
auto N_InLoop = getNinTheLoop();
auto sensee = getSkeletonSense();
auto nb_gauss_pts = getGaussPts().size2();
auto t_normal = getFTensor1NormalsAtGaussPts();
auto t_sigma_ptr = dataAtPts->getFTensorApproxP(getGaussPts().size2());
auto get_tracion =
dataAtPts->tractionAtPts, nb_gauss_pts);
if (N_InLoop == 0) {
dataAtPts->tractionAtPts.clear();
}
auto t_traction = get_tracion();
for (int gg = 0; gg != nb_gauss_pts; gg++) {
t_traction(i) = t_sigma_ptr(i, j) * sensee * (t_normal(j) / t_normal.l2());
++t_traction;
++t_sigma_ptr;
++t_normal;
}
}
EntData &data) {
if (blockEntities.find(getFEEntityHandle()) == blockEntities.end()) {
};
int nb_integration_pts = getGaussPts().size2();
auto t_w = getFTensor0IntegrationWeight();
auto t_traction = dataAtPts->getFTensorTraction(nb_integration_pts);
auto t_coords = getFTensor1CoordsAtGaussPts();
auto t_spatial_disp = dataAtPts->getFTensorSmallWL2(nb_integration_pts);
FTensor::Tensor1<double, 3> t_coords_spatial{0., 0., 0.};
// Offset for center of mass. Can be added in the future.
FTensor::Tensor1<double, 3> t_off{0.0, 0.0, 0.0};
FTensor::Tensor1<double, 3> loc_reaction_forces{0., 0., 0.};
FTensor::Tensor1<double, 3> loc_moment_forces{0., 0., 0.};
for (auto gg = 0; gg != nb_integration_pts; ++gg) {
loc_reaction_forces(i) += (t_traction(i)) * t_w * getMeasure();
t_coords_spatial(i) = t_coords(i) + t_spatial_disp(i);
// t_coords_spatial(i) -= t_off(i);
loc_moment_forces(i) +=
(FTensor::levi_civita<double>(i, j, k) * t_coords_spatial(j)) *
t_traction(k) * t_w * getMeasure();
++t_coords;
++t_spatial_disp;
++t_w;
++t_traction;
}
reactionVec[0] += loc_reaction_forces(0);
reactionVec[1] += loc_reaction_forces(1);
reactionVec[2] += loc_reaction_forces(2);
reactionVec[3] += loc_moment_forces(0);
reactionVec[4] += loc_moment_forces(1);
reactionVec[5] += loc_moment_forces(2);
}
int nb_dofs = data.getIndices().size();
int nb_integration_pts = data.getN().size1();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
auto t_div_P = dataAtPts->getFTensorDivP(nb_integration_pts);
auto t_s_dot_w = dataAtPts->getFTensorSmallWL2Dot(nb_integration_pts);
auto w_l2_dot_dot_at_pts = dataAtPts->getSmallWL2DotDotAtPts();
const bool reset_w_l2_dot_dot =
w_l2_dot_dot_at_pts->size1() != nb_integration_pts ||
w_l2_dot_dot_at_pts->size2() != 3;
*w_l2_dot_dot_at_pts, nb_integration_pts);
if (reset_w_l2_dot_dot) {
w_l2_dot_dot_at_pts->clear();
}
auto t_s_dot_dot_w = dataAtPts->getFTensorSmallWL2DotDot(nb_integration_pts);
auto piola_scale = dataAtPts->piolaScale;
auto alpha_w = alphaW / piola_scale;
auto alpha_rho = alphaRho / piola_scale;
int nb_base_functions = data.getN().size2();
auto t_row_base_fun = data.getFTensor0N();
FTensor::Index<'i', 3> i;
auto get_ftensor1 = [](auto &v) {
&v[2]);
};
auto next = [&]() {
++t_w;
++t_div_P;
++t_s_dot_w;
++t_s_dot_dot_w;
};
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
auto t_nf = get_ftensor1(nF);
int bb = 0;
for (; bb != nb_dofs / 3; ++bb) {
t_nf(i) -= a * t_row_base_fun * t_div_P(i);
t_nf(i) += a * t_row_base_fun * alpha_w * t_s_dot_w(i);
t_nf(i) += a * t_row_base_fun * alpha_rho * t_s_dot_dot_w(i);
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
next();
}
}
int nb_dofs = data.getIndices().size();
int nb_integration_pts = getGaussPts().size2();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
auto t_levi_kirchhoff =
dataAtPts->getFTensorLeviKirchhoff(nb_integration_pts);
auto t_omega_grad_dot =
dataAtPts->getFTensorRotAxisGradDot(nb_integration_pts);
int nb_base_functions = data.getN().size2();
auto t_row_base_fun = data.getFTensor0N();
auto t_row_grad_fun = data.getFTensor1DiffN<3>();
FTensor::Index<'i', 3> i;
FTensor::Index<'j', 3> j;
FTensor::Index<'k', 3> k;
auto get_ftensor1 = [](auto &v) {
&v[2]);
};
// auto time_step = getTStimeStep();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
auto t_nf = get_ftensor1(nF);
int bb = 0;
for (; bb != nb_dofs / 3; ++bb) {
t_nf(k) -= (a * t_row_base_fun) * t_levi_kirchhoff(k);
t_nf(k) += (a * alphaOmega /*/ time_step*/) *
(t_row_grad_fun(i) * t_omega_grad_dot(k, i));
++t_nf;
++t_row_base_fun;
++t_row_grad_fun;
}
for (; bb != nb_base_functions; ++bb) {
++t_row_base_fun;
++t_row_grad_fun;
}
++t_w;
++t_levi_kirchhoff;
++t_omega_grad_dot;
}
}
int nb_dofs = data.getIndices().size();
int nb_integration_pts = data.getN().size1();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int nb_base_functions = data.getN().size2() / 3;
auto t_row_base_fun = data.getFTensor1N<3>();
auto get_ftensor1 = [](auto &v) {
&v[2]);
};
auto t_h = dataAtPts->getFTensorSmallH(nb_integration_pts);
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
auto t_nf = get_ftensor1(nF);
t_residuum(i, j) = t_h(i, j) - t_kd(i, j);
int bb = 0;
for (; bb != nb_dofs / 3; ++bb) {
t_nf(i) -= a * t_row_base_fun(j) * t_residuum(i, j);
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
++t_w;
++t_h;
}
}
int nb_dofs = data.getIndices().size();
int nb_integration_pts = data.getN().size1();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int nb_base_functions = data.getN().size2() / 9;
auto t_row_base_fun = data.getFTensor2N<3, 3>();
auto get_ftensor0 = [](auto &v) {
};
auto t_h = dataAtPts->getFTensorSmallH(nb_integration_pts);
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
auto t_nf = get_ftensor0(nF);
t_residuum(i, j) = t_h(i, j);
int bb = 0;
for (; bb != nb_dofs; ++bb) {
t_nf -= a * t_row_base_fun(i, j) * t_residuum(i, j);
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb) {
++t_row_base_fun;
}
++t_w;
++t_h;
}
}
int nb_dofs = data.getIndices().size();
int nb_integration_pts = data.getN().size1();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
auto t_w_l2 = dataAtPts->getFTensorSmallWL2(nb_integration_pts);
int nb_base_functions = data.getN().size2() / 3;
auto t_row_diff_base_fun = data.getFTensor2DiffN<3, 3>();
FTensor::Index<'i', 3> i;
auto get_ftensor1 = [](auto &v) {
&v[2]);
};
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
auto t_nf = get_ftensor1(nF);
int bb = 0;
for (; bb != nb_dofs / 3; ++bb) {
double div_row_base = t_row_diff_base_fun(i, i);
t_nf(i) -= a * div_row_base * t_w_l2(i);
++t_nf;
++t_row_diff_base_fun;
}
for (; bb != nb_base_functions; ++bb) {
++t_row_diff_base_fun;
}
++t_w;
++t_w_l2;
}
}
template <>
EntData &data) {
int nb_integration_pts = getGaussPts().size2();
Tag tag;
CHKERR getPtrFE() -> mField.get_moab().tag_get_handle(tagName.c_str(), tag);
int tag_length;
CHKERR getPtrFE() -> mField.get_moab().tag_get_length(tag, tag_length);
if (tag_length != 9) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Number of internal stress components should be 9 but is %d",
tag_length);
}
VectorDouble const_stress_vec(9);
auto fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
CHKERR getPtrFE() -> mField.get_moab().tag_get_data(
tag, &fe_ent, 1, &*const_stress_vec.data().begin());
auto t_const_stress = getFTensor1FromArray<9, 9>(const_stress_vec);
auto get_internal_stress =
dataAtPts->internalStressAtPts, nb_integration_pts);
dataAtPts->internalStressAtPts.clear();
auto t_internal_stress = get_internal_stress();
FTensor::Index<'L', 9> L;
for (int gg = 0; gg != nb_integration_pts; ++gg) {
t_internal_stress(L) = t_const_stress(L);
++t_internal_stress;
}
}
template <>
EntData &data) {
int nb_integration_pts = getGaussPts().size2();
Tag tag;
CHKERR getPtrFE() -> mField.get_moab().tag_get_handle(tagName.c_str(), tag);
int tag_length;
CHKERR getPtrFE() -> mField.get_moab().tag_get_length(tag, tag_length);
if (tag_length != 9) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Number of internal stress components should be 9 but is %d",
tag_length);
}
auto fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
const EntityHandle *vert_conn;
int vert_num;
CHKERR getPtrFE() -> mField.get_moab().get_connectivity(fe_ent, vert_conn,
vert_num, true);
VectorDouble vert_data(vert_num * tag_length);
CHKERR getPtrFE() -> mField.get_moab().tag_get_data(tag, vert_conn, vert_num,
&vert_data[0]);
auto get_internal_stress =
dataAtPts->internalStressAtPts, nb_integration_pts);
dataAtPts->internalStressAtPts.clear();
auto t_internal_stress = get_internal_stress();
auto t_shape_n = data.getFTensor0N();
int nb_shape_fn = data.getN(NOBASE).size2();
FTensor::Index<'L', 9> L;
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto t_vert_data = getFTensor1FromArray<9, 9>(vert_data);
for (int bb = 0; bb != nb_shape_fn; ++bb) {
t_internal_stress(L) += t_vert_data(L) * t_shape_n;
++t_vert_data;
++t_shape_n;
}
++t_internal_stress;
}
}
template <>
int nb_dofs = data.getIndices().size();
int nb_integration_pts = data.getN().size1();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
FTensor::Index<'i', 3> i;
FTensor::Index<'j', 3> j;
auto get_ftensor2 = [](auto &v) {
&v[0], &v[1], &v[2], &v[3], &v[4], &v[5]);
};
auto t_internal_stress =
dataAtPts->getFTensorInternalStress(nb_integration_pts);
const double time = EshelbianCore::physicalTimeFlg
: getFEMethod()->ts_t;
// default scaling is constant
double scale = scalingMethodPtr->getScale(time);
auto t_L = symm_L_tensor();
int nb_base_functions = data.getN().size2();
auto t_row_base_fun = data.getFTensor0N();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
auto t_nf = get_ftensor2(nF);
t_symm_stress(i, j) =
(t_internal_stress(i, j) + t_internal_stress(j, i)) / 2;
t_residual(L) = t_L(i, j, L) * (scale * t_symm_stress(i, j));
int bb = 0;
for (; bb != nb_dofs / 6; ++bb) {
t_nf(L) += a * t_row_base_fun * t_residual(L);
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
++t_w;
++t_internal_stress;
}
}
template <>
int nb_dofs = data.getIndices().size();
int nb_integration_pts = data.getN().size1();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
auto get_ftensor2 = [](auto &v) {
&v[0], &v[1], &v[2], &v[3], &v[4], &v[5]);
};
auto t_internal_stress =
dataAtPts->getFTensorInternalStressVec(nb_integration_pts);
t_L = voigt_to_symm();
const double time = EshelbianCore::physicalTimeFlg
: getFEMethod()->ts_t;
// default is constant
double scale = scalingMethodPtr->getScale(time);
int nb_base_functions = data.getN().size2();
auto t_row_base_fun = data.getFTensor0N();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
auto t_nf = get_ftensor2(nF);
t_residual(L) = t_L(M, L) * (scale * t_internal_stress(M));
int bb = 0;
for (; bb != nb_dofs / 6; ++bb) {
t_nf(L) += a * t_row_base_fun * t_residual(L);
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
++t_w;
++t_internal_stress;
}
}
template <AssemblyType A>
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// iterate over all boundary data
for (auto &bc : (*bcDispPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
int nb_dofs = data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto t_normal = OP::getFTensor1NormalsAtGaussPts();
auto t_w = OP::getFTensor0IntegrationWeight();
int nb_base_functions = data.getN().size2() / 3;
auto t_row_base_fun = data.getFTensor1N<3>();
double scale = 1;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
scale *= scalingMethodsMap.at(bc.blockName)
} else {
scale *= scalingMethodsMap.at(bc.blockName)
->getScale(OP::getFEMethod()->ts_t);
}
} else {
MOFEM_LOG("SELF", Sev::warning)
<< "No scaling method found for " << bc.blockName;
}
// get bc data
FTensor::Tensor1<double, 3> t_bc_disp(bc.vals[0], bc.vals[1], bc.vals[2]);
t_bc_disp(i) *= scale;
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto t_nf = getFTensor1FromPtr<3>(&*OP::locF.begin());
int bb = 0;
for (; bb != nb_dofs / SPACE_DIM; ++bb) {
t_nf(i) +=
t_w * (t_row_base_fun(j) * t_normal(j)) * t_bc_disp(i) * 0.5;
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
++t_w;
++t_normal;
}
}
}
}
return OP::iNtegrate(data);
}
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// iterate over all boundary data
for (auto &bc : (*bcDispPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
int nb_dofs = data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto t_w = OP::getFTensor0IntegrationWeight();
int nb_base_functions = data.getN().size2();
auto t_row_base_fun = data.getFTensor0N();
#ifndef NDEBUG
if (!this->sourceVec) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Source vector for OpTauStabilizationDispRhsBc is not set");
}
if (data.getN().size1() != nb_integration_pts) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Number of integration points in data should be %d but is %d",
nb_integration_pts, (int)data.getN().size1());
}
if (nb_base_functions < nb_dofs / SPACE_DIM) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Number of base functions in data should be %d but is %d",
nb_base_functions, (int)data.getN().size2() / SPACE_DIM);
}
#endif
auto t_disp_val =
*this->sourceVec, nb_integration_pts)();
double scale = 1;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
scale *= scalingMethodsMap.at(bc.blockName)
} else {
scale *= scalingMethodsMap.at(bc.blockName)
->getScale(OP::getFEMethod()->ts_t);
}
} else {
MOFEM_LOG("SELF", Sev::warning)
<< "No scaling method found for " << bc.blockName;
}
// get bc data
FTensor::Tensor1<double, 3> t_bc_disp(bc.vals[0], bc.vals[1], bc.vals[2]);
t_bc_disp(i) *= scale;
auto area = getMeasure();
auto t_coords = OP::getFTensor1CoordsAtGaussPts();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto tau_scale =
area * t_w * OP::betaCoeff(t_coords(0), t_coords(1), t_coords(2));
auto t_nf = getFTensor1FromPtr<3, 3>(OP::locF.data().data());
int bb = 0;
for (; bb != nb_dofs / SPACE_DIM; ++bb) {
for (auto ii = 0; ii != SPACE_DIM; ++ii) {
if (bc.flags[ii]) {
t_nf(ii) += (tau_scale * t_row_base_fun) *
(t_disp_val(ii) - t_bc_disp(ii));
}
}
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
++t_w;
++t_coords;
++t_disp_val;
}
}
}
}
EntData &col_data) {
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// iterate over all boundary data
for (auto &bc : (*bcDispPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
int nb_dofs = row_data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto t_w = OP::getFTensor0IntegrationWeight();
int nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
auto get_t_vec = [&](const int rr) {
std::array<double *, SPACE_DIM> ptrs;
for (auto i = 0; i != SPACE_DIM; ++i)
ptrs[i] = &OP::locMat(rr + i, i);
SPACE_DIM>(ptrs);
};
auto area = getMeasure();
auto t_coords = OP::getFTensor1CoordsAtGaussPts();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto tau_scale =
area * t_w * OP::betaCoeff(t_coords(0), t_coords(1), t_coords(2));
int rr = 0;
for (; rr != nb_dofs / SPACE_DIM; ++rr) {
auto t_mat = get_t_vec(SPACE_DIM * rr);
auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
for (int cc = 0; cc != nb_dofs / SPACE_DIM; ++cc) {
for (int ii = 0; ii != SPACE_DIM; ++ii) {
if (bc.flags[ii]) {
t_mat(ii) += tau_scale * (t_row_base_fun * t_col_base_fun);
}
}
++t_col_base_fun;
++t_mat;
}
++t_row_base_fun;
}
for (; rr != nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
++t_coords;
}
}
}
}
EntityHandle fe_ent = OP::getFEEntityHandle();
for (auto &bc : (*bcDispPtr)) {
if (bc.faces.find(fe_ent) != bc.faces.end()) {
auto analytical_data = getAnalyticalExpr(this, analytical_expr, bc.blockName);
auto &v_analytical_expr = std::get<1>(analytical_data);
int nb_dofs = data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto t_w = OP::getFTensor0IntegrationWeight();
int nb_base_functions = data.getN().size2();
auto t_row_base_fun = data.getFTensor0N();
#ifndef NDEBUG
if (!this->sourceVec) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Source vector for OpTauStabilizationOpAnalyticalDispBc is not "
"set");
}
if (data.getN().size1() != nb_integration_pts) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Number of integration points in data should be %d but is %d",
nb_integration_pts, (int)data.getN().size1());
}
if (nb_base_functions < nb_dofs / SPACE_DIM) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Number of base functions in data should be at least %d but is "
"%d",
nb_dofs / SPACE_DIM, nb_base_functions);
}
#endif
auto t_disp_val =
*this->sourceVec, nb_integration_pts)();
auto t_bc_disp = getFTensor1FromMat<3, -1, DL>(v_analytical_expr);
auto area = getMeasure();
auto t_coords = OP::getFTensor1CoordsAtGaussPts();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto tau_scale =
area * t_w * OP::betaCoeff(t_coords(0), t_coords(1), t_coords(2));
auto t_nf = getFTensor1FromPtr<3, 3>(OP::locF.data().data());
int bb = 0;
for (; bb != nb_dofs / SPACE_DIM; ++bb) {
for (auto ii = 0; ii != SPACE_DIM; ++ii) {
if (bc.flags[ii]) {
t_nf(ii) +=
(tau_scale * t_row_base_fun) * (t_disp_val(ii) - t_bc_disp(ii));
}
}
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
++t_w;
++t_coords;
++t_disp_val;
++t_bc_disp;
}
}
}
}
EntData &row_data, EntData &col_data) {
EntityHandle fe_ent = OP::getFEEntityHandle();
for (auto &bc : (*bcDispPtr)) {
if (bc.faces.find(fe_ent) != bc.faces.end()) {
int nb_dofs = row_data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto t_w = OP::getFTensor0IntegrationWeight();
int nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
auto get_t_vec = [&](const int rr) {
std::array<double *, SPACE_DIM> ptrs;
for (auto i = 0; i != SPACE_DIM; ++i)
ptrs[i] = &OP::locMat(rr + i, i);
SPACE_DIM>(ptrs);
};
auto area = getMeasure();
auto t_coords = OP::getFTensor1CoordsAtGaussPts();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto tau_scale =
area * t_w * OP::betaCoeff(t_coords(0), t_coords(1), t_coords(2));
int rr = 0;
for (; rr != nb_dofs / SPACE_DIM; ++rr) {
auto t_mat = get_t_vec(SPACE_DIM * rr);
auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
for (int cc = 0; cc != nb_dofs / SPACE_DIM; ++cc) {
for (int ii = 0; ii != SPACE_DIM; ++ii) {
if (bc.flags[ii]) {
t_mat(ii) += tau_scale * (t_row_base_fun * t_col_base_fun);
}
}
++t_col_base_fun;
++t_mat;
}
++t_row_base_fun;
}
for (; rr != nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
++t_coords;
}
}
}
}
template <AssemblyType A>
double time = OP::getFEMethod()->ts_t;
}
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// interate over all boundary data
for (auto &bc : (*bcRotPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
int nb_dofs = data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto t_normal = OP::getFTensor1NormalsAtGaussPts();
auto t_w = OP::getFTensor0IntegrationWeight();
int nb_base_functions = data.getN().size2() / 3;
auto t_row_base_fun = data.getFTensor1N<3>();
auto get_ftensor1 = [](auto &v) {
&v[2]);
};
// Note: First three values of bc.vals are the center of rotation
// 4th is rotation angle in radians, and remaining values are axis of
// rotation. Also, if rotation axis is not provided, it defaults to the
// normal vector of the face.
// get bc data
FTensor::Tensor1<double, 3> t_center(bc.vals[0], bc.vals[1], bc.vals[2]);
auto get_rotation_angle = [&]() {
double theta = bc.theta;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
theta *= scalingMethodsMap.at(bc.blockName)->getScale(time);
}
return theta;
};
auto get_rotation = [&](auto theta) {
if (bc.vals.size() == 7) {
t_omega(0) = bc.vals[4];
t_omega(1) = bc.vals[5];
t_omega(2) = bc.vals[6];
} else {
// Use gemetric face normal as rotation axis
t_omega(i) = OP::getFTensor1Normal()(i);
}
if (t_omega.l2() > std::numeric_limits<double>::epsilon()) {
t_omega.normalize();
} else {
MOFEM_LOG("SELF", Sev::warning)
<< "Rotation axis is zero vector for block " << bc.blockName
<< ". This may lead to unexpected results.";
}
t_omega(i) *= theta;
? 0.
: t_omega.l2());
};
auto t_R = get_rotation(get_rotation_angle());
auto t_coords = OP::getFTensor1CoordsAtGaussPts();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
t_delta(i) = t_center(i) - t_coords(i);
t_disp(i) = t_delta(i) - t_R(i, j) * t_delta(j);
auto t_nf = getFTensor1FromPtr<3>(&*OP::locF.begin());
int bb = 0;
for (; bb != nb_dofs / SPACE_DIM; ++bb) {
t_nf(i) += t_w * (t_row_base_fun(j) * t_normal(j)) * t_disp(i) * 0.5;
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
++t_w;
++t_normal;
++t_coords;
}
}
}
}
return OP::iNtegrate(data);
}
double time = OP::getFEMethod()->ts_t;
}
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// iterate over all boundary data
for (auto &bc : (*bcRotPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
int nb_dofs = data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto t_w = OP::getFTensor0IntegrationWeight();
int nb_base_functions = data.getN().size2();
auto t_row_base_fun = data.getFTensor0N();
auto get_ftensor1 = [](auto &v) {
&v[2]);
};
// Note: First three values of bc.vals are the center of rotation
// 4th is rotation angle in radians, and remaining values are axis of
// rotation. Also, if rotation axis is not provided, it defaults to the
// normal vector of the face.
// get bc data
FTensor::Tensor1<double, 3> t_center(bc.vals[0], bc.vals[1], bc.vals[2]);
auto get_rotation_angle = [&]() {
double theta = bc.theta;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
theta *= scalingMethodsMap.at(bc.blockName)->getScale(time);
}
return theta;
};
auto get_rotation = [&](auto theta) {
if (bc.vals.size() == 7) {
t_omega(0) = bc.vals[4];
t_omega(1) = bc.vals[5];
t_omega(2) = bc.vals[6];
} else {
// Use gemetric face normal as rotation axis
t_omega(i) = OP::getFTensor1Normal()(i);
}
if (t_omega.l2() > std::numeric_limits<double>::epsilon()) {
t_omega.normalize();
}
t_omega(i) *= theta;
? 0.
: t_omega.l2());
};
auto area = getMeasure();
auto t_R = get_rotation(get_rotation_angle());
auto t_coords = OP::getFTensor1CoordsAtGaussPts();
auto t_disp_val =
*this->sourceVec, nb_integration_pts)();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto tau_scale =
area * t_w * OP::betaCoeff(t_coords(0), t_coords(1), t_coords(2));
t_delta(i) = t_center(i) - t_coords(i);
t_bc_disp(i) = t_delta(i) - t_R(i, j) * t_delta(j);
auto t_nf = getFTensor1FromPtr<3>(&*OP::locF.begin());
int bb = 0;
for (; bb != nb_dofs / SPACE_DIM; ++bb) {
t_nf(i) +=
(tau_scale * t_row_base_fun) * (t_disp_val(i) - t_bc_disp(i));
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
++t_w;
++t_coords;
++t_disp_val;
}
}
}
}
EntData &col_data) {
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// iterate over all boundary data
for (auto &bc : (*bcRotPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
int nb_dofs = row_data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto t_w = OP::getFTensor0IntegrationWeight();
int nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
auto get_t_vec = [&](const int rr) {
std::array<double *, SPACE_DIM> ptrs;
for (auto i = 0; i != SPACE_DIM; ++i)
ptrs[i] = &OP::locMat(rr + i, i);
SPACE_DIM>(ptrs);
};
auto area = getMeasure();
auto t_coords = OP::getFTensor1CoordsAtGaussPts();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto tau_scale =
area * t_w * OP::betaCoeff(t_coords(0), t_coords(1), t_coords(2));
int rr = 0;
for (; rr != nb_dofs / SPACE_DIM; ++rr) {
auto t_mat = get_t_vec(SPACE_DIM * rr);
auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
for (int cc = 0; cc != nb_dofs / SPACE_DIM; ++cc) {
for (int ii = 0; ii != SPACE_DIM; ++ii) {
t_mat(ii) += tau_scale * (t_row_base_fun * t_col_base_fun);
}
++t_col_base_fun;
++t_mat;
}
++t_row_base_fun;
}
for (; rr != nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
++t_coords;
}
}
}
}
template <AssemblyType A>
double time = OP::getFEMethod()->ts_t;
}
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// iterate over all boundary data
for (auto &bc : (*bcDispPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
for (auto &bd : (*brokenBaseSideDataPtr)) {
auto t_approx_P = getFTensor2FromMat<3, 3, -1, DL>(bd.getFlux());
auto t_u = getFTensor1FromMat<3, -1, DL>(*hybridDispPtr);
auto t_normal = OP::getFTensor1NormalsAtGaussPts();
auto t_w = OP::getFTensor0IntegrationWeight();
double scale = 1;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
scale *= scalingMethodsMap.at(bc.blockName)->getScale(time);
} else {
MOFEM_LOG("SELF", Sev::warning)
<< "No scaling method found for " << bc.blockName;
}
// get bc data
double val = scale * bc.val;
int nb_dofs = data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
int nb_base_functions = data.getN().size2();
auto t_row_base = data.getFTensor0N();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
t_N(i) = t_normal(i);
t_N.normalize();
t_P(i, j) = t_N(i) * t_N(j);
t_Q(i, j) = t_kd(i, j) - t_P(i, j);
t_traction(i) = t_approx_P(i, j) * t_N(j);
t_res(i) =
t_Q(i, j) * t_traction(j) + t_P(i, j) * 2 * t_u(j) - t_N(i) * val;
auto t_nf = getFTensor1FromPtr<3>(&*OP::locF.begin());
int bb = 0;
for (; bb != nb_dofs / SPACE_DIM; ++bb) {
t_nf(i) += (t_w * t_row_base * OP::getMeasure()) * t_res(i);
++t_nf;
++t_row_base;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base;
++t_w;
++t_normal;
++t_u;
++t_approx_P;
}
}
}
}
}
template <AssemblyType A>
EntData &col_data) {
double time = OP::getFEMethod()->ts_t;
}
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto &locMat = OP::locMat;
locMat.resize(row_nb_dofs, col_nb_dofs, false);
locMat.clear();
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// iterate over all boundary data
for (auto &bc : (*bcDispPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
auto t_normal = OP::getFTensor1NormalsAtGaussPts();
auto t_w = OP::getFTensor0IntegrationWeight();
double scale = 1;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
scale *= scalingMethodsMap.at(bc.blockName)->getScale(time);
} else {
MOFEM_LOG("SELF", Sev::warning)
<< "No scaling method found for " << bc.blockName;
}
int nb_integration_pts = OP::getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
int nb_base_functions = row_data.getN().size2();
auto t_row_base = row_data.getFTensor0N();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
t_N(i) = t_normal(i);
t_N.normalize();
t_P(i, j) = t_N(i) * t_N(j);
t_d_res(i, j) = 2.0 * t_P(i, j);
int rr = 0;
for (; rr != row_nb_dofs / SPACE_DIM; ++rr) {
auto t_mat = getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(
locMat, SPACE_DIM * rr);
auto t_col_base = col_data.getFTensor0N(gg, 0);
for (auto cc = 0; cc != col_nb_dofs / SPACE_DIM; ++cc) {
t_mat(i, j) += (t_w * t_row_base * t_col_base) * t_d_res(i, j);
++t_mat;
++t_col_base;
}
++t_row_base;
}
for (; rr != nb_base_functions; ++rr)
++t_row_base;
++t_w;
++t_normal;
}
locMat *= OP::getMeasure();
}
}
}
template <AssemblyType A>
EntData &col_data) {
double time = OP::getFEMethod()->ts_t;
}
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto &locMat = OP::locMat;
locMat.resize(row_nb_dofs, col_nb_dofs, false);
locMat.clear();
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// iterate over all boundary data
for (auto &bc : (*bcDispPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
auto t_normal = OP::getFTensor1NormalsAtGaussPts();
auto t_w = OP::getFTensor0IntegrationWeight();
double scale = 1;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
scale *= scalingMethodsMap.at(bc.blockName)->getScale(time);
} else {
MOFEM_LOG("SELF", Sev::warning)
<< "No scaling method found for " << bc.blockName;
}
int nb_integration_pts = OP::getGaussPts().size2();
int nb_base_functions = row_data.getN().size2();
auto t_row_base = row_data.getFTensor0N();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
t_N(i) = t_normal(i);
t_N.normalize();
t_P(i, j) = t_N(i) * t_N(j);
t_Q(i, j) = t_kd(i, j) - t_P(i, j);
t_d_res(i, j) = t_Q(i, j);
int rr = 0;
for (; rr != row_nb_dofs / SPACE_DIM; ++rr) {
auto t_mat = getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(
OP::locMat, SPACE_DIM * rr);
auto t_col_base = col_data.getFTensor1N<3>(gg, 0);
for (auto cc = 0; cc != col_nb_dofs / SPACE_DIM; ++cc) {
t_mat(i, j) +=
((t_w * t_row_base) * (t_N(k) * t_col_base(k))) * t_d_res(i, j);
++t_mat;
++t_col_base;
}
++t_row_base;
}
for (; rr != nb_base_functions; ++rr)
++t_row_base;
++t_w;
++t_normal;
}
locMat *= OP::getMeasure();
}
}
}
return OP::iNtegrate(data);
}
EntData &col_data) {
return OP::iNtegrate(row_data, col_data);
}
EntData &col_data) {
return OP::iNtegrate(row_data, col_data);
}
template <AssemblyType A>
double time = OP::getFEMethod()->ts_t;
}
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
// iterate over all boundary data
for (auto &bc : (*bcDispPtr)) {
// check if finite element entity is part of boundary condition
if (bc.faces.find(fe_ent) != bc.faces.end()) {
// placeholder to pass boundary block id to python
auto [block_name, v_analytical_expr] =
getAnalyticalExpr(this, analytical_expr, bc.blockName);
int nb_dofs = data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto t_normal = OP::getFTensor1NormalsAtGaussPts();
auto t_w = OP::getFTensor0IntegrationWeight();
int nb_base_functions = data.getN().size2() / 3;
auto t_row_base_fun = data.getFTensor1N<3>();
auto t_coord = OP::getFTensor1CoordsAtGaussPts();
// get bc data
auto t_bc_disp = getFTensor1FromMat<3, -1, DL>(v_analytical_expr);
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto t_nf = getFTensor1FromPtr<3>(&*OP::locF.begin());
int bb = 0;
for (; bb != nb_dofs / SPACE_DIM; ++bb) {
t_nf(i) +=
t_w * (t_row_base_fun(j) * t_normal(j)) * t_bc_disp(i) * 0.5;
++t_nf;
++t_row_base_fun;
}
for (; bb != nb_base_functions; ++bb)
++t_row_base_fun;
++t_bc_disp;
++t_coord;
++t_w;
++t_normal;
}
}
}
}
return OP::iNtegrate(data);
}
int nb_dofs = data.getFieldData().size();
int nb_integration_pts = getGaussPts().size2();
int nb_base_functions = data.getN().size2();
double time = getFEMethod()->ts_t;
}
#ifndef NDEBUG
if (this->locF.size() != nb_dofs)
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Size of locF %ld != nb_dofs %d", this->locF.size(), nb_dofs);
#endif // NDEBUG
auto integrate_rhs = [&](auto &bc, auto calc_tau, double time_scale) {
auto t_val = getFTensor1FromPtr<3>(&*bc.vals.begin());
auto t_row_base = data.getFTensor0N();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
auto t_normal = getFTensor1NormalsAtGaussPts();
double scale = (piolaScalePtr) ? 1. / (*piolaScalePtr) : 1.0;
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = sqrt(t_normal(i) * t_normal(i));
a /= 2.;
const auto tau = calc_tau(t_coords(0), t_coords(1), t_coords(2));
auto t_f = getFTensor1FromPtr<3>(&*this->locF.begin());
int rr = 0;
for (; rr != nb_dofs / SPACE_DIM; ++rr) {
t_f(i) -=
(time_scale * a * t_w * t_row_base * tau) * (t_val(i) * scale);
++t_row_base;
++t_f;
}
for (; rr != nb_base_functions; ++rr)
++t_row_base;
++t_w;
++t_coords;
++t_normal;
}
};
// get entity of face
EntityHandle fe_ent = getFEEntityHandle();
for (auto &bc : *(bcData)) {
if (bc.faces.find(fe_ent) != bc.faces.end()) {
double time_scale = 1;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
time_scale *= scalingMethodsMap.at(bc.blockName)->getScale(time);
}
int nb_dofs = data.getFieldData().size();
if (nb_dofs) {
if (std::regex_match(bc.blockName, std::regex(".*COOK.*"))) {
auto calc_tau = [](double, double y, double) {
y -= 44;
y /= (60 - 44);
return -y * (y - 1) / 0.25;
};
CHKERR integrate_rhs(bc, calc_tau, time_scale);
} else {
CHKERR integrate_rhs(
bc, [](double, double, double) { return 1; }, time_scale);
}
}
}
}
}
int nb_dofs = data.getFieldData().size();
int nb_integration_pts = getGaussPts().size2();
int nb_base_functions = data.getN().size2();
double time = getFEMethod()->ts_t;
}
#ifndef NDEBUG
if (this->locF.size() != nb_dofs)
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Size of locF %ld != nb_dofs %d", this->locF.size(), nb_dofs);
#endif // NDEBUG
auto integrate_rhs = [&](auto &bc, auto calc_tau, double time_scale) {
auto val = bc.val;
auto t_row_base = data.getFTensor0N();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
auto t_tangent1 = getFTensor1Tangent1AtGaussPts();
auto t_tangent2 = getFTensor1Tangent2AtGaussPts();
auto t_grad_gamma_u = getFTensor2FromMat<3, 2, -1, DL>(*hybridGradDispPtr);
double scale = (piolaScalePtr) ? 1. / (*piolaScalePtr) : 1.0;
for (int gg = 0; gg != nb_integration_pts; ++gg) {
t_normal(i) = (FTensor::levi_civita<double>(i, j, k) * t_tangent1(j)) *
t_tangent2(k);
} else {
t_normal(i) = (FTensor::levi_civita<double>(i, j, k) *
(t_tangent1(j) + t_grad_gamma_u(j, N0))) *
(t_tangent2(k) + t_grad_gamma_u(k, N1));
}
auto tau = calc_tau(t_coords(0), t_coords(1), t_coords(2));
t_val(i) = (time_scale * t_w * tau * scale * val) * t_normal(i);
auto t_f = getFTensor1FromPtr<3>(&*this->locF.begin());
int rr = 0;
for (; rr != nb_dofs / SPACE_DIM; ++rr) {
t_f(i) += t_row_base * t_val(i);
++t_row_base;
++t_f;
}
for (; rr != nb_base_functions; ++rr)
++t_row_base;
++t_w;
++t_coords;
++t_tangent1;
++t_tangent2;
++t_grad_gamma_u;
}
this->locF /= 2.;
};
// get entity of face
EntityHandle fe_ent = getFEEntityHandle();
for (auto &bc : *(bcData)) {
if (bc.faces.find(fe_ent) != bc.faces.end()) {
double time_scale = 1;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
time_scale *= scalingMethodsMap.at(bc.blockName)->getScale(time);
}
int nb_dofs = data.getFieldData().size();
if (nb_dofs) {
CHKERR integrate_rhs(
bc, [](double, double, double) { return 1; }, time_scale);
}
}
}
}
template <AssemblyType A>
EntData &col_data) {
}
double time = OP::getFEMethod()->ts_t;
}
int nb_base_functions = row_data.getN().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
int nb_integration_pts = OP::getGaussPts().size2();
auto &locMat = OP::locMat;
locMat.resize(row_nb_dofs, col_nb_dofs, false);
locMat.clear();
auto integrate_lhs = [&](auto &bc, auto calc_tau, double time_scale) {
auto val = bc.val;
auto t_row_base = row_data.getFTensor0N();
auto t_w = OP::getFTensor0IntegrationWeight();
auto t_coords = OP::getFTensor1CoordsAtGaussPts();
auto t_tangent1 = OP::getFTensor1Tangent1AtGaussPts();
auto t_tangent2 = OP::getFTensor1Tangent2AtGaussPts();
auto t_grad_gamma_u = getFTensor2FromMat<3, 2, -1, DL>(*hybridGradDispPtr);
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto tau = calc_tau(t_coords(0), t_coords(1), t_coords(2));
auto t_val = time_scale * t_w * tau * val;
int rr = 0;
for (; rr != row_nb_dofs / SPACE_DIM; ++rr) {
auto t_mat = getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(
locMat, SPACE_DIM * rr);
auto t_diff_col_base = col_data.getFTensor1DiffN<2>(gg, 0);
for (auto cc = 0; cc != col_nb_dofs / SPACE_DIM; ++cc) {
t_normal_du(i, l) = (FTensor::levi_civita<double>(i, j, k) *
(t_tangent2(k) + t_grad_gamma_u(k, N1))) *
t_kd(j, l) * t_diff_col_base(N0)
+
(FTensor::levi_civita<double>(i, j, k) *
(t_tangent1(j) + t_grad_gamma_u(j, N0))) *
t_kd(k, l) * t_diff_col_base(N1);
t_mat(i, j) += (t_w * t_row_base) * t_val * t_normal_du(i, j);
++t_mat;
++t_diff_col_base;
}
++t_row_base;
}
for (; rr != nb_base_functions; ++rr)
++t_row_base;
++t_w;
++t_coords;
++t_tangent1;
++t_tangent2;
++t_grad_gamma_u;
}
OP::locMat /= 2.;
};
// get entity of face
EntityHandle fe_ent = OP::getFEEntityHandle();
for (auto &bc : *(bcData)) {
if (bc.faces.find(fe_ent) != bc.faces.end()) {
double time_scale = 1;
if (scalingMethodsMap.find(bc.blockName) != scalingMethodsMap.end()) {
time_scale *= scalingMethodsMap.at(bc.blockName)->getScale(time);
}
int nb_dofs = row_data.getFieldData().size();
if (nb_dofs) {
CHKERR integrate_lhs(
bc, [](double, double, double) { return 1; }, time_scale);
}
}
}
}
EntData &col_data) {
return OP::iNtegrate(row_data, col_data);
}
int nb_dofs = data.getFieldData().size();
int nb_integration_pts = getGaussPts().size2();
int nb_base_functions = data.getN().size2();
double time = getFEMethod()->ts_t;
}
#ifndef NDEBUG
if (this->locF.size() != nb_dofs)
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Size of locF %ld != nb_dofs %d", this->locF.size(), nb_dofs);
#endif // NDEBUG
// get entity of face
EntityHandle fe_ent = getFEEntityHandle();
for (auto &bc : *(bcData)) {
if (bc.faces.find(fe_ent) != bc.faces.end()) {
// placeholder to pass boundary block id to python
auto [block_name, v_analytical_expr] =
getAnalyticalExpr(this, analytical_expr, bc.blockName);
auto t_val = getFTensor1FromMat<3, -1, DL>(v_analytical_expr);
auto t_row_base = data.getFTensor0N();
auto t_w = getFTensor0IntegrationWeight();
auto t_coords = getFTensor1CoordsAtGaussPts();
double scale = (piolaScalePtr) ? 1. / (*piolaScalePtr) : 1.0;
for (int gg = 0; gg != nb_integration_pts; ++gg) {
auto t_f = getFTensor1FromPtr<3>(&*this->locF.begin());
int rr = 0;
for (; rr != nb_dofs / SPACE_DIM; ++rr) {
t_f(i) -= t_w * t_row_base * (t_val(i) * scale);
++t_row_base;
++t_f;
}
for (; rr != nb_base_functions; ++rr)
++t_row_base;
++t_w;
++t_coords;
++t_val;
}
this->locF *= getMeasure();
}
}
}
EntData &col_data) {
int nb_integration_pts = row_data.getN().size1();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor1 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 1, c + 1), &m(r + 2, c + 2));
};
FTensor::Index<'i', 3> i;
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int row_nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs / 3; ++rr) {
auto t_col_diff_base_fun = col_data.getFTensor2DiffN<3, 3>(gg, 0);
auto t_m = get_ftensor1(K, 3 * rr, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
double div_col_base = t_col_diff_base_fun(i, i);
t_m(i) -= a * t_row_base_fun * div_col_base;
++t_m;
++t_col_diff_base_fun;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
}
}
EntData &col_data) {
if (alphaW < std::numeric_limits<double>::epsilon() &&
alphaRho < std::numeric_limits<double>::epsilon())
const int nb_integration_pts = row_data.getN().size1();
const int row_nb_dofs = row_data.getIndices().size();
auto get_ftensor1 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 1, c + 1), &m(r + 2, c + 2)
);
};
FTensor::Index<'i', 3> i;
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
auto piola_scale = dataAtPts->piolaScale;
auto alpha_w = alphaW / piola_scale;
auto alpha_rho = alphaRho / piola_scale;
int row_nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
double ts_scale = alpha_w * getTSa();
if (std::abs(alphaRho) > std::numeric_limits<double>::epsilon())
ts_scale += alpha_rho * getTSaa();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w * ts_scale;
int rr = 0;
for (; rr != row_nb_dofs / 3; ++rr) {
auto t_col_base_fun = row_data.getFTensor0N(gg, 0);
auto t_m = get_ftensor1(K, 3 * rr, 0);
for (int cc = 0; cc != row_nb_dofs / 3; ++cc) {
const double b = a * t_row_base_fun * t_col_base_fun;
t_m(i) += b;
++t_m;
++t_col_base_fun;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
}
}
EntData &col_data) {
int nb_integration_pts = row_data.getN().size1();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor3 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2),
&m(r + 1, c + 0), &m(r + 1, c + 1), &m(r + 1, c + 2),
&m(r + 2, c + 0), &m(r + 2, c + 1), &m(r + 2, c + 2),
&m(r + 3, c + 0), &m(r + 3, c + 1), &m(r + 3, c + 2),
&m(r + 4, c + 0), &m(r + 4, c + 1), &m(r + 4, c + 2),
&m(r + 5, c + 0), &m(r + 5, c + 1), &m(r + 5, c + 2));
};
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int row_nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
auto t_approx_P_adjoint_log_du_dP =
dataAtPts->getFTensorAdjointPdUdP(nb_integration_pts);
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs / 6; ++rr) {
auto t_col_base_fun = col_data.getFTensor1N<3>(gg, 0);
auto t_m = get_ftensor3(K, 6 * rr, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
t_m(L, i) -=
a * (t_approx_P_adjoint_log_du_dP(i, j, L) * t_col_base_fun(j)) *
t_row_base_fun;
++t_col_base_fun;
++t_m;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
++t_approx_P_adjoint_log_du_dP;
}
}
EntData &col_data) {
int nb_integration_pts = row_data.getN().size1();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor2 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c), &m(r + 1, c), &m(r + 2, c), &m(r + 3, c), &m(r + 4, c),
&m(r + 5, c));
};
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
auto t_row_base_fun = row_data.getFTensor0N();
int row_nb_base_functions = row_data.getN().size2();
auto t_approx_P_adjoint_log_du_dP =
dataAtPts->getFTensorAdjointPdUdP(nb_integration_pts);
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs / 6; ++rr) {
auto t_m = get_ftensor2(K, 6 * rr, 0);
auto t_col_base_fun = col_data.getFTensor2N<3, 3>(gg, 0);
for (int cc = 0; cc != col_nb_dofs; ++cc) {
t_m(L) -=
a * (t_approx_P_adjoint_log_du_dP(i, j, L) * t_col_base_fun(i, j)) *
t_row_base_fun;
++t_m;
++t_col_base_fun;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
++t_approx_P_adjoint_log_du_dP;
}
}
EntData &col_data) {
auto t_L = symm_L_tensor();
int nb_integration_pts = getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor3 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2),
&m(r + 1, c + 0), &m(r + 1, c + 1), &m(r + 1, c + 2),
&m(r + 2, c + 0), &m(r + 2, c + 1), &m(r + 2, c + 2),
&m(r + 3, c + 0), &m(r + 3, c + 1), &m(r + 3, c + 2),
&m(r + 4, c + 0), &m(r + 4, c + 1), &m(r + 4, c + 2),
&m(r + 5, c + 0), &m(r + 5, c + 1), &m(r + 5, c + 2)
);
};
FTensor::Index<'i', 3> i;
FTensor::Index<'j', 3> j;
FTensor::Index<'k', 3> k;
FTensor::Index<'m', 3> m;
FTensor::Index<'n', 3> n;
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
auto t_approx_P_adjoint_log_du_domega =
dataAtPts->getFTensorAdjointPdUdOmega(nb_integration_pts);
int row_nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs / 6; ++rr) {
auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
auto t_m = get_ftensor3(K, 6 * rr, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
double v = a * t_row_base_fun * t_col_base_fun;
t_m(L, k) -= v * t_approx_P_adjoint_log_du_domega(k, L);
++t_m;
++t_col_base_fun;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
++t_approx_P_adjoint_log_du_domega;
}
}
EntData &col_data) {
int nb_integration_pts = getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor2 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2), &m(r + 0, c + 3),
&m(r + 0, c + 4), &m(r + 0, c + 5),
&m(r + 1, c + 0), &m(r + 1, c + 1), &m(r + 1, c + 2), &m(r + 1, c + 3),
&m(r + 1, c + 4), &m(r + 1, c + 5),
&m(r + 2, c + 0), &m(r + 2, c + 1), &m(r + 2, c + 2), &m(r + 2, c + 3),
&m(r + 2, c + 4), &m(r + 2, c + 5)
};
};
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
auto t_levi_kirchhoff_du =
dataAtPts->getFTensorLeviKirchhoffdLogStretch(nb_integration_pts);
int row_nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs / 3; ++rr) {
auto t_m = get_ftensor2(K, 3 * rr, 0);
const double b = a * t_row_base_fun;
auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
for (int cc = 0; cc != col_nb_dofs / size_symm; ++cc) {
t_m(k, L) -= (b * t_col_base_fun) * t_levi_kirchhoff_du(k, L);
++t_m;
++t_col_base_fun;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr) {
++t_row_base_fun;
}
++t_w;
++t_levi_kirchhoff_du;
}
}
EntData &col_data) {
int nb_integration_pts = getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor2 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2),
&m(r + 1, c + 0), &m(r + 1, c + 1), &m(r + 1, c + 2),
&m(r + 2, c + 0), &m(r + 2, c + 1), &m(r + 2, c + 2)
);
};
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int row_nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
auto t_levi_kirchhoff_dP =
dataAtPts->getFTensorLeviKirchhoffP(nb_integration_pts);
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs / 3; ++rr) {
double b = a * t_row_base_fun;
auto t_col_base_fun = col_data.getFTensor1N<3>(gg, 0);
auto t_m = get_ftensor2(K, 3 * rr, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
t_m(m, i) -= b * (t_levi_kirchhoff_dP(m, i, k) * t_col_base_fun(k));
++t_m;
++t_col_base_fun;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr) {
++t_row_base_fun;
}
++t_w;
++t_levi_kirchhoff_dP;
}
}
EntData &col_data) {
int nb_integration_pts = getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor1 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c), &m(r + 1, c), &m(r + 2, c));
};
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
auto t_levi_kirchoff_dP =
dataAtPts->getFTensorLeviKirchhoffP(nb_integration_pts);
int row_nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs / 3; ++rr) {
double b = a * t_row_base_fun;
auto t_col_base_fun = col_data.getFTensor2N<3, 3>(gg, 0);
auto t_m = get_ftensor1(K, 3 * rr, 0);
for (int cc = 0; cc != col_nb_dofs; ++cc) {
t_m(m) -= b * (t_levi_kirchoff_dP(m, i, k) * t_col_base_fun(i, k));
++t_m;
++t_col_base_fun;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr) {
++t_row_base_fun;
}
++t_w;
++t_levi_kirchoff_dP;
}
}
EntData &col_data) {
int nb_integration_pts = getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor2 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2),
&m(r + 1, c + 0), &m(r + 1, c + 1), &m(r + 1, c + 2),
&m(r + 2, c + 0), &m(r + 2, c + 1), &m(r + 2, c + 2)
);
};
FTensor::Index<'i', 3> i;
FTensor::Index<'j', 3> j;
FTensor::Index<'k', 3> k;
FTensor::Index<'l', 3> l;
FTensor::Index<'m', 3> m;
FTensor::Index<'n', 3> n;
auto v = getVolume();
auto ts_a = std::abs(alphaOmega) > std::numeric_limits<double>::epsilon()
? getTSa()
: 0.0;
auto t_w = getFTensor0IntegrationWeight();
auto t_levi_kirchhoff_domega =
dataAtPts->getFTensorLeviKirchhoffdOmega(nb_integration_pts);
int row_nb_base_functions = row_data.getN().size2();
auto t_row_base_fun = row_data.getFTensor0N();
auto t_row_grad_fun = row_data.getFTensor1DiffN<3>();
// auto time_step = getTStimeStep();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
double c = (a * alphaOmega) * (ts_a /*/ time_step*/);
int rr = 0;
for (; rr != row_nb_dofs / 3; ++rr) {
auto t_m = get_ftensor2(K, 3 * rr, 0);
const double b = a * t_row_base_fun;
auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
auto t_col_grad_fun = col_data.getFTensor1DiffN<3>(gg, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
t_m(k, l) -= (b * t_col_base_fun) * t_levi_kirchhoff_domega(k, l);
t_m(k, l) += t_kd(k, l) * (c * (t_row_grad_fun(i) * t_col_grad_fun(i)));
++t_m;
++t_col_base_fun;
++t_col_grad_fun;
}
++t_row_base_fun;
++t_row_grad_fun;
}
for (; rr != row_nb_base_functions; ++rr) {
++t_row_base_fun;
++t_row_grad_fun;
}
++t_w;
++t_levi_kirchhoff_domega;
}
}
EntData &col_data) {
if (hasNonhomogeneousMatBlock) {
integrateImpl<size_symm * size_symm>(row_data, col_data));
} else {
MoFEMFunctionReturnHot(integrateImpl<0>(row_data, col_data));
}
};
template <int S>
EntData &col_data) {
auto get_ftensor2 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2),
&m(r + 1, c + 0), &m(r + 1, c + 1), &m(r + 1, c + 2),
&m(r + 2, c + 0), &m(r + 2, c + 1), &m(r + 2, c + 2)
);
};
int nb_integration_pts = getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int row_nb_base_functions = row_data.getN().size2() / 3;
auto t_inv_D =
getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, S>(dataAtPts->matInvD);
auto t_row_base = row_data.getFTensor1N<3>();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs / 3; ++rr) {
auto t_col_base = col_data.getFTensor1N<3>(gg, 0);
auto t_m = get_ftensor2(K, 3 * rr, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
t_m(i, k) -= a * t_row_base(j) * (t_inv_D(i, j, k, l) * t_col_base(l));
++t_m;
++t_col_base;
}
++t_row_base;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base;
++t_w;
++t_inv_D;
}
}
EntData &col_data) {
if (hasNonhomogeneousMatBlock) {
integrateImpl<size_symm * size_symm>(row_data, col_data));
} else {
MoFEMFunctionReturnHot(integrateImpl<0>(row_data, col_data));
}
};
template <int S>
EntData &col_data) {
int nb_integration_pts = getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int row_nb_base_functions = row_data.getN().size2() / 9;
auto t_inv_D =
getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, S>(dataAtPts->matInvD);
auto t_row_base = row_data.getFTensor2N<3, 3>();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs; ++rr) {
auto t_col_base = col_data.getFTensor2N<3, 3>(gg, 0);
for (int cc = 0; cc != col_nb_dofs; ++cc) {
K(rr, cc) -=
a * (t_row_base(i, j) * (t_inv_D(i, j, k, l) * t_col_base(k, l)));
++t_col_base;
}
++t_row_base;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base;
++t_w;
++t_inv_D;
}
}
EntData &col_data) {
if (hasNonhomogeneousMatBlock) {
integrateImpl<size_symm * size_symm>(row_data, col_data));
} else {
MoFEMFunctionReturnHot(integrateImpl<0>(row_data, col_data));
}
};
template <int S>
EntData &col_data) {
auto get_ftensor1 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2)
);
};
int nb_integration_pts = getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int row_nb_base_functions = row_data.getN().size2() / 9;
auto t_inv_D =
getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, S>(dataAtPts->matInvD);
auto t_row_base = row_data.getFTensor2N<3, 3>();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
auto t_m = get_ftensor1(K, 0, 0);
int rr = 0;
for (; rr != row_nb_dofs; ++rr) {
auto t_col_base = col_data.getFTensor1N<3>(gg, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
t_m(k) -= a * (t_row_base(i, j) * t_inv_D(i, j, k, l)) * t_col_base(l);
++t_col_base;
++t_m;
}
++t_row_base;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base;
++t_w;
++t_inv_D;
}
}
EntData &col_data) {
auto get_ftensor1 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2)
);
};
int nb_integration_pts = getGaussPts().size2();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int row_nb_base_functions = row_data.getN().size2() / 9;
auto t_row_base = row_data.getFTensor2N<3, 3>();
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
auto t_m = get_ftensor1(K, 0, 0);
int rr = 0;
for (; rr != row_nb_dofs; ++rr) {
auto t_col_base = col_data.getFTensor1N<3>(gg, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
t_m(k) += a * t_row_base(k, l) * t_col_base(l);
++t_col_base;
++t_m;
}
++t_row_base;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base;
++t_w;
}
}
EntData &col_data) {
int nb_integration_pts = row_data.getN().size1();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor2 = [](MatrixDouble &m, const int r, const int c) {
&m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2),
&m(r + 1, c + 0), &m(r + 1, c + 1), &m(r + 1, c + 2),
&m(r + 2, c + 0), &m(r + 2, c + 1), &m(r + 2, c + 2)
);
};
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int row_nb_base_functions = row_data.getN().size2() / 3;
auto t_row_base_fun = row_data.getFTensor1N<3>();
auto t_h_domega = dataAtPts->getFTensorSmallHdOmega(nb_integration_pts);
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs / 3; ++rr) {
t_PRT(i, k) = t_row_base_fun(j) * t_h_domega(i, j, k);
auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
auto t_m = get_ftensor2(K, 3 * rr, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
t_m(i, j) -= (a * t_col_base_fun) * t_PRT(i, j);
++t_m;
++t_col_base_fun;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
++t_h_domega;
}
}
EntData &col_data) {
int nb_integration_pts = row_data.getN().size1();
int row_nb_dofs = row_data.getIndices().size();
int col_nb_dofs = col_data.getIndices().size();
auto get_ftensor2 = [](MatrixDouble &m, const int r, const int c) {
&m(r, c + 0), &m(r, c + 1), &m(r, c + 2));
};
auto v = getVolume();
auto t_w = getFTensor0IntegrationWeight();
int row_nb_base_functions = row_data.getN().size2() / 9;
auto t_row_base_fun = row_data.getFTensor2N<3, 3>();
auto t_h_domega = dataAtPts->getFTensorSmallHdOmega(nb_integration_pts);
for (int gg = 0; gg != nb_integration_pts; ++gg) {
double a = v * t_w;
int rr = 0;
for (; rr != row_nb_dofs; ++rr) {
t_PRT(k) = t_row_base_fun(i, j) * t_h_domega(i, j, k);
auto t_col_base_fun = col_data.getFTensor0N(gg, 0);
auto t_m = get_ftensor2(K, rr, 0);
for (int cc = 0; cc != col_nb_dofs / 3; ++cc) {
t_m(j) -= (a * t_col_base_fun) * t_PRT(j);
++t_m;
++t_col_base_fun;
}
++t_row_base_fun;
}
for (; rr != row_nb_base_functions; ++rr)
++t_row_base_fun;
++t_w;
++t_h_domega;
}
}
EntData &data) {
if (tagSense != getSkeletonSense())
auto get_tag = [&](auto name) {
auto &mob = getPtrFE()->mField.get_moab();
Tag tag;
CHK_MOAB_THROW(mob.tag_get_handle(name, tag), "get tag");
return tag;
};
auto get_tag_value = [&](auto &&tag, int dim) {
auto &mob = getPtrFE()->mField.get_moab();
auto face = getSidePtrFE()->getFEEntityHandle();
std::vector<double> value(dim);
CHK_MOAB_THROW(mob.tag_get_data(tag, &face, 1, value.data()), "set tag");
return value;
};
auto create_tag = [this](const std::string tag_name, const int size) {
double def_VAL[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Tag th;
CHKERR postProcMesh.tag_get_handle(tag_name.c_str(), size, MB_TYPE_DOUBLE,
th, MB_TAG_CREAT | MB_TAG_SPARSE,
def_VAL);
return th;
};
Tag th_cauchy_streess = create_tag("CauchyStress", 9);
Tag th_detF = create_tag("detF", 1);
Tag th_traction = create_tag("traction", 3);
Tag th_disp_error = create_tag("DisplacementError", 1);
Tag th_energy = create_tag("Energy", 1);
Tag th_young_modulus = create_tag("YoungModulus", 1);
const auto nb_gauss_pts = getGaussPts().size2();
auto t_w = dataAtPts->getFTensorSmallWL2(nb_gauss_pts);
auto t_h = dataAtPts->getFTensorSmallH(nb_gauss_pts);
auto t_approx_P = dataAtPts->getFTensorApproxP(nb_gauss_pts);
auto t_normal = getFTensor1NormalsAtGaussPts();
auto t_disp = dataAtPts->getFTensorSmallWH1(nb_gauss_pts);
// auto sense = getSkeletonSense();
if (dataAtPts->energyAtPts.size() == 0) {
// that is for case that energy is not calculated
dataAtPts->energyAtPts.resize(nb_gauss_pts);
dataAtPts->energyAtPts.clear();
}
auto t_energy = getFTensor0FromVec(dataAtPts->energyAtPts);
auto t_youngs_modulus = getFTensor0FromVec(dataAtPts->youngModulusAtPts);
auto next = [&]() {
++t_w;
++t_h;
++t_approx_P;
++t_normal;
++t_disp;
++t_youngs_modulus;
++t_energy;
};
FTensor::Index<'i', 3> i;
FTensor::Index<'j', 3> j;
FTensor::Index<'k', 3> k;
FTensor::Index<'l', 3> l;
auto set_float_precision = [](const double x) {
if (std::abs(x) < std::numeric_limits<float>::epsilon())
return 0.;
else
return x;
};
// scalars
auto save_scal_tag = [&](auto &th, auto v, const int gg) {
v = set_float_precision(v);
CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1, &v);
};
// vectors
auto save_vec_tag = [&](auto &th, auto &t_d, const int gg) {
t_v(i) = t_d(i);
for (auto &a : v.data())
a = set_float_precision(a);
CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
&*v.data().begin());
};
// tensors
&m(0, 0), &m(0, 1), &m(0, 2),
&m(1, 0), &m(1, 1), &m(1, 2),
&m(2, 0), &m(2, 1), &m(2, 2));
auto save_mat_tag = [&](auto &th, auto &t_d, const int gg) {
t_m(i, j) = t_d(i, j);
for (auto &v : m.data())
v = set_float_precision(v);
CHKERR postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
&*m.data().begin());
};
for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
t_traction(i) = t_approx_P(i, j) * t_normal(j) / t_normal.l2();
// vectors
t_traction(i) *= tagSense;
CHKERR save_vec_tag(th_traction, t_traction, gg);
double u_error = sqrt((t_disp(i) - t_w(i)) * (t_disp(i) - t_w(i)));
if (!std::isfinite(u_error))
u_error = -1.;
CHKERR save_scal_tag(th_disp_error, u_error, gg);
CHKERR save_scal_tag(th_energy, t_energy, gg);
CHKERR save_scal_tag(th_young_modulus, t_youngs_modulus, gg);
const double jac = determinantTensor3by3(t_h);
t_cauchy(i, j) = (1. / jac) * (t_approx_P(i, k) * t_h(j, k));
CHKERR save_mat_tag(th_cauchy_streess, t_cauchy, gg);
CHKERR postProcMesh.tag_set_data(th_detF, &mapGaussPts[gg], 1, &jac);
next();
}
}
boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
std::vector<FieldSpace> spaces, std::string geom_field_name,
boost::shared_ptr<Range> crack_front_edges_ptr) {
constexpr bool scale_l2 = false;
if (scale_l2) {
SETERRQ(PETSC_COMM_WORLD, MOFEM_NOT_IMPLEMENTED,
"Scale L2 Ainsworth Legendre base is not implemented");
}
CHKERR MoFEM::AddHOOps<2, 3, 3>::add(pipeline, spaces, geom_field_name);
}
boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
std::vector<FieldSpace> spaces, std::string geom_field_name,
boost::shared_ptr<Range> crack_front_edges_ptr) {
constexpr bool scale_l2 = false;
if (scale_l2) {
SETERRQ(PETSC_COMM_WORLD, MOFEM_NOT_IMPLEMENTED,
"Scale L2 Ainsworth Legendre base is not implemented");
}
CHKERR MoFEM::AddHOOps<2, 2, 3>::add(pipeline, spaces, geom_field_name);
}
boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pipeline,
std::vector<FieldSpace> spaces, std::string geom_field_name,
boost::shared_ptr<Range> crack_front_edges_ptr,
boost::shared_ptr<MatrixDouble> jac, boost::shared_ptr<VectorDouble> det,
boost::shared_ptr<MatrixDouble> inv_jac) {
if (!geom_field_name.empty()) {
auto jac = boost::make_shared<MatrixDouble>();
auto det = boost::make_shared<VectorDouble>();
pipeline.push_back(
geom_field_name, jac));
pipeline.push_back(new OpInvertMatrix<3>(jac, det, nullptr));
pipeline.push_back(
}
}
constexpr bool scale_l2_ainsworth_legendre_base = false;
if (scale_l2_ainsworth_legendre_base) {
: public MoFEM::OpCalculateVectorFieldGradient<SPACE_DIM, SPACE_DIM> {
boost::shared_ptr<MatrixDouble> jac,
boost::shared_ptr<Range> edges_ptr)
: OP(field_name, jac), edgesPtr(edges_ptr) {}
MoFEMErrorCode doWork(int side, EntityType type, EntData &data) {
auto ent = data.getFieldEntities().size()
? data.getFieldEntities()[0]->getEnt()
: 0;
if (type == MBEDGE && edgesPtr->find(ent) != edgesPtr->end()) {
return 0;
} else {
return OP::doWork(side, type, data);
}
};
private:
boost::shared_ptr<Range> edgesPtr;
};
if (!geom_field_name.empty()) {
auto jac = boost::make_shared<MatrixDouble>();
auto det = boost::make_shared<VectorDouble>();
pipeline.push_back(new OpCalculateVectorFieldGradient(
geom_field_name, jac,
EshelbianCore::setSingularity ? crack_front_edges_ptr
: boost::make_shared<Range>()));
pipeline.push_back(new OpInvertMatrix<3>(jac, det, nullptr));
pipeline.push_back(new OpScaleBaseBySpaceInverseOfMeasure(
}
}
CHKERR MoFEM::AddHOOps<3, 3, 3>::add(pipeline, spaces, geom_field_name, jac,
det, inv_jac);
}
/**
* @brief Caluclate face material force and normal pressure at gauss points
*
* @param side
* @param type
* @param data
* @return MoFEMErrorCode
*
* Reconstruct the full gradient \f$U=\nabla u\f$ on a surface from the
* symmetric part and the surface gradient.
*
* @details
* Inputs:
* - \c t_strain : \f$\varepsilon=\tfrac12(U+U^\top)\f$ (symmetric strain on
* S),
* - \c t_grad_u_gamma : \f$u^\Gamma = U P\f$ (right-projected/surface
* gradient), with \f$P=I-\mathbf N\otimes\mathbf N\f$,
* - \c t_normal : (possibly non‑unit) surface normal.
*
* Procedure (pointwise on S):
* 1) Normalize the normal \f$\mathbf n=\mathbf N/\|\mathbf N\|\f$.
* 2) Form the residual \f$R=\varepsilon-\operatorname{sym}(u^\Gamma)\f$, where
* \f$\operatorname{sym}(A)=\tfrac12(A+A^\top)\f$.
* 3) Recover the normal directional derivative (a vector)
* \f$\mathbf v=\partial_{\mathbf n}u=2R\mathbf n-(\mathbf n^\top R\,\mathbf
* n)\,\mathbf n\f$. 4) Assemble the full gradient \f$U = u^\Gamma + \mathbf
* v\otimes \mathbf n\f$.
*
* Properties (sanity checks):
* - \f$\tfrac12(U+U^\top)=\varepsilon\f$ (matches the given symmetric part),
* - \f$U P = u^\Gamma\f$ (tangential/right-projected columns unchanged),
* - Only the **normal column** is updated via \f$\mathbf v\otimes\mathbf n\f$.
*
* Mapping to variables in this snippet:
* - \f$\varepsilon \leftrightarrow\f$ \c t_strain,
* - \f$u^\Gamma \leftrightarrow\f$ \c t_grad_u_gamma,
* - \f$\mathbf N \leftrightarrow\f$ \c t_normal (normalized into \c t_N),
* - \f$R \leftrightarrow\f$ \c t_R,
* - \f$U \leftrightarrow\f$ \c t_grad_u.
*
* @pre \c t_normal is nonzero; \c t_strain is symmetric.
* @note All indices use Einstein summation; computation is local to the surface
* point.
*
*/
EntData &data) {
const auto nb_gauss_pts = getGaussPts().size2();
dataAtPts->faceMaterialForceAtPts, nb_gauss_pts);
dataAtPts->normalPressureAtPts.resize(nb_gauss_pts, false);
if (getNinTheLoop() == 0) {
dataAtPts->faceMaterialForceAtPts.clear();
dataAtPts->normalPressureAtPts.clear();
}
auto loop_size = getLoopSize();
if (loop_size == 1) {
auto numebered_fe_ptr = getSidePtrFE()->numeredEntFiniteElementPtr;
auto pstatus = numebered_fe_ptr->getPStatus();
if (pstatus & (PSTATUS_SHARED | PSTATUS_MULTISHARED)) {
loop_size = 2;
}
}
auto t_normal = getFTensor1NormalsAtGaussPts();
auto t_T = dataAtPts->getFTensorFaceMaterialForce(
nb_gauss_pts); //< face material force
auto t_p =
getFTensor0FromVec(dataAtPts->normalPressureAtPts); //< normal pressure
auto t_P = dataAtPts->getFTensorApproxP(nb_gauss_pts);
auto t_u_gamma = dataAtPts->getFTensorSmallHybridDisp(nb_gauss_pts);
auto t_grad_u_gamma = dataAtPts->getFTensorGradHybridDisp(nb_gauss_pts);
auto t_strain = dataAtPts->getFTensorLogStretch(nb_gauss_pts);
auto t_omega = dataAtPts->getFTensorRotAxis(nb_gauss_pts);
auto next = [&]() {
++t_normal;
++t_P;
// ++t_grad_P;
++t_omega;
++t_u_gamma;
++t_grad_u_gamma;
++t_strain;
++t_T;
++t_p;
};
for (auto gg = 0; gg != getGaussPts().size2(); ++gg) {
t_N(I) = t_normal(I);
t_N.normalize();
t_A(i, j) = levi_civita(i, j, k) * t_omega(k);
t_R(i, k) = t_kd(i, k) + t_A(i, k);
t_grad_u(i, j) = t_R(i, j) + t_strain(i, j);
t_T(I) += t_N(J) * (t_grad_u(i, I) * t_P(i, J)) / loop_size;
// note that works only for Hooke material, for nonlinear material we need
// strain energy expressed by stress
t_T(I) -= t_N(I) * ((t_strain(i, K) * t_P(i, K)) / 2.) / loop_size;
t_p += t_N(I) *
(t_N(J) * ((t_kd(i, I) + t_grad_u_gamma(i, I)) * t_P(i, J))) /
loop_size;
next();
}
break;
for (auto gg = 0; gg != getGaussPts().size2(); ++gg) {
// Normalize the normal
t_N(I) = t_normal(I);
t_N.normalize();
// R = ε − sym(u^Γ)
t_R(i, j) =
t_strain(i, j) - 0.5 * (t_grad_u_gamma(i, j) + t_grad_u_gamma(j, i));
// U = u^Γ + [2 R N − (Nᵀ R N) N] ⊗ N
t_grad_u(i, J) =
t_grad_u_gamma(i, J) +
(2 * t_R(i, K) * t_N(K) - (t_R(k, L) * t_N(k) * t_N(L)) * t_N(i)) *
t_N(J);
t_T(I) += t_N(J) * (t_grad_u(i, I) * t_P(i, J)) / loop_size;
// note that works only for Hooke material, for nonlinear material we need
// strain energy expressed by stress
t_T(I) -= t_N(I) * ((t_strain(i, K) * t_P(i, K)) / 2.) / loop_size;
// calculate nominal face pressure
t_p += t_N(I) *
(t_N(J) * ((t_kd(i, I) + t_grad_u_gamma(i, I)) * t_P(i, J))) /
loop_size;
next();
}
break;
default:
SETERRQ(PETSC_COMM_WORLD, MOFEM_NOT_IMPLEMENTED,
"Grffith energy release "
"selector not implemented");
};
#ifndef NDEBUG
auto side_fe_ptr = getSidePtrFE();
auto side_fe_mi_ptr = side_fe_ptr->numeredEntFiniteElementPtr;
auto pstatus = side_fe_mi_ptr->getPStatus();
if (pstatus) {
auto owner = side_fe_mi_ptr->getOwnerProc();
MOFEM_LOG("SELF", Sev::noisy)
<< "OpFaceSideMaterialForce: owner proc is not 0, owner proc: " << owner
<< " " << getPtrFE()->mField.get_comm_rank() << " n in the loop "
<< getNinTheLoop() << " loop size " << getLoopSize();
}
#endif // NDEBUG
}
EntData &data) {
#ifndef NDEBUG
auto fe_mi_ptr = getFEMethod()->numeredEntFiniteElementPtr;
auto pstatus = fe_mi_ptr->getPStatus();
if (pstatus) {
auto owner = fe_mi_ptr->getOwnerProc();
MOFEM_LOG("SELF", Sev::noisy)
<< "OpFaceMaterialForce: owner proc is not 0, owner proc: " << owner
<< " " << getPtrFE()->mField.get_comm_rank();
}
#endif // NDEBUG
t_face_T(I) = 0.;
double face_pressure = 0.;
auto t_T = dataAtPts->getFTensorFaceMaterialForce(
getGaussPts().size2()); //< face material force
auto t_p =
getFTensor0FromVec(dataAtPts->normalPressureAtPts); //< normal pressure
auto t_w = getFTensor0IntegrationWeight();
for (auto gg = 0; gg != getGaussPts().size2(); ++gg) {
t_face_T(I) += t_w * t_T(I);
face_pressure += t_w * t_p;
++t_w;
++t_T;
++t_p;
}
t_face_T(I) *= getMeasure();
face_pressure *= getMeasure();
auto get_tag = [&](auto name, auto dim) {
auto &moab = getPtrFE()->mField.get_moab();
Tag tag;
double def_val[] = {0., 0., 0.};
CHK_MOAB_THROW(moab.tag_get_handle(name, dim, MB_TYPE_DOUBLE, tag,
MB_TAG_CREAT | MB_TAG_SPARSE, def_val),
"create tag");
return tag;
};
auto set_tag = [&](auto &&tag, auto ptr) {
auto &moab = getPtrFE()->mField.get_moab();
auto face = getPtrFE()->getFEEntityHandle();
CHK_MOAB_THROW(moab.tag_set_data(tag, &face, 1, ptr), "set tag");
};
set_tag(get_tag("MaterialForce", 3), &t_face_T(0));
set_tag(get_tag("FacePressure", 1), &face_pressure);
}
template <typename OP_PTR>
std::tuple<std::string, MatrixDouble>
const std::string block_name) {
auto nb_gauss_pts = op_ptr->getGaussPts().size2();
auto ts_time = op_ptr->getTStime();
auto ts_time_step = op_ptr->getTStimeStep();
ts_time_step = EshelbianCore::physicalDt;
}
MatrixDouble m_ref_coords = op_ptr->getCoordsAtGaussPts();
MatrixDouble m_ref_normals = op_ptr->getNormalsAtGaussPts();
auto v_analytical_expr =
analytical_expr_function(ts_time_step, ts_time, nb_gauss_pts,
m_ref_coords, m_ref_normals, block_name);
if (PetscUnlikely(!v_analytical_expr.size2())) {
"Analytical expression is empty or does not exist, "
"check python file");
}
return std::make_tuple(block_name, v_analytical_expr);
}
boost::shared_ptr<std::vector<BrokenBaseSideData>> broken_base_side_data,
boost::shared_ptr<MatrixDouble> vec, ScalarFun beta_coeff,
boost::shared_ptr<Range> ents_ptr)
: OP(broken_base_side_data, ents_ptr) {
this->sourceVec = vec;
this->betaCoeff = beta_coeff;
}
boost::shared_ptr<std::vector<BrokenBaseSideData>> broken_base_side_data,
ScalarFun beta_coeff, boost::shared_ptr<Range> ents_ptr)
: OP(broken_base_side_data, ents_ptr) {
this->sourceVec = boost::shared_ptr<MatrixDouble>();
this->betaCoeff = beta_coeff;
}
OpBrokenBaseTimesBrokenDisp::doWork(int row_side, EntityType row_type,
if (OP::entsPtr) {
if (OP::entsPtr->find(this->getFEEntityHandle()) == OP::entsPtr->end())
}
#ifndef NDEBUG
if (!brokenBaseSideData) {
SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "space not set");
}
#endif // NDEBUG
auto do_work_rhs = [this](int row_side, EntityType row_type,
// get number of dofs on row
OP::nbRows = row_data.getIndices().size();
if (!OP::nbRows)
// get number of integration points
OP::nbIntegrationPts = OP::getGaussPts().size2();
// get row base functions
OP::nbRowBaseFunctions = OP::getNbOfBaseFunctions(row_data);
// resize and clear the right hand side vector
OP::locF.resize(OP::nbRows, false);
OP::locF.clear();
// integrate local vector
CHKERR this->iNtegrate(row_data);
// assemble local vector
CHKERR this->aSsemble(row_data);
};
switch (OP::opType) {
case OP::OPSPACE:
for (auto &bd : *brokenBaseSideData) {
this->sourceVec =
boost::shared_ptr<MatrixDouble>(brokenBaseSideData, &bd.getFlux());
CHKERR do_work_rhs(bd.getSide(), bd.getType(), bd.getData());
this->sourceVec.reset();
}
break;
default:
(std::string("wrong op type ") +
OpBaseDerivativesBase::OpTypeNames[OP::opType])
.c_str());
}
}
const std::string row_field,
boost::shared_ptr<std::vector<BrokenBaseSideData>> broken_base_side_data,
ScalarFun beta_coeff, boost::shared_ptr<Range> ents_ptr)
: OP(row_field, boost::shared_ptr<MatrixDouble>(), beta_coeff, ents_ptr),
brokenBaseSideDataPtr(broken_base_side_data) {
this->betaCoeff = beta_coeff;
}
for (auto &bd : (*brokenBaseSideDataPtr)) {
this->sourceVec =
boost::shared_ptr<MatrixDouble>(brokenBaseSideDataPtr, &bd.getFlux());
#ifndef NDEBUG
if (this->sourceVec->size2() != SPACE_DIM) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Inconsistent size of the source vector");
}
if (this->sourceVec->size1() != OP::getGaussPts().size2()) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"Inconsistent size of the source vector");
}
#endif // NDEBUG
CHKERR OP::iNtegrate(data);
this->sourceVec.reset();
}
}
std::string row_field,
boost::shared_ptr<std::vector<BrokenBaseSideData>> broken_base_side_data,
ScalarFun beta, const bool assmb_transpose, const bool only_transpose,
boost::shared_ptr<Range> ents_ptr)
: OP(row_field, broken_base_side_data, assmb_transpose, only_transpose,
ents_ptr) {
this->betaCoeff = beta;
this->sYmm = false;
}
boost::shared_ptr<std::vector<BrokenBaseSideData>> broken_base_side_data,
ScalarFun beta, boost::shared_ptr<Range> ents_ptr)
: OP(broken_base_side_data, ents_ptr) {
this->sYmm = false;
this->betaCoeff = beta;
OP::assembleTranspose = false;
OP::onlyTranspose = false;
}
OpBrokenBaseBrokenBase::doWork(int row_side, EntityType row_type,
if (OP::entsPtr) {
if (OP::entsPtr->find(this->getFEEntityHandle()) == OP::entsPtr->end())
}
#ifndef NDEBUG
if (!brokenBaseSideData) {
SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "space not set");
}
#endif // NDEBUG
auto do_work_lhs = [this](int row_side, int col_side, EntityType row_type,
EntityType col_type,
auto check_if_assemble_transpose = [&] {
if (this->sYmm) {
if (OP::rowSide != OP::colSide || OP::rowType != OP::colType)
return true;
else
return false;
} else if (OP::assembleTranspose) {
return true;
}
return false;
};
OP::rowSide = row_side;
OP::rowType = row_type;
OP::colSide = col_side;
OP::colType = col_type;
OP::nbCols = col_data.getIndices().size();
OP::locMat.resize(OP::nbRows, OP::nbCols, false);
OP::locMat.clear();
CHKERR this->iNtegrate(row_data, col_data);
CHKERR this->aSsemble(row_data, col_data, check_if_assemble_transpose());
};
switch (OP::opType) {
case OP::OPSPACE:
for (auto &bd : *brokenBaseSideData) {
#ifndef NDEBUG
if (!bd.getData().getNSharedPtr(bd.getData().getBase())) {
SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
"base functions not set");
}
#endif
OP::nbRows = bd.getData().getIndices().size();
if (!OP::nbRows)
OP::nbIntegrationPts = OP::getGaussPts().size2();
OP::nbRowBaseFunctions = OP::getNbOfBaseFunctions(bd.getData());
if (!OP::nbRows)
CHKERR do_work_lhs(
// side
bd.getSide(), bd.getSide(),
// type
bd.getType(), bd.getType(),
// row_data
bd.getData(), bd.getData()
);
}
break;
default:
(std::string("wrong op type ") +
OpBaseDerivativesBase::OpTypeNames[OP::opType])
.c_str());
}
}
} // namespace EshelbianPlasticity
Auxilary functions for Eshelbian plasticity.
Eshelbian plasticity interface.
std::string type
Lie algebra implementation.
#define FTENSOR_INDEX(DIM, I)
constexpr double a
constexpr int SPACE_DIM
Kronecker Delta class symmetric.
Kronecker Delta class.
Tensor1< T, Tensor_Dim > normalize()
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ USER_BASE
user implemented approximation base
Definition definitions.h:68
@ NOBASE
Definition definitions.h:59
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
Definition definitions.h:88
#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.
@ MOFEM_IMPOSSIBLE_CASE
Definition definitions.h:35
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
constexpr auto t_kd
boost::function< double(const double, const double, const double)> ScalarFun
Scalar function type.
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
const double v
phase velocity of light in medium (cm/ns)
const double n
refractive index of diffusive medium
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
MoFEM::TsCtx * ts_ctx
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
auto getMat(A &&t_val, B &&t_vec, Fun< double > f)
Get the Mat object.
auto getDiffMat(A &&t_val, B &&t_vec, Fun< double > f, Fun< double > d_f, const int nb)
Get the Diff Mat object.
auto sort_eigen_vals(A &eig, B &eigen_vec)
static Tag get_tag(moab::Interface &moab, std::string tag_name, int size)
std::tuple< std::string, MatrixDouble > getAnalyticalExpr(OP_PTR op_ptr, MatrixDouble &analytical_expr, const std::string block_name)
DataLayoutTraits< DataLayout::GaussByCoeffs > DL
static constexpr auto size_symm
MatrixDouble analytical_expr_function(double delta_t, double t, int nb_gauss_pts, MatrixDouble &m_ref_coords, MatrixDouble &m_ref_normals, const std::string block_name)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
VectorBoundedArray< double, 3 > VectorDouble3
Definition Types.hpp:92
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
UBlasVector< double > VectorDouble
Definition Types.hpp:68
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
decltype(GetFTensor2SymmetricFromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor2SymmetricFromMatType
decltype(GetFTensor4FromMatImpl< Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, Tensor_Dim3, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor4FromMatType
decltype(GetFTensor4DdgFromMatImpl< Tensor_Dim01, Tensor_Dim23, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor4DdgFromMatType
decltype(GetFTensor1FromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor1FromMatType
decltype(GetFTensor3FromMatImpl< Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor3FromMatType
decltype(GetFTensor2FromMatImpl< Tensor_Dim0, Tensor_Dim1, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor2FromMatType
constexpr IntegrationType I
constexpr auto field_name
FTensor::Index< 'm', 3 > m
const int N
Definition speed_test.cpp:3
static enum StretchSelector stretchSelector
static PetscBool l2UserBaseScale
static enum RotSelector rotSelector
static enum RotSelector gradApproximator
static double physicalDt
static PetscBool physicalTimeFlg
static double currentPhysicalTime
static boost::function< double(const double)> f
static PetscBool setSingularity
static bool hasNonHomogeneousMaterialBlock
static boost::function< double(const double)> d_f
static enum EnergyReleaseSelector energyReleaseSelector
static boost::function< double(const double)> inv_f
static auto diffDiffExp(A &&t_w_vee, B &&theta)
Definition Lie.hpp:105
static auto diffExp(A &&t_w_vee, B &&theta)
Definition Lie.hpp:100
static auto exp(A &&t_w_vee, B &&theta)
Definition Lie.hpp:69
Add operators pushing bases from local to physical configuration.
Data on single entity (This is passed as argument to DataOperator::doWork)
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2DiffN(FieldApproximationBase base)
Get derivatives of base functions for Hdiv space.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
const VectorFieldEntities & getFieldEntities() const
Get field entities (const version)
auto getFTensor2N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
auto getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorDouble & getFieldData() const
Get DOF values on entity.
auto getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Operator for inverting matrices at integration points.
Scale base functions by inverses of measure of element.
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode doWork(int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
OpBrokenBaseBrokenBase(boost::shared_ptr< std::vector< BrokenBaseSideData > > broken_base_side_data, ScalarFun beta, boost::shared_ptr< Range > ents_ptr=nullptr)
MoFEMErrorCode doWork(int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
OpBrokenBaseTimesBrokenDisp(boost::shared_ptr< std::vector< BrokenBaseSideData > > broken_base_side_data, ScalarFun beta_coeff=[](double, double, double) constexpr { return 1;}, boost::shared_ptr< Range > ents_ptr=nullptr)
OpBrokenBaseTimesHybridDisp(boost::shared_ptr< std::vector< BrokenBaseSideData > > broken_base_side_data, boost::shared_ptr< MatrixDouble > vec, ScalarFun beta_coeff=[](double, double, double) constexpr { return 1;}, boost::shared_ptr< Range > ents_ptr=nullptr)
MoFEMErrorCode iNtegrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode doWork(int row_side, EntityType row_type, EntData &row_data)
Operator for linear form, usually to calculate values on right hand side.
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Operator for linear form, usually to calculate values on right hand side.
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Caluclate face material force and normal pressure at gauss points.
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
OpHybridBaseTimesBrokenDisp(const std::string row_field, boost::shared_ptr< std::vector< BrokenBaseSideData > > broken_base_side_data, ScalarFun beta_coeff, boost::shared_ptr< Range > ents_ptr=nullptr)
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data)
OpHyrbridBaseBrokenBase(std::string row_field, boost::shared_ptr< std::vector< BrokenBaseSideData > > broken_base_side_data, ScalarFun beta, const bool assmb_transpose, const bool only_transpose, boost::shared_ptr< Range > ents_ptr=nullptr)
MoFEMErrorCode iNtegrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode iNtegrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode integrate(EntData &data)
MoFEMErrorCode integrate(EntData &data)
MoFEMErrorCode integrate(EntData &data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrateImpl(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrateImpl(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrateImpl(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &data)
MoFEMErrorCode integrate(EntData &row_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode integrate(EntData &data)
MoFEMErrorCode integrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode iNtegrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode iNtegrate(EntData &data)
MoFEMErrorCode iNtegrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode iNtegrate(EntData &row_data, EntData &col_data)
MoFEMErrorCode iNtegrate(EntData &data)
double scale
Definition plastic.cpp:124