974 {
976
978
982
985
986 auto &locMat = AssemblyBoundaryEleOp::locMat;
987 locMat.resize(nb_rows, nb_cols, false);
988 locMat.clear();
989
990 if (nb_cols && nb_rows) {
991
992 const size_t nb_gauss_pts = OP::getGaussPts().size2();
993
994 auto t_w = OP::getFTensor0IntegrationWeight();
995 auto t_disp = getFTensor1FromMat<3>(
commonDataPtr->contactDisp);
996 auto t_traction = getFTensor1FromMat<3>(
commonDataPtr->contactTraction);
997 auto t_coords = OP::getFTensor1CoordsAtGaussPts();
998 auto t_material_normal = OP::getFTensor1NormalsAtGaussPts();
999
1000
1001 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
1004
1006 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
1007
1008 auto next = [&]() {
1009 ++t_w;
1010 ++t_disp;
1011 ++t_traction;
1012 ++t_coords;
1013 ++t_material_normal;
1014 ++t_sdf_v;
1015 ++t_grad_sdf_v;
1016 };
1017
1018 auto face_data_vec_ptr =
1020 auto face_gauss_pts_it = face_data_vec_ptr->begin();
1021
1023 auto nb_face_functions = row_data.
getN().size2();
1024
1026
1027 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1028
1029 auto face_data_ptr =
contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
1030 face_data_vec_ptr);
1031
1032 auto check_face_contact = [&]() {
1034 return false;
1035
1036 if (face_data_ptr) {
1037 return true;
1038 }
1039 return false;
1040 };
1041
1043
1044#ifdef ENABLE_PYTHON_BINDING
1046 if (ContactOps::sdfPythonWeakPtr.lock()) {
1047 auto tn = t_traction(
i) * t_grad_sdf_v(
i);
1049 }
1050#else
1051 constexpr double c = 0;
1052#endif
1053
1054 if (!
c && check_face_contact()) {
1056 t_spatial_coords(
i) = t_coords(
i) + t_disp(
i);
1057 constexpr double eps = std::numeric_limits<float>::epsilon();
1058 for (auto ii = 0; ii != 3; ++ii) {
1060 t_traction(0), t_traction(1), t_traction(2)};
1061 t_traction_cx(ii) +=
eps * 1
i;
1062 auto t_rhs_tmp =
1065 for (int jj = 0; jj != 3; ++jj) {
1066 auto v = t_rhs_tmp(jj).imag();
1067 t_res_dP(jj, ii) =
v /
eps;
1068 }
1069 }
1070 } else {
1071
1072#ifdef ENABLE_PYTHON_BINDING
1073 if (ContactOps::sdfPythonWeakPtr.lock()) {
1075 t_cP(
i,
j) = (
c * t_grad_sdf_v(
i)) * t_grad_sdf_v(
j);
1077 t_res_dP(
i,
j) = t_cQ(
i,
j);
1078 } else {
1080 }
1081#else
1083#endif
1084 }
1085
1086 const double alpha = t_w / 2.;
1087 size_t rr = 0;
1088 for (; rr != nb_rows / 3; ++rr) {
1089
1090 auto t_mat = getFTensor2FromArray<3, 3, 3>(locMat, 3 * rr);
1092
1093 for (size_t cc = 0; cc != nb_cols / 3; ++cc) {
1094 auto col_base = t_col_base(
i) * t_material_normal(
i);
1095 const double beta = alpha * t_row_base * col_base;
1096 t_mat(
i,
j) -= beta * t_res_dP(
i,
j);
1097 ++t_col_base;
1098 ++t_mat;
1099 }
1100
1101 ++t_row_base;
1102 }
1103 for (; rr < nb_face_functions; ++rr)
1104 ++t_row_base;
1105
1106 next();
1107 }
1108 }
1109
1111}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
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)
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
auto checkSdf(EntityHandle fe_ent, std::map< int, Range > &sdf_map_range)
auto multiPointRhs(ContactTree::FaceData *face_data_ptr, FTensor::Tensor1< T1, 3 > &t_coords, FTensor::Tensor1< T2, 3 > &t_spatial_coords, FTensor::Tensor1< T3, 3 > &t_master_traction, MultiPointRhsType type, bool debug=false)
auto getSdf(OP_PTR op_ptr, MatrixDouble &contact_disp, int block_id, bool eval_hessian)
Tensor2_Expr< Kronecker_Delta< T >, T, Dim0, Dim1, i, j > kronecker_delta(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
Rank 2.
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
auto getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.