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