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

785 : ContactOps::AssemblyBoundaryEleOp(row_field_name, col_field_name,
786 ContactOps::BoundaryEleOp::OPROWCOL),
787 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
788 sdfMapRangePtr(sdf_map_range_ptr) {
789
790 sYmm = false;
791}
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 794 of file EshelbianContact.cpp.

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

◆ contactTreePtr

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

Definition at line 776 of file EshelbianContact.cpp.

◆ sdfMapRangePtr

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

Definition at line 777 of file EshelbianContact.cpp.


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