875 {
876
878
879 using CachePhi = boost::tuple<int, int, MatrixDouble>;
880
881 CGGUserPolynomialBase(boost::shared_ptr<CachePhi> cache_phi = nullptr);
882 ~CGGUserPolynomialBase() = default;
883
884 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
885 BaseFunctionUnknownInterface **iface) const;
887 boost::shared_ptr<BaseFunctionCtx> ctx_ptr);
888
889private:
890 MatrixDouble shapeFun;
891 boost::shared_ptr<CachePhi> cachePhiPtr;
892
894};
895
896struct ContactTree;
897
905};
907
908using MatrixPtr = boost::shared_ptr<MatrixDouble>;
909using VectorPtr = boost::shared_ptr<VectorDouble>;
910
911using EntData = EntitiesFieldData::EntData;
914using FaceUserDataOperator = FaceElementForcesAndSourcesCore::UserDataOperator;
915using EleOnSide = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::FaceSideEle;
916using SideEleOp = EleOnSide::UserDataOperator;
917
918struct PhysicalEquations;
919
920struct AnalyticalExprPython;
921
923 : public boost::enable_shared_from_this<DataAtIntegrationPts> {
924
925 MatrixDouble approxPAtPts;
926 MatrixDouble approxSigmaAtPts;
927 MatrixDouble divPAtPts;
928 MatrixDouble divSigmaAtPts;
929 MatrixDouble wL2AtPts;
930 MatrixDouble wL2DotAtPts;
931 MatrixDouble wL2DotDotAtPts;
932 MatrixDouble logStretchTensorAtPts;
933 MatrixDouble stretchTensorAtPts;
934 VectorDouble jacobianAtPts;
935 MatrixDouble tractionAtPts;
936
937 MatrixDouble diffStretchTensorAtPts;
938 VectorDouble detStretchTensorAtPts;
939 MatrixDouble detStretchTensorAtPts_du;
940 MatrixDouble logStretchDotTensorAtPts;
941 MatrixDouble gradLogStretchDotTensorAtPts;
942 MatrixDouble rotAxisAtPts;
943 MatrixDouble rotAxisDotAtPts;
944 MatrixDouble rotAxisGradDotAtPts;
945 MatrixDouble rotAxis0AtPts;
946 MatrixDouble WAtPts;
947 MatrixDouble W0AtPts;
948 MatrixDouble GAtPts;
949 MatrixDouble G0AtPts;
950 MatrixDouble wH1AtPts;
951 MatrixDouble XH1AtPts;
952 MatrixDouble contactL2AtPts;
953 MatrixDouble wGradH1AtPts;
954 MatrixDouble logStretch2H1AtPts;
955 MatrixDouble logStretchTotalTensorAtPts;
956
957 MatrixDouble hAtPts;
958 MatrixDouble hdOmegaAtPts;
959 MatrixDouble hdLogStretchAtPts;
960 MatrixDouble leviKirchhoffAtPts;
961 MatrixDouble leviKirchhoffdOmegaAtPts;
962 MatrixDouble leviKirchhoffdLogStreatchAtPts;
963 MatrixDouble leviKirchhoffPAtPts;
964 MatrixDouble adjointPdstretchAtPts;
965 MatrixDouble adjointPdUAtPts;
966 MatrixDouble adjointPdUdOmegaAtPts;
967 MatrixDouble adjointPdUdPAtPts;
968 MatrixDouble rotMatAtPts;
969 MatrixDouble PAtPts;
970 MatrixDouble SigmaAtPts;
971 VectorDouble energyAtPts;
972 MatrixDouble flowL2AtPts;
973
974 MatrixDouble varRotAxis;
975 MatrixDouble varLogStreach;
976 MatrixDouble varPiola;
977 MatrixDouble varDivPiola;
978 MatrixDouble varWL2;
979
980 MatrixDouble P_du;
981
982 MatrixDouble eigenVals;
983 MatrixDouble eigenVecs;
984 VectorInt nbUniq;
985 MatrixDouble eigenValsC;
986 MatrixDouble eigenVecsC;
987 VectorInt nbUniqC;
988
989 MatrixDouble matD;
990 MatrixDouble matAxiatorD;
991 MatrixDouble matDeviatorD;
992 MatrixDouble matInvD;
993
994 MatrixDouble internalStressAtPts;
995
996 MatrixDouble facePiolaAtPts;
997 MatrixDouble gradHybridDispAtPts;
998 MatrixDouble faceMaterialForceAtPts;
999 VectorDouble normalPressureAtPts;
1000
1003 double piolaScale = 1.;
1004 double faceEnergy = 0.;
1005
1006 inline auto getPiolaScalePtr() {
1007 return boost::shared_ptr<double>(shared_from_this(), &piolaScale);
1008 }
1009
1010 inline MatrixPtr getApproxSigmaAtPts() {
1011 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1012 &approxSigmaAtPts);
1013 }
1015 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &approxPAtPts);
1016 }
1017
1019 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divPAtPts);
1020 }
1021
1023 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divSigmaAtPts);
1024 }
1025
1027 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2AtPts);
1028 }
1029
1030 inline MatrixPtr getSmallWL2DotAtPts() {
1031 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotAtPts);
1032 }
1033
1034 inline MatrixPtr getSmallWL2DotDotAtPts() {
1035 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotDotAtPts);
1036 }
1037
1038 inline MatrixPtr getLogStretchTensorAtPts() {
1039 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1040 &logStretchTensorAtPts);
1041 }
1042
1043 inline MatrixPtr getStretchTensorAtPts() {
1044 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1045 &stretchTensorAtPts);
1046 }
1047
1048 inline MatrixPtr getLogStretchDotTensorAtPts() {
1049 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1050 &logStretchDotTensorAtPts);
1051 }
1052
1053 inline MatrixPtr getGradLogStretchDotTensorAtPts() {
1054 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1055 &gradLogStretchDotTensorAtPts);
1056 }
1057
1059 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxisAtPts);
1060 }
1061
1063 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxis0AtPts);
1064 }
1065
1067 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1068 &rotAxisDotAtPts);
1069 }
1070
1071 inline MatrixPtr getRotAxisGradDotAtPts() {
1072 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1073 &rotAxisGradDotAtPts);
1074 }
1075
1077 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
1078 }
1079
1081 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
1082 }
1083
1085 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matD);
1086 }
1087
1089 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matInvD);
1090 }
1091
1093 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matAxiatorD);
1094 }
1095
1097 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matDeviatorD);
1098 }
1099
1101 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wH1AtPts);
1102 }
1103
1105 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &XH1AtPts);
1106 }
1107
1109 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &contactL2AtPts);
1110 }
1111
1112 inline MatrixPtr getSmallWGradH1AtPts() {
1113 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wGradH1AtPts);
1114 }
1115
1117 return boost::shared_ptr<VectorDouble>(shared_from_this(), &jacobianAtPts);
1118 }
1119
1120 inline MatrixPtr getLeviKirchhoffAtPts() {
1121 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1122 &leviKirchhoffAtPts);
1123 };
1124
1126 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varRotAxis);
1127 }
1128
1129 inline MatrixPtr getVarLogStreachPts() {
1130 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varLogStreach);
1131 }
1132
1134 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varPiola);
1135 }
1136
1138 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varDivPiola);
1139 }
1140
1142 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varWL2);
1143 }
1144
1145 inline MatrixPtr getInternalStressAtPts() {
1146 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1147 &internalStressAtPts);
1148 }
1149
1151 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &facePiolaAtPts);
1152 }
1153
1154 inline MatrixPtr getGradHybridDispAtPts() {
1155 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1156 &gradHybridDispAtPts);
1157 }
1158
1160 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &eigenVals);
1161 }
1162
1163 boost::shared_ptr<PhysicalEquations> physicsPtr;
1164};
1165
1167
1168
1169struct ExternalStrain;
1171struct PhysicalEquations {
1172
1179
1181
1184
1185 PhysicalEquations() = delete;
1186 PhysicalEquations(const int size_active, const int size_dependent)
1187 : activeVariables(size_active, 0),
1188 dependentVariablesPiola(size_dependent, 0),
1189 dependentVariablesPiolaDirevatives(size_dependent * size_active, 0) {}
1190 virtual ~PhysicalEquations() = default;
1191
1192 virtual MoFEMErrorCode recordTape(
const int tag, DTensor2Ptr *t_h) = 0;
1193
1195 returnOpJacobian(const int tag, const bool eval_rhs, const bool eval_lhs,
1196 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1197 boost::shared_ptr<PhysicalEquations> physics_ptr);
1198
1200 returnOpSpatialPhysical(
const std::string &
field_name,
1201 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1202 const double alpha_u);
1203
1205 returnOpSpatialPhysicalExternalStrain(
1207 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1208 boost::shared_ptr<ExternalStrainVec> external_strain_vec_ptr,
1209 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv);
1210
1212 std::string row_field, std::string col_field,
1213 boost::shared_ptr<DataAtIntegrationPts> data_ptr, const double alpha);
1214
1216 returnOpCalculateEnergy(boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1217 boost::shared_ptr<double> total_energy_ptr);
1218
1220 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1221 boost::shared_ptr<PhysicalEquations> physics_ptr);
1222
1224 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1225 boost::shared_ptr<PhysicalEquations> physics_ptr);
1226
1228 returnOpSetScale(boost::shared_ptr<double> scale_ptr,
1229 boost::shared_ptr<PhysicalEquations> physics_ptr);
1230
1231 std::vector<double> activeVariables;
1232 std::vector<double> dependentVariablesPiola;
1233 std::vector<double> dependentVariablesPiolaDirevatives;
1234
1235
1236
1237
1238
1239 template <int S>
1240 inline static DTensor2Ptr get_VecTensor2(std::vector<double> &
v) {
1241 return DTensor2Ptr(&
v[S + 0], &
v[S + 1], &
v[S + 2], &
v[S + 3], &
v[S + 4],
1242 &
v[S + 5], &
v[S + 6], &
v[S + 7], &
v[S + 8]);
1243 }
1244
1245 template <int S>
1246 inline static DTensor0Ptr get_VecTensor0(std::vector<double> &
v) {
1247 return DTensor0Ptr(&
v[S + 0]);
1248 }
1249
1250 template <int S0>
1251 inline static DTensor3Ptr get_vecTensor3(std::vector<double> &
v,
1252 const int nba) {
1253
1254 const int A00 = nba * 0 + S0;
1255 const int A01 = nba * 1 + S0;
1256 const int A02 = nba * 2 + S0;
1257 const int A10 = nba * 3 + S0;
1258 const int A11 = nba * 4 + S0;
1259 const int A12 = nba * 5 + S0;
1260 const int A20 = nba * 6 + S0;
1261 const int A21 = nba * 7 + S0;
1262 const int A22 = nba * 8 + S0;
1263
1264 return DTensor3Ptr(
1265
1266 &
v[A00 + 0], &
v[A00 + 1], &
v[A00 + 2], &
v[A01 + 0], &
v[A01 + 1],
1267 &
v[A01 + 2], &
v[A02 + 0], &
v[A02 + 1], &
v[A02 + 2],
1268
1269 &
v[A10 + 0], &
v[A10 + 1], &
v[A10 + 2], &
v[A11 + 0], &
v[A11 + 1],
1270 &
v[A11 + 2], &
v[A12 + 0], &
v[A12 + 1], &
v[A12 + 2],
1271
1272 &
v[A20 + 0], &
v[A20 + 1], &
v[A20 + 2], &
v[A21 + 0], &
v[A21 + 1],
1273 &
v[A21 + 2], &
v[A22 + 0], &
v[A22 + 1], &
v[A22 + 2]
1274
1275 );
1276 }
1277
1278
1279
1280
1281
1282
1283
1284 inline DTensor2Ptr get_h() { return get_VecTensor2<0>(activeVariables); }
1285
1286
1287
1288
1289
1290
1291
1292 inline DTensor2Ptr get_P() {
1293 return get_VecTensor2<0>(dependentVariablesPiola);
1294 }
1295
1296
1297
1298
1299
1300
1301
1302 inline DTensor3Ptr get_P_dh0() {
1303 return get_vecTensor3<0>(dependentVariablesPiolaDirevatives,
1304 activeVariables.size());
1305 }
1306 inline DTensor3Ptr get_P_dh1() {
1307 return get_vecTensor3<3>(dependentVariablesPiolaDirevatives,
1308 activeVariables.size());
1309 }
1310 inline DTensor3Ptr get_P_dh2() {
1311 return get_vecTensor3<6>(dependentVariablesPiolaDirevatives,
1312 activeVariables.size());
1313 }
1314
1315
1316};
1317
1318struct BcDisp {
1319 BcDisp(std::string name, std::vector<double> attr,
Range faces);
1320 std::string blockName;
1322 VectorDouble3 vals;
1323 VectorInt3 flags;
1324};
1326
1327struct BcRot {
1328 BcRot(std::string name, std::vector<double> attr,
Range faces);
1329 std::string blockName;
1331 VectorDouble vals;
1332 double theta;
1333};
1334using BcRotVec = std::vector<BcRot>;
1335
1337
1338struct TractionBc {
1339 TractionBc(std::string name, std::vector<double> attr,
Range faces);
1340 std::string blockName;
1342 VectorDouble3 vals;
1343 VectorInt3 flags;
1344};
1346
1347struct NormalDisplacementBc {
1348 NormalDisplacementBc(std::string name, std::vector<double> attr,
Range faces);
1349 std::string blockName;
1351 double val;
1352};
1354
1355struct AnalyticalDisplacementBc {
1356 AnalyticalDisplacementBc(std::string name, std::vector<double> attr,
1358 std::string blockName;
1360 VectorInt3 flags;
1361};
1363
1364struct AnalyticalTractionBc {
1365 AnalyticalTractionBc(std::string name, std::vector<double> attr,
Range faces);
1366 std::string blockName;
1368 VectorInt3 flags;
1369};
1371
1372struct PressureBc {
1373 PressureBc(std::string name, std::vector<double> attr,
Range faces);
1374 std::string blockName;
1376 double val;
1377};
1379
1380struct ExternalStrain {
1381 ExternalStrain(std::string name, std::vector<double> attr,
Range ents);
1382 std::string blockName;
1384 double val;
1385 double bulkModulusK;
1386};
1387
1388 #ifdef ENABLE_PYTHON_BINDING
1389struct AnalyticalExprPython {
1390 AnalyticalExprPython() = default;
1391 virtual ~AnalyticalExprPython() = default;
1392
1394 MoFEMErrorCode evalAnalyticalDisp(
double delta_t,
double t, np::ndarray x,
1395 np::ndarray y, np::ndarray z,
1396 np::ndarray nx, np::ndarray ny,
1397 np::ndarray nz,
1398 const std::string &block_name,
1399 np::ndarray &analytical_expr);
1400 MoFEMErrorCode evalAnalyticalTraction(
double delta_t,
double t, np::ndarray x,
1401 np::ndarray y, np::ndarray z,
1402 np::ndarray nx, np::ndarray ny,
1403 np::ndarray nz,
1404 const std::string &block_name,
1405 np::ndarray &analytical_expr);
1406
1407 template <typename T>
1408 inline std::vector<T>
1409 py_list_to_std_vector(const boost::python::object &iterable) {
1410 return std::vector<T>(boost::python::stl_input_iterator<T>(iterable),
1411 boost::python::stl_input_iterator<T>());
1412 }
1413
1414private:
1415 bp::object mainNamespace;
1416 bp::object analyticalDispFun;
1417 bp::object analyticalTractionFun;
1418};
1419
1420extern boost::weak_ptr<AnalyticalExprPython> AnalyticalExprPythonWeakPtr;
1421 #endif
1422
1425
1426}
1427
1428#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)