530 {
532
537
538 const size_t nb_gauss_pts = getGaussPts().size2();
539
540#ifndef NDEBUG
543 "Wrong number of integration pts %ld != %ld",
545 }
546#endif
547
548 auto &nf = locF;
549 locF.clear();
550
551 auto t_w = getFTensor0IntegrationWeight();
552 auto t_coords = getFTensor1CoordsAtGaussPts();
553 auto t_disp = getFTensor1FromMat<3>(
commonDataPtr->contactDisp);
554 auto t_traction = getFTensor1FromMat<3>(
commonDataPtr->contactTraction);
555
556
557
558
559 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
562
564 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
565 auto t_normalize_normal = getFTensor1FromMat<3>(m_normals_at_pts);
566
567 auto next = [&]() {
568 ++t_w;
569 ++t_coords;
570 ++t_disp;
571 ++t_traction;
572 ++t_normalize_normal;
573 ++t_sdf_v;
574 ++t_grad_sdf_v;
575 };
576
577 auto face_data_vec_ptr =
579 auto face_gauss_pts_it = face_data_vec_ptr->begin();
580
581 auto nb_base_functions = data.getN().size2();
582 auto t_base = data.getFTensor0N();
583 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
584
586 auto face_data_ptr =
contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
587 face_data_vec_ptr);
588
589 auto check_face_contact = [&]() {
591 return false;
592
593 if (face_data_ptr) {
594 return true;
595 }
596 return false;
597 };
598
599#ifdef ENABLE_PYTHON_BINDING
601 if (ContactOps::sdfPythonWeakPtr.lock()) {
602 auto tn = t_traction(
i) * t_grad_sdf_v(
i);
604 }
605#else
606 constexpr double c = 0;
607#endif
608
609 if (!
c && check_face_contact()) {
611 t_spatial_coords(
i) = t_coords(
i) + t_disp(
i);
612 auto t_rhs_tmp =
multiPointRhs(face_data_ptr, t_coords, t_spatial_coords,
614 t_rhs(
i) = t_rhs_tmp(
i);
615
616 } else {
617
618#ifdef ENABLE_PYTHON_BINDING
620
621 if (ContactOps::sdfPythonWeakPtr.lock()) {
623 t_cP(
i,
j) = (
c * t_grad_sdf_v(
i)) * t_grad_sdf_v(
j);
625 t_rhs(
i) = t_cQ(
i,
j) * t_traction(
j) +
626 (
c * inv_cn * t_sdf_v) * t_grad_sdf_v(
i);
627 } else {
628 t_rhs(
i) = t_traction(
i);
629 }
630#else
631 t_rhs(
i) = t_traction(
i);
632#endif
633 }
634
635 auto t_nf = getFTensor1FromPtr<3>(&nf[0]);
636 const double alpha = t_w * getMeasure();
637
638 size_t bb = 0;
639 for (; bb != nbRows / 3; ++bb) {
640 const double beta = alpha * t_base;
641 t_nf(
i) -= beta * t_rhs(
i);
642 ++t_nf;
643 ++t_base;
644 }
645 for (; bb < nb_base_functions; ++bb)
646 ++t_base;
647
648 next();
649 }
650
652}
#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.