562 {
564
566
570
571 auto nb_rows = row_data.getIndices().size();
572 auto nb_cols = col_data.getIndices().size();
573
574 auto &locMat = AssemblyBoundaryEleOp::locMat;
575 locMat.resize(nb_rows, nb_cols, false);
576 locMat.clear();
577
578 if (nb_cols && nb_rows) {
579
580 auto nb_gauss_pts = getGaussPts().size2();
581 auto t_w = getFTensor0IntegrationWeight();
582 auto t_coords = getFTensor1CoordsAtGaussPts();
583 auto t_disp = getFTensor1FromMat<3>(
commonDataPtr->contactDisp);
584 auto t_traction = getFTensor1FromMat<3>(
commonDataPtr->contactTraction);
585
586
587 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
590
591 auto t_sdf_v = getFTensor0FromVec(v_sdf);
592 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
593 auto t_hess_sdf_v = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
594 auto t_normalized_normal = getFTensor1FromMat<3>(m_normals_at_pts);
595
596 auto next = [&]() {
597 ++t_w;
598 ++t_coords;
599 ++t_disp;
600 ++t_traction;
601 ++t_sdf_v;
602 ++t_grad_sdf_v;
603 ++t_hess_sdf_v;
604 ++t_normalized_normal;
605 };
606
607 auto face_data_vec_ptr =
609 auto face_gauss_pts_it = face_data_vec_ptr->begin();
610
611 auto t_row_base = row_data.getFTensor0N();
612 auto nb_face_functions = row_data.getN().size2() / 3;
614
615 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
616
617 auto face_data_ptr =
contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
618 face_data_vec_ptr);
619
620 auto check_face_contact = [&]() {
622 return false;
623
624 if (face_data_ptr) {
625 return true;
626 }
627 return false;
628 };
629
631
632#ifdef ENABLE_PYTHON_BINDING
634 if (ContactOps::sdfPythonWeakPtr.lock()) {
635 auto tn = t_traction(
i) * t_grad_sdf_v(
i);
637 }
638#else
639 constexpr double c = 0;
640#endif
641
642 if (!
c && check_face_contact()) {
644 t_spatial_coords(
i) = t_coords(
i) + t_disp(
i);
645 constexpr double eps = std::numeric_limits<float>::epsilon();
646 for (auto ii = 0; ii < 3; ++ii) {
648 t_spatial_coords(0), t_spatial_coords(1), t_spatial_coords(2)};
649 t_spatial_coords_cx(ii) +=
eps * 1
i;
650 auto t_rhs_tmp =
653 for (int jj = 0; jj != 3; ++jj) {
654 auto v = t_rhs_tmp(jj).imag();
655 t_res_dU(jj, ii) =
v /
eps;
656 }
657 }
658
659 } else {
660
661#ifdef ENABLE_PYTHON_BINDING
662
663 if (ContactOps::sdfPythonWeakPtr.lock()) {
666
667 (-
c) * (t_hess_sdf_v(
i,
j) * t_grad_sdf_v(
k) * t_traction(
k) +
668 t_grad_sdf_v(
i) * t_hess_sdf_v(
k,
j) * t_traction(
k))
669
670 + (
c * inv_cn) * (t_sdf_v * t_hess_sdf_v(
i,
j) +
671
672 t_grad_sdf_v(
j) * t_grad_sdf_v(
i));
673 } else {
675 }
676#else
678#endif
679 }
680
681 auto alpha = t_w * getMeasure();
682
683 size_t rr = 0;
684 for (; rr != nb_rows / 3; ++rr) {
685
686 auto t_mat = getFTensor2FromArray<3, 3, 3>(locMat, 3 * rr);
687 auto t_col_base = col_data.getFTensor0N(gg, 0);
688
689 for (size_t cc = 0; cc != nb_cols / 3; ++cc) {
690 auto beta = alpha * t_row_base * t_col_base;
691 t_mat(
i,
j) -= beta * t_res_dU(
i,
j);
692 ++t_col_base;
693 ++t_mat;
694 }
695
696 ++t_row_base;
697 }
698 for (; rr < nb_face_functions; ++rr)
699 ++t_row_base;
700
701 next();
702 }
703 }
704
706}
#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)