v0.15.4
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)
 Integrate grad-grad operator.
 
- Public Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
 OpBaseImpl (const std::string row_field_name, const std::string col_field_name, const OpType type, boost::shared_ptr< Range > ents_ptr=nullptr)
 Constructor for base operator implementation.
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 Do calculations for the left hand side.
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntData &row_data)
 Do calculations for the right hand side.
 

Private Attributes

boost::shared_ptr< ContactOps::CommonDatacommonDataPtr
 
boost::shared_ptr< ContactTreecontactTreePtr
 
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
 

Additional Inherited Members

- Public Types inherited from MoFEM::OpBaseImpl< A, EleOp >
using OpType = typename EleOp::OpType
 
using EntData = EntitiesFieldData::EntData
 
using MatSetValuesHook = boost::function< MoFEMErrorCode(ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)>
 
- Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
TimeFun timeScalingFun
 assumes that time variable is set
 
FEFun feScalingFun
 set by fe entity handle
 
boost::shared_ptr< RangeentsPtr
 Entities on which element is run.
 
- Static Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
static MatSetValuesHook matSetValuesHook
 
- Protected Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
template<int DIM>
FTensor::Tensor1< FTensor::PackPtr< double *, DIM >, DIM > getNf ()
 Get local vector tensor for assembly.
 
template<int DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, DIM >, DIM, DIM > getLocMat (const int rr)
 Get local matrix tensor for assembly.
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data, const bool trans)
 Assemble local matrix into global matrix.
 
virtual MoFEMErrorCode iNtegrate (EntData &data)
 Class dedicated to integrate operator.
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 Assemble local vector into global vector.
 
virtual size_t getNbOfBaseFunctions (EntitiesFieldData::EntData &data)
 Get number of base functions.
 
- Protected Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
int nbRows
 number of dofs on rows
 
int nbCols
 number if dof on column
 
int nbIntegrationPts
 number of integration points
 
int nbRowBaseFunctions
 number or row base functions
 
int rowSide
 row side number
 
int colSide
 column side number
 
EntityType rowType
 row type
 
EntityType colType
 column type
 
bool assembleTranspose
 
bool onlyTranspose
 
MatrixDouble locMat
 local entity block matrix
 
MatrixDouble locMatTranspose
 local entity block matrix
 
VectorDouble locF
 local entity vector
 

Detailed Description

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

770 : ContactOps::AssemblyBoundaryEleOp(row_field_name, col_field_name,
771 ContactOps::BoundaryEleOp::OPROWCOL),
772 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
773 sdfMapRangePtr(sdf_map_range_ptr) {
774
775 sYmm = false;
776}
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 
)
virtual

Integrate grad-grad operator.

Parameters
row_datarow data (consist base functions on row entity)
col_datacolumn data (consist base functions on column entity)
Returns
error code

Reimplemented from MoFEM::OpBaseImpl< A, EleOp >.

Definition at line 779 of file EshelbianContact.cpp.

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

Member Data Documentation

◆ commonDataPtr

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

Definition at line 760 of file EshelbianContact.cpp.

◆ contactTreePtr

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

Definition at line 761 of file EshelbianContact.cpp.

◆ sdfMapRangePtr

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

Definition at line 762 of file EshelbianContact.cpp.


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