648 {
649
651
652 using CachePhi = boost::tuple<int, int, MatrixDouble>;
653
654 CGGUserPolynomialBase(boost::shared_ptr<CachePhi> cache_phi = nullptr);
655 ~CGGUserPolynomialBase() = default;
656
657 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
658 BaseFunctionUnknownInterface **iface) const;
660 boost::shared_ptr<BaseFunctionCtx> ctx_ptr);
661
662private:
663 MatrixDouble shapeFun;
664 boost::shared_ptr<CachePhi> cachePhiPtr;
665
667};
668
669struct ContactTree;
670
678};
680
681using MatrixPtr = boost::shared_ptr<MatrixDouble>;
682using VectorPtr = boost::shared_ptr<VectorDouble>;
683
684using EntData = EntitiesFieldData::EntData;
687using FaceUserDataOperator = FaceElementForcesAndSourcesCore::UserDataOperator;
688using EleOnSide = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::FaceSideEle;
689using SideEleOp = EleOnSide::UserDataOperator;
690
691struct PhysicalEquations;
692
693struct AnalyticalExprPython;
694
696 : public boost::enable_shared_from_this<DataAtIntegrationPts> {
697
698 MatrixDouble approxPAtPts;
699 MatrixDouble approxSigmaAtPts;
700 MatrixDouble divPAtPts;
701 MatrixDouble divSigmaAtPts;
702 MatrixDouble wL2AtPts;
703 MatrixDouble wL2DotAtPts;
704 MatrixDouble wL2DotDotAtPts;
705 MatrixDouble logStretchTensorAtPts;
706 MatrixDouble stretchTensorAtPts;
707 VectorDouble jacobianAtPts;
708 MatrixDouble tractionAtPts;
709
710 MatrixDouble diffStretchTensorAtPts;
711 VectorDouble detStretchTensorAtPts;
712 MatrixDouble detStretchTensorAtPts_du;
713 MatrixDouble logStretchDotTensorAtPts;
714 MatrixDouble gradLogStretchDotTensorAtPts;
715 MatrixDouble rotAxisAtPts;
716 MatrixDouble rotAxisDotAtPts;
717 MatrixDouble rotAxisGradDotAtPts;
718 MatrixDouble rotAxis0AtPts;
719 MatrixDouble WAtPts;
720 MatrixDouble W0AtPts;
721 MatrixDouble GAtPts;
722 MatrixDouble G0AtPts;
723 MatrixDouble wH1AtPts;
724 MatrixDouble XH1AtPts;
725 MatrixDouble contactL2AtPts;
726 MatrixDouble wGradH1AtPts;
727 MatrixDouble logStretch2H1AtPts;
728 MatrixDouble logStretchTotalTensorAtPts;
729
730 MatrixDouble hAtPts;
731 MatrixDouble hdOmegaAtPts;
732 MatrixDouble hdLogStretchAtPts;
733 MatrixDouble leviKirchhoffAtPts;
734 MatrixDouble leviKirchhoffdOmegaAtPts;
735 MatrixDouble leviKirchhoffdLogStreatchAtPts;
736 MatrixDouble leviKirchhoffPAtPts;
737 MatrixDouble adjointPdstretchAtPts;
738 MatrixDouble adjointPdUAtPts;
739 MatrixDouble adjointPdUdOmegaAtPts;
740 MatrixDouble adjointPdUdPAtPts;
741 MatrixDouble rotMatAtPts;
742 MatrixDouble PAtPts;
743 MatrixDouble SigmaAtPts;
744 VectorDouble energyAtPts;
745 MatrixDouble flowL2AtPts;
746
747 MatrixDouble varRotAxis;
748 MatrixDouble varLogStreach;
749 MatrixDouble varPiola;
750 MatrixDouble varDivPiola;
751 MatrixDouble varWL2;
752
753 MatrixDouble P_du;
754
755 MatrixDouble eigenVals;
756 MatrixDouble eigenVecs;
757 VectorInt nbUniq;
758 MatrixDouble eigenValsC;
759 MatrixDouble eigenVecsC;
760 VectorInt nbUniqC;
761
762 MatrixDouble matD;
763 MatrixDouble matAxiatorD;
764 MatrixDouble matDeviatorD;
765 MatrixDouble matInvD;
766
767 MatrixDouble internalStressAtPts;
768
769 MatrixDouble facePiolaAtPts;
770 MatrixDouble gradHybridDispAtPts;
771 MatrixDouble faceMaterialForceAtPts;
772 VectorDouble normalPressureAtPts;
773
776 double piolaScale = 1.;
777 double faceEnergy = 0.;
778
779 inline auto getPiolaScalePtr() {
780 return boost::shared_ptr<double>(shared_from_this(), &piolaScale);
781 }
782
784 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
785 &approxSigmaAtPts);
786 }
788 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &approxPAtPts);
789 }
790
792 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divPAtPts);
793 }
794
796 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divSigmaAtPts);
797 }
798
800 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2AtPts);
801 }
802
804 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotAtPts);
805 }
806
807 inline MatrixPtr getSmallWL2DotDotAtPts() {
808 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotDotAtPts);
809 }
810
811 inline MatrixPtr getLogStretchTensorAtPts() {
812 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
813 &logStretchTensorAtPts);
814 }
815
816 inline MatrixPtr getStretchTensorAtPts() {
817 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
818 &stretchTensorAtPts);
819 }
820
821 inline MatrixPtr getLogStretchDotTensorAtPts() {
822 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
823 &logStretchDotTensorAtPts);
824 }
825
826 inline MatrixPtr getGradLogStretchDotTensorAtPts() {
827 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
828 &gradLogStretchDotTensorAtPts);
829 }
830
832 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxisAtPts);
833 }
834
836 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxis0AtPts);
837 }
838
840 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
841 &rotAxisDotAtPts);
842 }
843
844 inline MatrixPtr getRotAxisGradDotAtPts() {
845 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
846 &rotAxisGradDotAtPts);
847 }
848
850 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
851 }
852
854 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
855 }
856
858 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matD);
859 }
860
862 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matInvD);
863 }
864
866 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matAxiatorD);
867 }
868
870 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matDeviatorD);
871 }
872
874 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wH1AtPts);
875 }
876
878 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &XH1AtPts);
879 }
880
882 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &contactL2AtPts);
883 }
884
885 inline MatrixPtr getSmallWGradH1AtPts() {
886 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wGradH1AtPts);
887 }
888
890 return boost::shared_ptr<VectorDouble>(shared_from_this(), &jacobianAtPts);
891 }
892
893 inline MatrixPtr getLeviKirchhoffAtPts() {
894 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
895 &leviKirchhoffAtPts);
896 };
897
899 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varRotAxis);
900 }
901
903 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varLogStreach);
904 }
905
907 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varPiola);
908 }
909
911 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varDivPiola);
912 }
913
915 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varWL2);
916 }
917
918 inline MatrixPtr getInternalStressAtPts() {
919 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
920 &internalStressAtPts);
921 }
922
924 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &facePiolaAtPts);
925 }
926
927 inline MatrixPtr getGradHybridDispAtPts() {
928 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
929 &gradHybridDispAtPts);
930 }
931
933 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &eigenVals);
934 }
935
936 boost::shared_ptr<PhysicalEquations> physicsPtr;
937};
938
940
941
942struct ExternalStrain;
944struct PhysicalEquations {
945
952
954
957
958 PhysicalEquations() = delete;
959 PhysicalEquations(const int size_active, const int size_dependent)
960 : activeVariables(size_active, 0),
961 dependentVariablesPiola(size_dependent, 0),
962 dependentVariablesPiolaDirevatives(size_dependent * size_active, 0) {}
963 virtual ~PhysicalEquations() = default;
964
965 virtual MoFEMErrorCode recordTape(
const int tag, DTensor2Ptr *t_h) = 0;
966
968 returnOpJacobian(const int tag, const bool eval_rhs, const bool eval_lhs,
969 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
970 boost::shared_ptr<PhysicalEquations> physics_ptr);
971
973 returnOpSpatialPhysical(
const std::string &
field_name,
974 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
975 const double alpha_u);
976
978 returnOpSpatialPhysicalExternalStrain(
980 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
981 boost::shared_ptr<ExternalStrainVec> external_strain_vec_ptr,
982 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv);
983
985 std::string row_field, std::string col_field,
986 boost::shared_ptr<DataAtIntegrationPts> data_ptr, const double alpha);
987
989 returnOpCalculateEnergy(boost::shared_ptr<DataAtIntegrationPts> data_ptr,
990 boost::shared_ptr<double> total_energy_ptr);
991
993 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
994 boost::shared_ptr<PhysicalEquations> physics_ptr);
995
997 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
998 boost::shared_ptr<PhysicalEquations> physics_ptr);
999
1001 returnOpSetScale(boost::shared_ptr<double> scale_ptr,
1002 boost::shared_ptr<PhysicalEquations> physics_ptr);
1003
1004 std::vector<double> activeVariables;
1005 std::vector<double> dependentVariablesPiola;
1006 std::vector<double> dependentVariablesPiolaDirevatives;
1007
1008
1009
1010
1011
1012 template <int S>
1013 inline static DTensor2Ptr get_VecTensor2(std::vector<double> &
v) {
1014 return DTensor2Ptr(&
v[S + 0], &
v[S + 1], &
v[S + 2], &
v[S + 3], &
v[S + 4],
1015 &
v[S + 5], &
v[S + 6], &
v[S + 7], &
v[S + 8]);
1016 }
1017
1018 template <int S>
1019 inline static DTensor0Ptr get_VecTensor0(std::vector<double> &
v) {
1020 return DTensor0Ptr(&
v[S + 0]);
1021 }
1022
1023 template <int S0>
1024 inline static DTensor3Ptr get_vecTensor3(std::vector<double> &
v,
1025 const int nba) {
1026
1027 const int A00 = nba * 0 + S0;
1028 const int A01 = nba * 1 + S0;
1029 const int A02 = nba * 2 + S0;
1030 const int A10 = nba * 3 + S0;
1031 const int A11 = nba * 4 + S0;
1032 const int A12 = nba * 5 + S0;
1033 const int A20 = nba * 6 + S0;
1034 const int A21 = nba * 7 + S0;
1035 const int A22 = nba * 8 + S0;
1036
1037 return DTensor3Ptr(
1038
1039 &
v[A00 + 0], &
v[A00 + 1], &
v[A00 + 2], &
v[A01 + 0], &
v[A01 + 1],
1040 &
v[A01 + 2], &
v[A02 + 0], &
v[A02 + 1], &
v[A02 + 2],
1041
1042 &
v[A10 + 0], &
v[A10 + 1], &
v[A10 + 2], &
v[A11 + 0], &
v[A11 + 1],
1043 &
v[A11 + 2], &
v[A12 + 0], &
v[A12 + 1], &
v[A12 + 2],
1044
1045 &
v[A20 + 0], &
v[A20 + 1], &
v[A20 + 2], &
v[A21 + 0], &
v[A21 + 1],
1046 &
v[A21 + 2], &
v[A22 + 0], &
v[A22 + 1], &
v[A22 + 2]
1047
1048 );
1049 }
1050
1051
1052
1053
1054
1055
1056
1057 inline DTensor2Ptr get_h() { return get_VecTensor2<0>(activeVariables); }
1058
1059
1060
1061
1062
1063
1064
1065 inline DTensor2Ptr get_P() {
1066 return get_VecTensor2<0>(dependentVariablesPiola);
1067 }
1068
1069
1070
1071
1072
1073
1074
1075 inline DTensor3Ptr get_P_dh0() {
1076 return get_vecTensor3<0>(dependentVariablesPiolaDirevatives,
1077 activeVariables.size());
1078 }
1079 inline DTensor3Ptr get_P_dh1() {
1080 return get_vecTensor3<3>(dependentVariablesPiolaDirevatives,
1081 activeVariables.size());
1082 }
1083 inline DTensor3Ptr get_P_dh2() {
1084 return get_vecTensor3<6>(dependentVariablesPiolaDirevatives,
1085 activeVariables.size());
1086 }
1087
1088
1089};
1090
1091struct BcDisp {
1092 BcDisp(std::string name, std::vector<double> attr,
Range faces);
1093 std::string blockName;
1095 VectorDouble3 vals;
1096 VectorInt3 flags;
1097};
1099
1100struct BcRot {
1101 BcRot(std::string name, std::vector<double> attr,
Range faces);
1102 std::string blockName;
1104 VectorDouble vals;
1105 double theta;
1106};
1107using BcRotVec = std::vector<BcRot>;
1108
1110
1111struct TractionBc {
1112 TractionBc(std::string name, std::vector<double> attr,
Range faces);
1113 std::string blockName;
1115 VectorDouble3 vals;
1116 VectorInt3 flags;
1117};
1119
1120struct NormalDisplacementBc {
1121 NormalDisplacementBc(std::string name, std::vector<double> attr,
Range faces);
1122 std::string blockName;
1124 double val;
1125};
1127
1128struct AnalyticalDisplacementBc {
1129 AnalyticalDisplacementBc(std::string name, std::vector<double> attr,
1131 std::string blockName;
1133 VectorInt3 flags;
1134};
1136
1137struct AnalyticalTractionBc {
1138 AnalyticalTractionBc(std::string name, std::vector<double> attr,
Range faces);
1139 std::string blockName;
1141 VectorInt3 flags;
1142};
1144
1145struct PressureBc {
1146 PressureBc(std::string name, std::vector<double> attr,
Range faces);
1147 std::string blockName;
1149 double val;
1150};
1152
1153struct ExternalStrain {
1154 ExternalStrain(std::string name, std::vector<double> attr,
Range ents);
1155 std::string blockName;
1157 double val;
1158 double bulkModulusK;
1159};
1160
1161 #ifdef ENABLE_PYTHON_BINDING
1162struct AnalyticalExprPython {
1163 AnalyticalExprPython() = default;
1164 virtual ~AnalyticalExprPython() = default;
1165
1167 MoFEMErrorCode evalAnalyticalDisp(
double delta_t,
double t, np::ndarray x,
1168 np::ndarray y, np::ndarray z,
1169 np::ndarray nx, np::ndarray ny,
1170 np::ndarray nz,
1171 const std::string &block_name,
1172 np::ndarray &analytical_expr);
1173 MoFEMErrorCode evalAnalyticalTraction(
double delta_t,
double t, np::ndarray x,
1174 np::ndarray y, np::ndarray z,
1175 np::ndarray nx, np::ndarray ny,
1176 np::ndarray nz,
1177 const std::string &block_name,
1178 np::ndarray &analytical_expr);
1179
1180 template <typename T>
1181 inline std::vector<T>
1182 py_list_to_std_vector(const boost::python::object &iterable) {
1183 return std::vector<T>(boost::python::stl_input_iterator<T>(iterable),
1184 boost::python::stl_input_iterator<T>());
1185 }
1186
1187private:
1188 bp::object mainNamespace;
1189 bp::object analyticalDispFun;
1190 bp::object analyticalTractionFun;
1191};
1192
1193extern boost::weak_ptr<AnalyticalExprPython> AnalyticalExprPythonWeakPtr;
1194 #endif
1195
1198
1199}
1200
1201#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)