526 {
528
533
534 const size_t nb_gauss_pts = getGaussPts().size2();
535
536#ifndef NDEBUG
539 "Wrong number of integration pts %ld != %ld",
541 }
542#endif
543
544 auto &nf = locF;
545 locF.clear();
546
547 auto t_w = getFTensor0IntegrationWeight();
548 auto t_coords = getFTensor1CoordsAtGaussPts();
549 auto t_disp = getFTensor1FromMat<3>(
commonDataPtr->contactDisp);
550 auto t_traction = getFTensor1FromMat<3>(
commonDataPtr->contactTraction);
551
552
553
554
555 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
558
560 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
561 auto t_normalize_normal = getFTensor1FromMat<3>(m_normals_at_pts);
562
563 auto next = [&]() {
564 ++t_w;
565 ++t_coords;
566 ++t_disp;
567 ++t_traction;
568 ++t_normalize_normal;
569 ++t_sdf_v;
570 ++t_grad_sdf_v;
571 };
572
573 auto face_data_vec_ptr =
575 auto face_gauss_pts_it = face_data_vec_ptr->begin();
576
577 auto nb_base_functions = data.getN().size2();
578 auto t_base = data.getFTensor0N();
579 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
580
582 auto face_data_ptr =
contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
583 face_data_vec_ptr);
584
585 auto check_face_contact = [&]() {
587 return false;
588
589 if (face_data_ptr) {
590 return true;
591 }
592 return false;
593 };
594
595#ifdef ENABLE_PYTHON_BINDING
597 if (ContactOps::sdfPythonWeakPtr.lock()) {
598 auto tn = t_traction(
i) * t_grad_sdf_v(
i);
600 }
601#else
602 constexpr double c = 0;
603#endif
604
605 if (!
c && check_face_contact()) {
607 t_spatial_coords(
i) = t_coords(
i) + t_disp(
i);
608 auto t_rhs_tmp =
multiPointRhs(face_data_ptr, t_coords, t_spatial_coords,
610 t_rhs(
i) = t_rhs_tmp(
i);
611
612 } else {
613
614#ifdef ENABLE_PYTHON_BINDING
616
617 if (ContactOps::sdfPythonWeakPtr.lock()) {
619 t_cP(
i,
j) = (
c * t_grad_sdf_v(
i)) * t_grad_sdf_v(
j);
621 t_rhs(
i) = t_cQ(
i,
j) * t_traction(
j) +
622 (
c * inv_cn * t_sdf_v) * t_grad_sdf_v(
i);
623 } else {
624 t_rhs(
i) = t_traction(
i);
625 }
626#else
627 t_rhs(
i) = t_traction(
i);
628#endif
629 }
630
631 auto t_nf = getFTensor1FromPtr<3>(&nf[0]);
632 const double alpha = t_w * getMeasure();
633
634 size_t bb = 0;
635 for (; bb != nbRows / 3; ++bb) {
636 const double beta = alpha * t_base;
637 t_nf(
i) -= beta * t_rhs(
i);
638 ++t_nf;
639 ++t_base;
640 }
641 for (; bb < nb_base_functions; ++bb)
642 ++t_base;
643
644 next();
645 }
646
648}
#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(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.