778 {
780
782
786
789
790 auto &locMat = AssemblyBoundaryEleOp::locMat;
791 locMat.resize(nb_rows, nb_cols, false);
792 locMat.clear();
793
794 if (nb_cols && nb_rows) {
795
796 auto nb_gauss_pts = getGaussPts().size2();
797 auto t_w = getFTensor0IntegrationWeight();
798 auto t_coords = getFTensor1CoordsAtGaussPts();
799 auto t_disp = getFTensor1FromMat<3>(
commonDataPtr->contactDisp);
800 auto t_traction = getFTensor1FromMat<3>(
commonDataPtr->contactTraction);
801
802
803 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
806
808 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
809 auto t_hess_sdf_v = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
810 auto t_normalized_normal = getFTensor1FromMat<3>(m_normals_at_pts);
811
812 auto next = [&]() {
813 ++t_w;
814 ++t_coords;
815 ++t_disp;
816 ++t_traction;
817 ++t_sdf_v;
818 ++t_grad_sdf_v;
819 ++t_hess_sdf_v;
820 ++t_normalized_normal;
821 };
822
823 auto face_data_vec_ptr =
825 auto face_gauss_pts_it = face_data_vec_ptr->begin();
826
828 auto nb_face_functions = row_data.
getN().size2() / 3;
830
831 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
832
833 auto face_data_ptr =
contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
834 face_data_vec_ptr);
835
836 auto check_face_contact = [&]() {
838 return false;
839
840 if (face_data_ptr) {
841 return true;
842 }
843 return false;
844 };
845
847
848#ifdef ENABLE_PYTHON_BINDING
850 if (ContactOps::sdfPythonWeakPtr.lock()) {
851 auto tn = t_traction(
i) * t_grad_sdf_v(
i);
853 }
854#else
855 constexpr double c = 0;
856#endif
857
858 if (!
c && check_face_contact()) {
860 t_spatial_coords(
i) = t_coords(
i) + t_disp(
i);
861 constexpr double eps = std::numeric_limits<float>::epsilon();
862 for (auto ii = 0; ii < 3; ++ii) {
864 t_spatial_coords(0), t_spatial_coords(1), t_spatial_coords(2)};
865 t_spatial_coords_cx(ii) +=
eps * 1
i;
866 auto t_rhs_tmp =
869 for (int jj = 0; jj != 3; ++jj) {
870 auto v = t_rhs_tmp(jj).imag();
871 t_res_dU(jj, ii) =
v /
eps;
872 }
873 }
874
875 } else {
876
877#ifdef ENABLE_PYTHON_BINDING
878
879 if (ContactOps::sdfPythonWeakPtr.lock()) {
882
883 (-
c) * (t_hess_sdf_v(
i,
j) * t_grad_sdf_v(
k) * t_traction(
k) +
884 t_grad_sdf_v(
i) * t_hess_sdf_v(
k,
j) * t_traction(
k))
885
886 + (
c * inv_cn) * (t_sdf_v * t_hess_sdf_v(
i,
j) +
887
888 t_grad_sdf_v(
j) * t_grad_sdf_v(
i));
889 } else {
891 }
892#else
894#endif
895 }
896
897 auto alpha = t_w * getMeasure();
898
899 size_t rr = 0;
900 for (; rr != nb_rows / 3; ++rr) {
901
902 auto t_mat = getFTensor2FromArray<3, 3, 3>(locMat, 3 * rr);
904
905 for (size_t cc = 0; cc != nb_cols / 3; ++cc) {
906 auto beta = alpha * t_row_base * t_col_base;
907 t_mat(
i,
j) -= beta * t_res_dU(
i,
j);
908 ++t_col_base;
909 ++t_mat;
910 }
911
912 ++t_row_base;
913 }
914 for (; rr < nb_face_functions; ++rr)
915 ++t_row_base;
916
917 next();
918 }
919 }
920
922}
#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)
static auto getFTensor0FromVec(ublas::vector< T, A > &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....
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.