v0.16.3
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::CommonData > commonDataPtr
 
boost::shared_ptr< ContactTree > contactTreePtr
 
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
 

Detailed Description

Definition at line 754 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 771 of file EshelbianContact.cpp.

776 : ContactOps::AssemblyBoundaryEleOp(row_field_name, col_field_name,
777 ContactOps::BoundaryEleOp::OPROWCOL),
778 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
779 sdfMapRangePtr(sdf_map_range_ptr) {
780
781 sYmm = false;
782}
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 785 of file EshelbianContact.cpp.

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

◆ contactTreePtr

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

Definition at line 767 of file EshelbianContact.cpp.

◆ sdfMapRangePtr

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

Definition at line 768 of file EshelbianContact.cpp.


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