v0.16.0
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 750 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 767 of file EshelbianContact.cpp.

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

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

◆ contactTreePtr

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

Definition at line 763 of file EshelbianContact.cpp.

◆ sdfMapRangePtr

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

Definition at line 764 of file EshelbianContact.cpp.


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