v0.15.5
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU Struct Reference
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

Definition at line 746 of file EshelbianContact.cpp.

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

768 : ContactOps::AssemblyBoundaryEleOp(row_field_name, col_field_name,
769 ContactOps::BoundaryEleOp::OPROWCOL),
770 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
771 sdfMapRangePtr(sdf_map_range_ptr) {
772
773 sYmm = false;
774}
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 777 of file EshelbianContact.cpp.

778 {
780
781 using namespace ContactOps;
782
783 FTensor::Index<'i', 3> i;
784 FTensor::Index<'j', 3> j;
785 FTensor::Index<'k', 3> k;
786
787 auto nb_rows = row_data.getIndices().size();
788 auto nb_cols = col_data.getIndices().size();
789
790 auto &locMat = AssemblyBoundaryEleOp::locMat;
791 locMat.resize(nb_rows, nb_cols, false);
792 locMat.clear();
793
794 if (nb_cols && nb_rows) {
795
796 auto nb_gauss_pts = getGaussPts().size2();
797 auto t_w = getFTensor0IntegrationWeight();
798 auto t_coords = getFTensor1CoordsAtGaussPts();
799 auto t_disp = getFTensor1FromMat<3>(commonDataPtr->contactDisp);
800 auto t_traction = getFTensor1FromMat<3>(commonDataPtr->contactTraction);
801
802 // placeholder to pass boundary block id to python
803 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
804 getSdf(this, commonDataPtr->contactDisp,
805 checkSdf(getFEEntityHandle(), *sdfMapRangePtr), true);
806
807 auto t_sdf_v = getFTensor0FromVec(v_sdf);
808 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
809 auto t_hess_sdf_v = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
810 auto t_normalized_normal = getFTensor1FromMat<3>(m_normals_at_pts);
811
812 auto next = [&]() {
813 ++t_w;
814 ++t_coords;
815 ++t_disp;
816 ++t_traction;
817 ++t_sdf_v;
818 ++t_grad_sdf_v;
819 ++t_hess_sdf_v;
820 ++t_normalized_normal;
821 };
822
823 auto face_data_vec_ptr =
824 contactTreePtr->findFaceDataVecPtr(getFEEntityHandle());
825 auto face_gauss_pts_it = face_data_vec_ptr->begin();
826
827 auto t_row_base = row_data.getFTensor0N();
828 auto nb_face_functions = row_data.getN().size2() / 3;
829 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
830
831 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
832
833 auto face_data_ptr = contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
834 face_data_vec_ptr);
835
836 auto check_face_contact = [&]() {
837 if (checkSdf(getFEEntityHandle(), *sdfMapRangePtr) != -1)
838 return false;
839
840 if (face_data_ptr) {
841 return true;
842 }
843 return false;
844 };
845
847
848#ifdef ENABLE_PYTHON_BINDING
849 double c = 0.;
850 if (ContactOps::sdfPythonWeakPtr.lock()) {
851 auto tn = t_traction(i) * t_grad_sdf_v(i);
852 c = ContactOps::constrain(t_sdf_v, tn);
853 }
854#else
855 constexpr double c = 0;
856#endif
857
858 if (!c && check_face_contact()) {
859 FTensor::Tensor1<double, 3> t_spatial_coords;
860 t_spatial_coords(i) = t_coords(i) + t_disp(i);
861 constexpr double eps = std::numeric_limits<float>::epsilon();
862 for (auto ii = 0; ii < 3; ++ii) {
863 FTensor::Tensor1<std::complex<double>, 3> t_spatial_coords_cx{
864 t_spatial_coords(0), t_spatial_coords(1), t_spatial_coords(2)};
865 t_spatial_coords_cx(ii) += eps * 1i;
866 auto t_rhs_tmp =
867 multiPointRhs(face_data_ptr, t_coords, t_spatial_coords_cx,
868 t_traction, MultiPointRhsType::U);
869 for (int jj = 0; jj != 3; ++jj) {
870 auto v = t_rhs_tmp(jj).imag();
871 t_res_dU(jj, ii) = v / eps;
872 }
873 }
874
875 } else {
876
877#ifdef ENABLE_PYTHON_BINDING
878
879 if (ContactOps::sdfPythonWeakPtr.lock()) {
880 auto inv_cn = 1. / ContactOps::cn_contact;
881 t_res_dU(i, j) =
882
883 (-c) * (t_hess_sdf_v(i, j) * t_grad_sdf_v(k) * t_traction(k) +
884 t_grad_sdf_v(i) * t_hess_sdf_v(k, j) * t_traction(k))
885
886 + (c * inv_cn) * (t_sdf_v * t_hess_sdf_v(i, j) +
887
888 t_grad_sdf_v(j) * t_grad_sdf_v(i));
889 } else {
890 t_res_dU(i, j) = 0;
891 }
892#else
893 t_res_dU(i, j) = 0;
894#endif
895 }
896
897 auto alpha = t_w * getMeasure();
898
899 size_t rr = 0;
900 for (; rr != nb_rows / 3; ++rr) {
901
902 auto t_mat = getFTensor2FromArray<3, 3, 3>(locMat, 3 * rr);
903 auto t_col_base = col_data.getFTensor0N(gg, 0);
904
905 for (size_t cc = 0; cc != nb_cols / 3; ++cc) {
906 auto beta = alpha * t_row_base * t_col_base;
907 t_mat(i, j) -= beta * t_res_dU(i, j);
908 ++t_col_base;
909 ++t_mat;
910 }
911
912 ++t_row_base;
913 }
914 for (; rr < nb_face_functions; ++rr)
915 ++t_row_base;
916
917 next();
918 }
919 }
920
922}
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 cn_contact
Definition contact.cpp:97
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)
static auto getFTensor0FromVec(ublas::vector< T, A > &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....
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.

Member Data Documentation

◆ commonDataPtr

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

Definition at line 758 of file EshelbianContact.cpp.

◆ contactTreePtr

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

Definition at line 759 of file EshelbianContact.cpp.

◆ sdfMapRangePtr

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

Definition at line 760 of file EshelbianContact.cpp.


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