773 {
775
777
781
784
785 auto &locMat = AssemblyBoundaryEleOp::locMat;
786 locMat.resize(nb_rows, nb_cols, false);
787 locMat.clear();
788
789 if (nb_cols && nb_rows) {
790
791 auto nb_gauss_pts = getGaussPts().size2();
792 auto t_w = getFTensor0IntegrationWeight();
793 auto t_coords = getFTensor1CoordsAtGaussPts();
794 auto t_disp = getFTensor1FromMat<3>(
commonDataPtr->contactDisp);
795 auto t_traction = getFTensor1FromMat<3>(
commonDataPtr->contactTraction);
796
797
798 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
801
803 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
804 auto t_hess_sdf_v = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
805 auto t_normalized_normal = getFTensor1FromMat<3>(m_normals_at_pts);
806
807 auto next = [&]() {
808 ++t_w;
809 ++t_coords;
810 ++t_disp;
811 ++t_traction;
812 ++t_sdf_v;
813 ++t_grad_sdf_v;
814 ++t_hess_sdf_v;
815 ++t_normalized_normal;
816 };
817
818 auto face_data_vec_ptr =
820 auto face_gauss_pts_it = face_data_vec_ptr->begin();
821
823 auto nb_face_functions = row_data.
getN().size2() / 3;
825
826 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
827
828 auto face_data_ptr =
contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
829 face_data_vec_ptr);
830
831 auto check_face_contact = [&]() {
833 return false;
834
835 if (face_data_ptr) {
836 return true;
837 }
838 return false;
839 };
840
842
843#ifdef ENABLE_PYTHON_BINDING
845 if (ContactOps::sdfPythonWeakPtr.lock()) {
846 auto tn = t_traction(
i) * t_grad_sdf_v(
i);
848 }
849#else
850 constexpr double c = 0;
851#endif
852
853 if (!
c && check_face_contact()) {
855 t_spatial_coords(
i) = t_coords(
i) + t_disp(
i);
856 constexpr double eps = std::numeric_limits<float>::epsilon();
857 for (auto ii = 0; ii < 3; ++ii) {
859 t_spatial_coords(0), t_spatial_coords(1), t_spatial_coords(2)};
860 t_spatial_coords_cx(ii) +=
eps * 1
i;
861 auto t_rhs_tmp =
864 for (int jj = 0; jj != 3; ++jj) {
865 auto v = t_rhs_tmp(jj).imag();
866 t_res_dU(jj, ii) =
v /
eps;
867 }
868 }
869
870 } else {
871
872#ifdef ENABLE_PYTHON_BINDING
873
874 if (ContactOps::sdfPythonWeakPtr.lock()) {
877
878 (-
c) * (t_hess_sdf_v(
i,
j) * t_grad_sdf_v(
k) * t_traction(
k) +
879 t_grad_sdf_v(
i) * t_hess_sdf_v(
k,
j) * t_traction(
k))
880
881 + (
c * inv_cn) * (t_sdf_v * t_hess_sdf_v(
i,
j) +
882
883 t_grad_sdf_v(
j) * t_grad_sdf_v(
i));
884 } else {
886 }
887#else
889#endif
890 }
891
892 auto alpha = t_w * getMeasure();
893
894 size_t rr = 0;
895 for (; rr != nb_rows / 3; ++rr) {
896
897 auto t_mat = getFTensor2FromArray<3, 3, 3>(locMat, 3 * rr);
899
900 for (size_t cc = 0; cc != nb_cols / 3; ++cc) {
901 auto beta = alpha * t_row_base * t_col_base;
902 t_mat(
i,
j) -= beta * t_res_dU(
i,
j);
903 ++t_col_base;
904 ++t_mat;
905 }
906
907 ++t_row_base;
908 }
909 for (; rr < nb_face_functions; ++rr)
910 ++t_row_base;
911
912 next();
913 }
914 }
915
917}
#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.