v0.15.0
Loading...
Searching...
No Matches
EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU Struct Reference

#include "users_modules/eshelbian_plasticity/src/EshelbianContact.hpp"

Inheritance diagram for EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU:
[legend]
Collaboration diagram for EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU:
[legend]

Public Member Functions

 OpConstrainBoundaryL2Lhs_dU (const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< ContactOps::CommonData > common_data_ptr, boost::shared_ptr< ContactTree > contact_tree_ptr, boost::shared_ptr< std::map< int, Range > > sdf_map_range_ptr=nullptr)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 

Private Attributes

boost::shared_ptr< ContactOps::CommonDatacommonDataPtr
 
boost::shared_ptr< ContactTreecontactTreePtr
 
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
 

Detailed Description

Examples
EshelbianPlasticity.cpp.

Definition at line 155 of file EshelbianContact.hpp.

Constructor & Destructor Documentation

◆ OpConstrainBoundaryL2Lhs_dU()

EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::OpConstrainBoundaryL2Lhs_dU ( const std::string row_field_name,
const std::string col_field_name,
boost::shared_ptr< ContactOps::CommonData > common_data_ptr,
boost::shared_ptr< ContactTree > contact_tree_ptr,
boost::shared_ptr< std::map< int, Range > > sdf_map_range_ptr = nullptr )

Definition at line 547 of file EshelbianContact.cpp.

552 : ContactOps::AssemblyBoundaryEleOp(row_field_name, col_field_name,
553 ContactOps::BoundaryEleOp::OPROWCOL),
554 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
555 sdfMapRangePtr(sdf_map_range_ptr) {
556
557 sYmm = false;
558}
FormsIntegrators< BoundaryEleOp >::Assembly< A >::OpBase AssemblyBoundaryEleOp
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
boost::shared_ptr< ContactOps::CommonData > commonDataPtr

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::iNtegrate ( EntitiesFieldData::EntData & row_data,
EntitiesFieldData::EntData & col_data )

Definition at line 561 of file EshelbianContact.cpp.

562 {
564
565 using namespace ContactOps;
566
567 FTensor::Index<'i', 3> i;
568 FTensor::Index<'j', 3> j;
569 FTensor::Index<'k', 3> k;
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 // placeholder to pass boundary block id to python
587 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
588 getSdf(this, commonDataPtr->contactDisp,
589 checkSdf(getFEEntityHandle(), *sdfMapRangePtr), true);
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 =
608 contactTreePtr->findFaceDataVecPtr(getFEEntityHandle());
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;
613 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
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 = [&]() {
621 if (checkSdf(getFEEntityHandle(), *sdfMapRangePtr) != -1)
622 return false;
623
624 if (face_data_ptr) {
625 return true;
626 }
627 return false;
628 };
629
631
632#ifdef ENABLE_PYTHON_BINDING
633 double c = 0.;
634 if (ContactOps::sdfPythonWeakPtr.lock()) {
635 auto tn = t_traction(i) * t_grad_sdf_v(i);
636 c = ContactOps::constrain(t_sdf_v, tn);
637 }
638#else
639 constexpr double c = 0;
640#endif
641
642 if (!c && check_face_contact()) {
643 FTensor::Tensor1<double, 3> t_spatial_coords;
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) {
647 FTensor::Tensor1<std::complex<double>, 3> t_spatial_coords_cx{
648 t_spatial_coords(0), t_spatial_coords(1), t_spatial_coords(2)};
649 t_spatial_coords_cx(ii) += eps * 1i;
650 auto t_rhs_tmp =
651 multiPointRhs(face_data_ptr, t_coords, t_spatial_coords_cx,
652 t_traction, MultiPointRhsType::U);
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()) {
665 t_res_dU(i, j) =
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 {
674 t_res_dU(i, j) = 0;
675 }
676#else
677 t_res_dU(i, j) = 0;
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}
static const double eps
Kronecker Delta class.
#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()
constexpr auto t_kd
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
double alpha_contact_const
double constrain(double sdf, double tn)
constrain function
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)

Member Data Documentation

◆ commonDataPtr

boost::shared_ptr<ContactOps::CommonData> EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::commonDataPtr
private

Definition at line 167 of file EshelbianContact.hpp.

◆ contactTreePtr

boost::shared_ptr<ContactTree> EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::contactTreePtr
private

Definition at line 168 of file EshelbianContact.hpp.

◆ sdfMapRangePtr

boost::shared_ptr<std::map<int, Range> > EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::sdfMapRangePtr
private

Definition at line 169 of file EshelbianContact.hpp.


The documentation for this struct was generated from the following files: