538 {
540
545
546 const size_t nb_gauss_pts = getGaussPts().size2();
547
548#ifndef NDEBUG
551 "Wrong number of integration pts %ld != %ld",
553 }
554#endif
555
556 auto &nf = locF;
557 locF.clear();
558
559 auto t_w = getFTensor0IntegrationWeight();
560 auto t_coords = getFTensor1CoordsAtGaussPts();
561 auto t_disp = getFTensor1FromMat<3>(
commonDataPtr->contactDisp);
562 auto t_traction = getFTensor1FromMat<3>(
commonDataPtr->contactTraction);
563
564
565
566
567 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
570
572 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
573 auto t_normalize_normal = getFTensor1FromMat<3>(m_normals_at_pts);
574
575 auto next = [&]() {
576 ++t_w;
577 ++t_coords;
578 ++t_disp;
579 ++t_traction;
580 ++t_normalize_normal;
581 ++t_sdf_v;
582 ++t_grad_sdf_v;
583 };
584
585 auto face_data_vec_ptr =
587 auto face_gauss_pts_it = face_data_vec_ptr->begin();
588
589 auto nb_base_functions = data.getN().size2();
590 auto t_base = data.getFTensor0N();
591 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
592
594 auto face_data_ptr =
contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
595 face_data_vec_ptr);
596
597 auto check_face_contact = [&]() {
599 return false;
600
601 if (face_data_ptr) {
602 return true;
603 }
604 return false;
605 };
606
607#ifdef ENABLE_PYTHON_BINDING
609 if (ContactOps::sdfPythonWeakPtr.lock()) {
610 auto tn = t_traction(
i) * t_grad_sdf_v(
i);
612 }
613#else
614 constexpr double c = 0;
615#endif
616
617 if (!
c && check_face_contact()) {
619 t_spatial_coords(
i) = t_coords(
i) + t_disp(
i);
620 auto t_rhs_tmp =
multiPointRhs(face_data_ptr, t_coords, t_spatial_coords,
622 t_rhs(
i) = t_rhs_tmp(
i);
623
624 } else {
625
626#ifdef ENABLE_PYTHON_BINDING
628
629 if (ContactOps::sdfPythonWeakPtr.lock()) {
631 t_cP(
i,
j) = (
c * t_grad_sdf_v(
i)) * t_grad_sdf_v(
j);
633 t_rhs(
i) = t_cQ(
i,
j) * t_traction(
j) +
634 (
c * inv_cn * t_sdf_v) * t_grad_sdf_v(
i);
635 } else {
636 t_rhs(
i) = t_traction(
i);
637 }
638#else
639 t_rhs(
i) = t_traction(
i);
640#endif
641 }
642
643 auto t_nf = getFTensor1FromPtr<3>(&nf[0]);
644 const double alpha = t_w * getMeasure();
645
646 size_t bb = 0;
647 for (; bb != nbRows / 3; ++bb) {
648 const double beta = alpha * t_base;
649 t_nf(
i) -= beta * t_rhs(
i);
650 ++t_nf;
651 ++t_base;
652 }
653 for (; bb < nb_base_functions; ++bb)
654 ++t_base;
655
656 next();
657 }
658
660}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#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)
FTensor::Index< 'l', 3 > l
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.