v0.16.3
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dP< A, IntegrationType::GAUSS > Struct Template Reference
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::CommonData > commonDataPtr
 
boost::shared_ptr< ContactTree > contactTreePtr
 
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
 

Detailed Description

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

Definition at line 933 of file EshelbianContact.cpp.

Member Typedef Documentation

◆ OP

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

Definition at line 936 of file EshelbianContact.cpp.

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 956 of file EshelbianContact.cpp.

964 : OP(row_field_name, broken_base_side_data, false, false),
965 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
966 sdfMapRangePtr(sdf_map_range_ptr) {
967 OP::sYmm = false;
968}
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 972 of file EshelbianContact.cpp.

974 {
976
977 using namespace ContactOps;
978
979 FTensor::Index<'i', 3> i;
980 FTensor::Index<'j', 3> j;
981 FTensor::Index<'k', 3> k;
982
983 auto nb_rows = row_data.getIndices().size();
984 auto nb_cols = col_data.getIndices().size();
985
986 auto &locMat = AssemblyBoundaryEleOp::locMat;
987 locMat.resize(nb_rows, nb_cols, false);
988 locMat.clear();
989
990 if (nb_cols && nb_rows) {
991
992 const size_t nb_gauss_pts = OP::getGaussPts().size2();
993
994 auto t_w = OP::getFTensor0IntegrationWeight();
995 auto t_disp = getFTensor1FromMat<3>(commonDataPtr->contactDisp);
996 auto t_traction = getFTensor1FromMat<3>(commonDataPtr->contactTraction);
997 auto t_coords = OP::getFTensor1CoordsAtGaussPts();
998 auto t_material_normal = OP::getFTensor1NormalsAtGaussPts();
999
1000 // placeholder to pass boundary block id to python
1001 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
1002 getSdf(this, commonDataPtr->contactDisp,
1003 checkSdf(OP::getFEEntityHandle(), *sdfMapRangePtr), false);
1004
1005 auto t_sdf_v = getFTensor0FromVec(v_sdf);
1006 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
1007
1008 auto next = [&]() {
1009 ++t_w;
1010 ++t_disp;
1011 ++t_traction;
1012 ++t_coords;
1013 ++t_material_normal;
1014 ++t_sdf_v;
1015 ++t_grad_sdf_v;
1016 };
1017
1018 auto face_data_vec_ptr =
1019 contactTreePtr->findFaceDataVecPtr(OP::getFEEntityHandle());
1020 auto face_gauss_pts_it = face_data_vec_ptr->begin();
1021
1022 auto t_row_base = row_data.getFTensor0N();
1023 auto nb_face_functions = row_data.getN().size2();
1024
1025 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
1026
1027 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1028
1029 auto face_data_ptr = contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
1030 face_data_vec_ptr);
1031
1032 auto check_face_contact = [&]() {
1033 if (checkSdf(OP::getFEEntityHandle(), *sdfMapRangePtr) != -1)
1034 return false;
1035
1036 if (face_data_ptr) {
1037 return true;
1038 }
1039 return false;
1040 };
1041
1043
1044#ifdef ENABLE_PYTHON_BINDING
1045 double c = 0.;
1046 if (ContactOps::sdfPythonWeakPtr.lock()) {
1047 auto tn = t_traction(i) * t_grad_sdf_v(i);
1048 c = ContactOps::constrain(t_sdf_v, tn);
1049 }
1050#else
1051 constexpr double c = 0;
1052#endif
1053
1054 if (!c && check_face_contact()) {
1055 FTensor::Tensor1<double, 3> t_spatial_coords;
1056 t_spatial_coords(i) = t_coords(i) + t_disp(i);
1057 constexpr double eps = std::numeric_limits<float>::epsilon();
1058 for (auto ii = 0; ii != 3; ++ii) {
1059 FTensor::Tensor1<std::complex<double>, 3> t_traction_cx{
1060 t_traction(0), t_traction(1), t_traction(2)};
1061 t_traction_cx(ii) += eps * 1i;
1062 auto t_rhs_tmp =
1063 multiPointRhs(face_data_ptr, t_coords, t_spatial_coords,
1064 t_traction_cx, MultiPointRhsType::U);
1065 for (int jj = 0; jj != 3; ++jj) {
1066 auto v = t_rhs_tmp(jj).imag();
1067 t_res_dP(jj, ii) = v / eps;
1068 }
1069 }
1070 } else {
1071
1072#ifdef ENABLE_PYTHON_BINDING
1073 if (ContactOps::sdfPythonWeakPtr.lock()) {
1075 t_cP(i, j) = (c * t_grad_sdf_v(i)) * t_grad_sdf_v(j);
1076 t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
1077 t_res_dP(i, j) = t_cQ(i, j);
1078 } else {
1079 t_res_dP(i, j) = t_kd(i, j);
1080 }
1081#else
1082 t_res_dP(i, j) = t_kd(i, j);
1083#endif
1084 }
1085
1086 const double alpha = t_w / 2.;
1087 size_t rr = 0;
1088 for (; rr != nb_rows / 3; ++rr) {
1089
1090 auto t_mat = getFTensor2FromArray<3, 3, 3>(locMat, 3 * rr);
1091 auto t_col_base = col_data.getFTensor1N<3>(gg, 0);
1092
1093 for (size_t cc = 0; cc != nb_cols / 3; ++cc) {
1094 auto col_base = t_col_base(i) * t_material_normal(i);
1095 const double beta = alpha * t_row_base * col_base;
1096 t_mat(i, j) -= beta * t_res_dP(i, j);
1097 ++t_col_base;
1098 ++t_mat;
1099 }
1100
1101 ++t_row_base;
1102 }
1103 for (; rr < nb_face_functions; ++rr)
1104 ++t_row_base;
1105
1106 next();
1107 }
1108 }
1109
1111}
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.
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
auto getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.

Member Data Documentation

◆ commonDataPtr

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

Definition at line 950 of file EshelbianContact.cpp.

◆ contactTreePtr

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

Definition at line 951 of file EshelbianContact.cpp.

◆ sdfMapRangePtr

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

Definition at line 952 of file EshelbianContact.cpp.


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