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

763 : ContactOps::AssemblyBoundaryEleOp(row_field_name, col_field_name,
764 ContactOps::BoundaryEleOp::OPROWCOL),
765 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
766 sdfMapRangePtr(sdf_map_range_ptr) {
767
768 sYmm = false;
769}
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 772 of file EshelbianContact.cpp.

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

◆ contactTreePtr

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

Definition at line 754 of file EshelbianContact.cpp.

◆ sdfMapRangePtr

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

Definition at line 755 of file EshelbianContact.cpp.


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