669 {
670
672
673 using CachePhi = boost::tuple<int, int, MatrixDouble>;
674
675 CGGUserPolynomialBase(boost::shared_ptr<CachePhi> cache_phi = nullptr);
676 ~CGGUserPolynomialBase() = default;
677
678 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
679 BaseFunctionUnknownInterface **iface) const;
681 boost::shared_ptr<BaseFunctionCtx> ctx_ptr);
682
683private:
684 MatrixDouble shapeFun;
685 boost::shared_ptr<CachePhi> cachePhiPtr;
686
688};
689
690struct ContactTree;
691
699};
701
702using MatrixPtr = boost::shared_ptr<MatrixDouble>;
703using VectorPtr = boost::shared_ptr<VectorDouble>;
704
705using EntData = EntitiesFieldData::EntData;
708using FaceUserDataOperator = FaceElementForcesAndSourcesCore::UserDataOperator;
709using EleOnSide = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::FaceSideEle;
710using SideEleOp = EleOnSide::UserDataOperator;
711
712struct PhysicalEquations;
713
714struct AnalyticalExprPython;
715
717 : public boost::enable_shared_from_this<DataAtIntegrationPts> {
718
719 MatrixDouble approxPAtPts;
720 MatrixDouble approxSigmaAtPts;
721 MatrixDouble divPAtPts;
722 MatrixDouble divSigmaAtPts;
723 MatrixDouble wL2AtPts;
724 MatrixDouble wL2DotAtPts;
725 MatrixDouble wL2DotDotAtPts;
726 MatrixDouble logStretchTensorAtPts;
727 MatrixDouble stretchTensorAtPts;
728 VectorDouble jacobianAtPts;
729 MatrixDouble tractionAtPts;
730
731 MatrixDouble diffStretchTensorAtPts;
732 VectorDouble detStretchTensorAtPts;
733 MatrixDouble detStretchTensorAtPts_du;
734 MatrixDouble logStretchDotTensorAtPts;
735 MatrixDouble gradLogStretchDotTensorAtPts;
736 MatrixDouble rotAxisAtPts;
737 MatrixDouble rotAxisDotAtPts;
738 MatrixDouble rotAxisGradDotAtPts;
739 MatrixDouble rotAxis0AtPts;
740 MatrixDouble WAtPts;
741 MatrixDouble W0AtPts;
742 MatrixDouble GAtPts;
743 MatrixDouble G0AtPts;
744 MatrixDouble wH1AtPts;
745 MatrixDouble XH1AtPts;
746 MatrixDouble contactL2AtPts;
747 MatrixDouble wGradH1AtPts;
748 MatrixDouble logStretch2H1AtPts;
749 MatrixDouble logStretchTotalTensorAtPts;
750
751 MatrixDouble hAtPts;
752 MatrixDouble hdOmegaAtPts;
753 MatrixDouble hdLogStretchAtPts;
754 MatrixDouble leviKirchhoffAtPts;
755 MatrixDouble leviKirchhoffdOmegaAtPts;
756 MatrixDouble leviKirchhoffdLogStreatchAtPts;
757 MatrixDouble leviKirchhoffPAtPts;
758 MatrixDouble adjointPdstretchAtPts;
759 MatrixDouble adjointPdUAtPts;
760 MatrixDouble adjointPdUdOmegaAtPts;
761 MatrixDouble adjointPdUdPAtPts;
762 MatrixDouble rotMatAtPts;
763 MatrixDouble PAtPts;
764 MatrixDouble SigmaAtPts;
765 VectorDouble energyAtPts;
766 MatrixDouble flowL2AtPts;
767
768 MatrixDouble varRotAxis;
769 MatrixDouble varLogStreach;
770 MatrixDouble varPiola;
771 MatrixDouble varDivPiola;
772 MatrixDouble varWL2;
773
774 MatrixDouble P_du;
775
776 MatrixDouble eigenVals;
777 MatrixDouble eigenVecs;
778 VectorInt nbUniq;
779 MatrixDouble eigenValsC;
780 MatrixDouble eigenVecsC;
781 VectorInt nbUniqC;
782
783 MatrixDouble matD;
784 MatrixDouble matAxiatorD;
785 MatrixDouble matDeviatorD;
786 MatrixDouble matInvD;
787
788 MatrixDouble internalStressAtPts;
789
790 MatrixDouble facePiolaAtPts;
791 MatrixDouble gradHybridDispAtPts;
792 MatrixDouble faceMaterialForceAtPts;
793 VectorDouble normalPressureAtPts;
794
797 double piolaScale = 1.;
798 double faceEnergy = 0.;
799
800 inline auto getPiolaScalePtr() {
801 return boost::shared_ptr<double>(shared_from_this(), &piolaScale);
802 }
803
805 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
806 &approxSigmaAtPts);
807 }
809 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &approxPAtPts);
810 }
811
813 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divPAtPts);
814 }
815
817 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divSigmaAtPts);
818 }
819
821 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2AtPts);
822 }
823
825 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotAtPts);
826 }
827
828 inline MatrixPtr getSmallWL2DotDotAtPts() {
829 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotDotAtPts);
830 }
831
832 inline MatrixPtr getLogStretchTensorAtPts() {
833 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
834 &logStretchTensorAtPts);
835 }
836
837 inline MatrixPtr getStretchTensorAtPts() {
838 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
839 &stretchTensorAtPts);
840 }
841
842 inline MatrixPtr getLogStretchDotTensorAtPts() {
843 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
844 &logStretchDotTensorAtPts);
845 }
846
847 inline MatrixPtr getGradLogStretchDotTensorAtPts() {
848 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
849 &gradLogStretchDotTensorAtPts);
850 }
851
853 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxisAtPts);
854 }
855
857 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxis0AtPts);
858 }
859
861 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
862 &rotAxisDotAtPts);
863 }
864
865 inline MatrixPtr getRotAxisGradDotAtPts() {
866 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
867 &rotAxisGradDotAtPts);
868 }
869
871 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
872 }
873
875 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
876 }
877
879 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matD);
880 }
881
883 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matInvD);
884 }
885
887 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matAxiatorD);
888 }
889
891 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matDeviatorD);
892 }
893
895 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wH1AtPts);
896 }
897
899 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &XH1AtPts);
900 }
901
903 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &contactL2AtPts);
904 }
905
906 inline MatrixPtr getSmallWGradH1AtPts() {
907 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wGradH1AtPts);
908 }
909
911 return boost::shared_ptr<VectorDouble>(shared_from_this(), &jacobianAtPts);
912 }
913
914 inline MatrixPtr getLeviKirchhoffAtPts() {
915 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
916 &leviKirchhoffAtPts);
917 };
918
920 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varRotAxis);
921 }
922
924 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varLogStreach);
925 }
926
928 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varPiola);
929 }
930
932 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varDivPiola);
933 }
934
936 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varWL2);
937 }
938
939 inline MatrixPtr getInternalStressAtPts() {
940 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
941 &internalStressAtPts);
942 }
943
945 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &facePiolaAtPts);
946 }
947
948 inline MatrixPtr getGradHybridDispAtPts() {
949 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
950 &gradHybridDispAtPts);
951 }
952
954 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &eigenVals);
955 }
956
957 boost::shared_ptr<PhysicalEquations> physicsPtr;
958};
959
961
962
963struct ExternalStrain;
965struct PhysicalEquations {
966
973
975
978
979 PhysicalEquations() = delete;
980 PhysicalEquations(const int size_active, const int size_dependent)
981 : activeVariables(size_active, 0),
982 dependentVariablesPiola(size_dependent, 0),
983 dependentVariablesPiolaDirevatives(size_dependent * size_active, 0) {}
984 virtual ~PhysicalEquations() = default;
985
986 virtual MoFEMErrorCode recordTape(
const int tag, DTensor2Ptr *t_h) = 0;
987
989 returnOpJacobian(const int tag, const bool eval_rhs, const bool eval_lhs,
990 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
991 boost::shared_ptr<PhysicalEquations> physics_ptr);
992
994 returnOpSpatialPhysical(
const std::string &
field_name,
995 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
996 const double alpha_u);
997
999 returnOpSpatialPhysicalExternalStrain(
1001 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1002 boost::shared_ptr<ExternalStrainVec> external_strain_vec_ptr,
1003 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv);
1004
1006 std::string row_field, std::string col_field,
1007 boost::shared_ptr<DataAtIntegrationPts> data_ptr, const double alpha);
1008
1010 returnOpCalculateEnergy(boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1011 boost::shared_ptr<double> total_energy_ptr);
1012
1014 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1015 boost::shared_ptr<PhysicalEquations> physics_ptr);
1016
1018 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1019 boost::shared_ptr<PhysicalEquations> physics_ptr);
1020
1022 returnOpSetScale(boost::shared_ptr<double> scale_ptr,
1023 boost::shared_ptr<PhysicalEquations> physics_ptr);
1024
1025 std::vector<double> activeVariables;
1026 std::vector<double> dependentVariablesPiola;
1027 std::vector<double> dependentVariablesPiolaDirevatives;
1028
1029
1030
1031
1032
1033 template <int S>
1034 inline static DTensor2Ptr get_VecTensor2(std::vector<double> &
v) {
1035 return DTensor2Ptr(&
v[S + 0], &
v[S + 1], &
v[S + 2], &
v[S + 3], &
v[S + 4],
1036 &
v[S + 5], &
v[S + 6], &
v[S + 7], &
v[S + 8]);
1037 }
1038
1039 template <int S>
1040 inline static DTensor0Ptr get_VecTensor0(std::vector<double> &
v) {
1041 return DTensor0Ptr(&
v[S + 0]);
1042 }
1043
1044 template <int S0>
1045 inline static DTensor3Ptr get_vecTensor3(std::vector<double> &
v,
1046 const int nba) {
1047
1048 const int A00 = nba * 0 + S0;
1049 const int A01 = nba * 1 + S0;
1050 const int A02 = nba * 2 + S0;
1051 const int A10 = nba * 3 + S0;
1052 const int A11 = nba * 4 + S0;
1053 const int A12 = nba * 5 + S0;
1054 const int A20 = nba * 6 + S0;
1055 const int A21 = nba * 7 + S0;
1056 const int A22 = nba * 8 + S0;
1057
1058 return DTensor3Ptr(
1059
1060 &
v[A00 + 0], &
v[A00 + 1], &
v[A00 + 2], &
v[A01 + 0], &
v[A01 + 1],
1061 &
v[A01 + 2], &
v[A02 + 0], &
v[A02 + 1], &
v[A02 + 2],
1062
1063 &
v[A10 + 0], &
v[A10 + 1], &
v[A10 + 2], &
v[A11 + 0], &
v[A11 + 1],
1064 &
v[A11 + 2], &
v[A12 + 0], &
v[A12 + 1], &
v[A12 + 2],
1065
1066 &
v[A20 + 0], &
v[A20 + 1], &
v[A20 + 2], &
v[A21 + 0], &
v[A21 + 1],
1067 &
v[A21 + 2], &
v[A22 + 0], &
v[A22 + 1], &
v[A22 + 2]
1068
1069 );
1070 }
1071
1072
1073
1074
1075
1076
1077
1078 inline DTensor2Ptr get_h() { return get_VecTensor2<0>(activeVariables); }
1079
1080
1081
1082
1083
1084
1085
1086 inline DTensor2Ptr get_P() {
1087 return get_VecTensor2<0>(dependentVariablesPiola);
1088 }
1089
1090
1091
1092
1093
1094
1095
1096 inline DTensor3Ptr get_P_dh0() {
1097 return get_vecTensor3<0>(dependentVariablesPiolaDirevatives,
1098 activeVariables.size());
1099 }
1100 inline DTensor3Ptr get_P_dh1() {
1101 return get_vecTensor3<3>(dependentVariablesPiolaDirevatives,
1102 activeVariables.size());
1103 }
1104 inline DTensor3Ptr get_P_dh2() {
1105 return get_vecTensor3<6>(dependentVariablesPiolaDirevatives,
1106 activeVariables.size());
1107 }
1108
1109
1110};
1111
1112struct BcDisp {
1113 BcDisp(std::string name, std::vector<double> attr,
Range faces);
1114 std::string blockName;
1116 VectorDouble3 vals;
1117 VectorInt3 flags;
1118};
1120
1121struct BcRot {
1122 BcRot(std::string name, std::vector<double> attr,
Range faces);
1123 std::string blockName;
1125 VectorDouble vals;
1126 double theta;
1127};
1128using BcRotVec = std::vector<BcRot>;
1129
1131
1132struct TractionBc {
1133 TractionBc(std::string name, std::vector<double> attr,
Range faces);
1134 std::string blockName;
1136 VectorDouble3 vals;
1137 VectorInt3 flags;
1138};
1140
1141struct NormalDisplacementBc {
1142 NormalDisplacementBc(std::string name, std::vector<double> attr,
Range faces);
1143 std::string blockName;
1145 double val;
1146};
1148
1149struct AnalyticalDisplacementBc {
1150 AnalyticalDisplacementBc(std::string name, std::vector<double> attr,
1152 std::string blockName;
1154 VectorInt3 flags;
1155};
1157
1158struct AnalyticalTractionBc {
1159 AnalyticalTractionBc(std::string name, std::vector<double> attr,
Range faces);
1160 std::string blockName;
1162 VectorInt3 flags;
1163};
1165
1166struct PressureBc {
1167 PressureBc(std::string name, std::vector<double> attr,
Range faces);
1168 std::string blockName;
1170 double val;
1171};
1173
1174struct ExternalStrain {
1175 ExternalStrain(std::string name, std::vector<double> attr,
Range ents);
1176 std::string blockName;
1178 double val;
1179 double bulkModulusK;
1180};
1181
1182 #ifdef ENABLE_PYTHON_BINDING
1183struct AnalyticalExprPython {
1184 AnalyticalExprPython() = default;
1185 virtual ~AnalyticalExprPython() = default;
1186
1188 MoFEMErrorCode evalAnalyticalDisp(
double delta_t,
double t, np::ndarray x,
1189 np::ndarray y, np::ndarray z,
1190 np::ndarray nx, np::ndarray ny,
1191 np::ndarray nz,
1192 const std::string &block_name,
1193 np::ndarray &analytical_expr);
1194 MoFEMErrorCode evalAnalyticalTraction(
double delta_t,
double t, np::ndarray x,
1195 np::ndarray y, np::ndarray z,
1196 np::ndarray nx, np::ndarray ny,
1197 np::ndarray nz,
1198 const std::string &block_name,
1199 np::ndarray &analytical_expr);
1200
1201 template <typename T>
1202 inline std::vector<T>
1203 py_list_to_std_vector(const boost::python::object &iterable) {
1204 return std::vector<T>(boost::python::stl_input_iterator<T>(iterable),
1205 boost::python::stl_input_iterator<T>());
1206 }
1207
1208private:
1209 bp::object mainNamespace;
1210 bp::object analyticalDispFun;
1211 bp::object analyticalTractionFun;
1212};
1213
1214extern boost::weak_ptr<AnalyticalExprPython> AnalyticalExprPythonWeakPtr;
1215 #endif
1216
1219
1220}
1221
1222#endif
ForcesAndSourcesCore::UserDataOperator UserDataOperator
const double v
phase velocity of light in medium (cm/ns)
boost::shared_ptr< VectorDouble > VectorPtr
std::vector< AnalyticalTractionBc > AnalyticalTractionBcVec
std::vector< BcDisp > BcDispVec
std::vector< NormalDisplacementBc > NormalDisplacementBcVec
std::vector< BcRot > BcRotVec
std::vector< ExternalStrain > ExternalStrainVec
std::vector< AnalyticalDisplacementBc > AnalyticalDisplacementBcVec
std::vector< Range > TractionFreeBc
std::vector< PressureBc > PressureBcVec
std::vector< TractionBc > TractionBcVec
boost::shared_ptr< MatrixDouble > MatrixPtr
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
constexpr double t
plate stiffness
constexpr auto field_name
PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::FaceSideEle EleOnSide
Data on single entity (This is passed as argument to DataOperator::doWork)