v0.15.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS > Struct Template Reference

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

Inheritance diagram for EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS >:
[legend]
Collaboration diagram for EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS >:
[legend]

Public Types

using OP = typename FormsIntegrators< FaceUserDataOperator >::Assembly< A >::OpBrokenBase
 

Public Member Functions

 OpConstrainBoundaryL2Lhs_dP (std::string row_field_name, boost::shared_ptr< std::vector< BrokenBaseSideData > > broken_base_side_data, 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

template<AssemblyType A>
struct EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS >

Definition at line 175 of file EshelbianContact.hpp.

Member Typedef Documentation

◆ OP

template<AssemblyType A>
using EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS >::OP = typename FormsIntegrators<FaceUserDataOperator>::Assembly< A>::OpBrokenBase

Definition at line 178 of file EshelbianContact.hpp.

Constructor & Destructor Documentation

◆ OpConstrainBoundaryL2Lhs_dP()

template<AssemblyType A>
EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS >::OpConstrainBoundaryL2Lhs_dP ( std::string  row_field_name,
boost::shared_ptr< std::vector< BrokenBaseSideData > >  broken_base_side_data,
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 709 of file EshelbianContact.cpp.

717 : OP(row_field_name, broken_base_side_data, false, false),
718 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
719 sdfMapRangePtr(sdf_map_range_ptr) {
720 OP::sYmm = false;
721}
typename FormsIntegrators< FaceUserDataOperator >::Assembly< A >::OpBrokenBase OP

Member Function Documentation

◆ iNtegrate()

template<AssemblyType A>
MoFEMErrorCode EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS >::iNtegrate ( EntitiesFieldData::EntData &  row_data,
EntitiesFieldData::EntData &  col_data 
)

Definition at line 725 of file EshelbianContact.cpp.

727 {
729
730 using namespace ContactOps;
731
732 FTensor::Index<'i', 3> i;
733 FTensor::Index<'j', 3> j;
734 FTensor::Index<'k', 3> k;
735
736 auto nb_rows = row_data.getIndices().size();
737 auto nb_cols = col_data.getIndices().size();
738
739 auto &locMat = AssemblyBoundaryEleOp::locMat;
740 locMat.resize(nb_rows, nb_cols, false);
741 locMat.clear();
742
743 if (nb_cols && nb_rows) {
744
745 const size_t nb_gauss_pts = OP::getGaussPts().size2();
746
747 auto t_w = OP::getFTensor0IntegrationWeight();
748 auto t_disp = getFTensor1FromMat<3>(commonDataPtr->contactDisp);
749 auto t_traction = getFTensor1FromMat<3>(commonDataPtr->contactTraction);
750 auto t_coords = OP::getFTensor1CoordsAtGaussPts();
751 auto t_material_normal = OP::getFTensor1NormalsAtGaussPts();
752
753 // placeholder to pass boundary block id to python
754 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
755 getSdf(this, commonDataPtr->contactDisp,
756 checkSdf(OP::getFEEntityHandle(), *sdfMapRangePtr), false);
757
758 auto t_sdf_v = getFTensor0FromVec(v_sdf);
759 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
760
761 auto next = [&]() {
762 ++t_w;
763 ++t_disp;
764 ++t_traction;
765 ++t_coords;
766 ++t_material_normal;
767 ++t_sdf_v;
768 ++t_grad_sdf_v;
769 };
770
771 auto face_data_vec_ptr =
772 contactTreePtr->findFaceDataVecPtr(OP::getFEEntityHandle());
773 auto face_gauss_pts_it = face_data_vec_ptr->begin();
774
775 auto t_row_base = row_data.getFTensor0N();
776 auto nb_face_functions = row_data.getN().size2();
777
778 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
779
780 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
781
782 auto face_data_ptr = contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
783 face_data_vec_ptr);
784
785 auto check_face_contact = [&]() {
786 if (checkSdf(OP::getFEEntityHandle(), *sdfMapRangePtr) != -1)
787 return false;
788
789 if (face_data_ptr) {
790 return true;
791 }
792 return false;
793 };
794
796
797#ifdef ENABLE_PYTHON_BINDING
798 double c = 0.;
799 if (ContactOps::sdfPythonWeakPtr.lock()) {
800 auto tn = t_traction(i) * t_grad_sdf_v(i);
801 c = ContactOps::constrain(t_sdf_v, tn);
802 }
803#else
804 constexpr double c = 0;
805#endif
806
807 if (!c && check_face_contact()) {
808 FTensor::Tensor1<double, 3> t_spatial_coords;
809 t_spatial_coords(i) = t_coords(i) + t_disp(i);
810 constexpr double eps = std::numeric_limits<float>::epsilon();
811 for (auto ii = 0; ii != 3; ++ii) {
813 t_traction(0), t_traction(1), t_traction(2)};
814 t_traction_cx(ii) += eps * 1i;
815 auto t_rhs_tmp =
816 multiPointRhs(face_data_ptr, t_coords, t_spatial_coords,
817 t_traction_cx, MultiPointRhsType::U);
818 for (int jj = 0; jj != 3; ++jj) {
819 auto v = t_rhs_tmp(jj).imag();
820 t_res_dP(jj, ii) = v / eps;
821 }
822 }
823 } else {
824
825#ifdef ENABLE_PYTHON_BINDING
826 if (ContactOps::sdfPythonWeakPtr.lock()) {
828 t_cP(i, j) = (c * t_grad_sdf_v(i)) * t_grad_sdf_v(j);
829 t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
830 t_res_dP(i, j) = t_cQ(i, j);
831 } else {
832 t_res_dP(i, j) = t_kd(i, j);
833 }
834#else
835 t_res_dP(i, j) = t_kd(i, j);
836#endif
837 }
838
839 const double alpha = t_w / 2.;
840 size_t rr = 0;
841 for (; rr != nb_rows / 3; ++rr) {
842
843 auto t_mat = getFTensor2FromArray<3, 3, 3>(locMat, 3 * rr);
844 auto t_col_base = col_data.getFTensor1N<3>(gg, 0);
845
846 for (size_t cc = 0; cc != nb_cols / 3; ++cc) {
847 auto col_base = t_col_base(i) * t_material_normal(i);
848 const double beta = alpha * t_row_base * col_base;
849 t_mat(i, j) -= beta * t_res_dP(i, j);
850 ++t_col_base;
851 ++t_mat;
852 }
853
854 ++t_row_base;
855 }
856 for (; rr < nb_face_functions; ++rr)
857 ++t_row_base;
858
859 next();
860 }
861 }
862
864}
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 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)
Tensor2_Expr< Kronecker_Delta< T >, T, Dim0, Dim1, i, j > kronecker_delta(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
Rank 2.

Member Data Documentation

◆ commonDataPtr

template<AssemblyType A>
boost::shared_ptr<ContactOps::CommonData> EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS >::commonDataPtr
private

Definition at line 192 of file EshelbianContact.hpp.

◆ contactTreePtr

template<AssemblyType A>
boost::shared_ptr<ContactTree> EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS >::contactTreePtr
private

Definition at line 193 of file EshelbianContact.hpp.

◆ sdfMapRangePtr

template<AssemblyType A>
boost::shared_ptr<std::map<int, Range> > EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS >::sdfMapRangePtr
private

Definition at line 194 of file EshelbianContact.hpp.


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