923 {
924
926
927 using CachePhi = boost::tuple<int, int, MatrixDouble>;
928
929 CGGUserPolynomialBase(boost::shared_ptr<CachePhi> cache_phi = nullptr);
930 ~CGGUserPolynomialBase() = default;
931
932 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
933 BaseFunctionUnknownInterface **iface) const;
935 boost::shared_ptr<BaseFunctionCtx> ctx_ptr);
936
937private:
938 MatrixDouble shapeFun;
939 boost::shared_ptr<CachePhi> cachePhiPtr;
940
942};
943
944struct ContactTree;
945
953};
955
956using MatrixPtr = boost::shared_ptr<MatrixDouble>;
957using VectorPtr = boost::shared_ptr<VectorDouble>;
958
959using EntData = EntitiesFieldData::EntData;
962using FaceUserDataOperator = FaceElementForcesAndSourcesCore::UserDataOperator;
963using EleOnSide = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::FaceSideEle;
964using SideEleOp = EleOnSide::UserDataOperator;
965
966struct PhysicalEquations;
967
968struct AnalyticalExprPython;
969
971 : public boost::enable_shared_from_this<DataAtIntegrationPts> {
972
973 MatrixDouble approxPAtPts;
974 MatrixDouble approxSigmaAtPts;
975 MatrixDouble divPAtPts;
976 MatrixDouble divSigmaAtPts;
977 MatrixDouble wL2AtPts;
978 MatrixDouble wL2DotAtPts;
979 MatrixDouble wL2DotDotAtPts;
980 MatrixDouble logStretchTensorAtPts;
981 MatrixDouble stretchTensorAtPts;
982 VectorDouble jacobianAtPts;
983 MatrixDouble tractionAtPts;
984
985 MatrixDouble diffStretchTensorAtPts;
986 VectorDouble detStretchTensorAtPts;
987 MatrixDouble detStretchTensorAtPts_du;
988 MatrixDouble logStretchDotTensorAtPts;
989 MatrixDouble gradLogStretchDotTensorAtPts;
990 MatrixDouble rotAxisAtPts;
991 MatrixDouble rotAxisDotAtPts;
992 MatrixDouble rotAxisGradDotAtPts;
993 MatrixDouble rotAxis0AtPts;
994 MatrixDouble WAtPts;
995 MatrixDouble W0AtPts;
996 MatrixDouble GAtPts;
997 MatrixDouble G0AtPts;
998 MatrixDouble wH1AtPts;
999 MatrixDouble XH1AtPts;
1000 MatrixDouble contactL2AtPts;
1001 MatrixDouble wGradH1AtPts;
1002 MatrixDouble logStretch2H1AtPts;
1003 MatrixDouble logStretchTotalTensorAtPts;
1004
1005 MatrixDouble hAtPts;
1006 MatrixDouble hdOmegaAtPts;
1007 MatrixDouble hdLogStretchAtPts;
1008 MatrixDouble leviKirchhoffAtPts;
1009 MatrixDouble leviKirchhoffdOmegaAtPts;
1010 MatrixDouble leviKirchhoffdLogStreatchAtPts;
1011 MatrixDouble leviKirchhoffPAtPts;
1012 MatrixDouble adjointPdstretchAtPts;
1013 MatrixDouble adjointPdUAtPts;
1014 MatrixDouble adjointPdUdOmegaAtPts;
1015 MatrixDouble adjointPdUdPAtPts;
1016 MatrixDouble rotMatAtPts;
1017 MatrixDouble PAtPts;
1018 MatrixDouble SigmaAtPts;
1019 VectorDouble energyAtPts;
1020 MatrixDouble flowL2AtPts;
1021
1022 MatrixDouble varRotAxis;
1023 MatrixDouble varLogStreach;
1024 MatrixDouble varPiola;
1025 MatrixDouble varDivPiola;
1026 MatrixDouble varWL2;
1027
1028 MatrixDouble P_du;
1029
1030 MatrixDouble eigenVals;
1031 MatrixDouble eigenVecs;
1032 VectorInt nbUniq;
1033 MatrixDouble eigenValsC;
1034 MatrixDouble eigenVecsC;
1035 VectorInt nbUniqC;
1036
1037 MatrixDouble matD;
1038 MatrixDouble matAxiatorD;
1039 MatrixDouble matDeviatorD;
1040 MatrixDouble matInvD;
1041
1042 MatrixDouble internalStressAtPts;
1043
1044 MatrixDouble facePiolaAtPts;
1045 MatrixDouble gradHybridDispAtPts;
1046 MatrixDouble faceMaterialForceAtPts;
1047 VectorDouble normalPressureAtPts;
1048
1051 double piolaScale = 1.;
1052 double faceEnergy = 0.;
1053
1054 inline auto getPiolaScalePtr() {
1055 return boost::shared_ptr<double>(shared_from_this(), &piolaScale);
1056 }
1057
1058 inline MatrixPtr getApproxSigmaAtPts() {
1059 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1060 &approxSigmaAtPts);
1061 }
1063 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &approxPAtPts);
1064 }
1065
1067 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divPAtPts);
1068 }
1069
1071 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divSigmaAtPts);
1072 }
1073
1075 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2AtPts);
1076 }
1077
1078 inline MatrixPtr getSmallWL2DotAtPts() {
1079 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotAtPts);
1080 }
1081
1082 inline MatrixPtr getSmallWL2DotDotAtPts() {
1083 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotDotAtPts);
1084 }
1085
1086 inline MatrixPtr getLogStretchTensorAtPts() {
1087 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1088 &logStretchTensorAtPts);
1089 }
1090
1091 inline MatrixPtr getStretchTensorAtPts() {
1092 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1093 &stretchTensorAtPts);
1094 }
1095
1096 inline MatrixPtr getLogStretchDotTensorAtPts() {
1097 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1098 &logStretchDotTensorAtPts);
1099 }
1100
1101 inline MatrixPtr getGradLogStretchDotTensorAtPts() {
1102 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1103 &gradLogStretchDotTensorAtPts);
1104 }
1105
1107 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxisAtPts);
1108 }
1109
1111 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxis0AtPts);
1112 }
1113
1115 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1116 &rotAxisDotAtPts);
1117 }
1118
1119 inline MatrixPtr getRotAxisGradDotAtPts() {
1120 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1121 &rotAxisGradDotAtPts);
1122 }
1123
1125 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
1126 }
1127
1129 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
1130 }
1131
1133 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matD);
1134 }
1135
1137 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matInvD);
1138 }
1139
1141 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matAxiatorD);
1142 }
1143
1145 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matDeviatorD);
1146 }
1147
1149 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wH1AtPts);
1150 }
1151
1153 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &XH1AtPts);
1154 }
1155
1157 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &contactL2AtPts);
1158 }
1159
1160 inline MatrixPtr getSmallWGradH1AtPts() {
1161 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wGradH1AtPts);
1162 }
1163
1165 return boost::shared_ptr<VectorDouble>(shared_from_this(), &jacobianAtPts);
1166 }
1167
1168 inline MatrixPtr getLeviKirchhoffAtPts() {
1169 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1170 &leviKirchhoffAtPts);
1171 };
1172
1174 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varRotAxis);
1175 }
1176
1177 inline MatrixPtr getVarLogStreachPts() {
1178 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varLogStreach);
1179 }
1180
1182 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varPiola);
1183 }
1184
1186 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varDivPiola);
1187 }
1188
1190 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varWL2);
1191 }
1192
1193 inline MatrixPtr getInternalStressAtPts() {
1194 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1195 &internalStressAtPts);
1196 }
1197
1199 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &facePiolaAtPts);
1200 }
1201
1202 inline MatrixPtr getGradHybridDispAtPts() {
1203 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1204 &gradHybridDispAtPts);
1205 }
1206
1208 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &eigenVals);
1209 }
1210
1211 boost::shared_ptr<PhysicalEquations> physicsPtr;
1212};
1213
1215
1216
1217struct ExternalStrain;
1219struct PhysicalEquations {
1220
1227
1229
1232
1233 PhysicalEquations() = delete;
1234 PhysicalEquations(const int size_active, const int size_dependent)
1235 : activeVariables(size_active, 0),
1236 dependentVariablesPiola(size_dependent, 0),
1237 dependentVariablesPiolaDirevatives(size_dependent * size_active, 0) {}
1238 virtual ~PhysicalEquations() = default;
1239
1240 virtual MoFEMErrorCode recordTape(
const int tag, DTensor2Ptr *t_h) = 0;
1241
1243 returnOpJacobian(const int tag, const bool eval_rhs, const bool eval_lhs,
1244 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1245 boost::shared_ptr<PhysicalEquations> physics_ptr);
1246
1248 returnOpSpatialPhysical(
const std::string &
field_name,
1249 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1250 const double alpha_u);
1251
1253 returnOpSpatialPhysicalExternalStrain(
1255 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1256 boost::shared_ptr<ExternalStrainVec> external_strain_vec_ptr,
1257 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv);
1258
1260 std::string row_field, std::string col_field,
1261 boost::shared_ptr<DataAtIntegrationPts> data_ptr, const double alpha);
1262
1264 returnOpCalculateEnergy(boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1265 boost::shared_ptr<double> total_energy_ptr);
1266
1268 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1269 boost::shared_ptr<PhysicalEquations> physics_ptr);
1270
1272 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1273 boost::shared_ptr<PhysicalEquations> physics_ptr);
1274
1276 returnOpSetScale(boost::shared_ptr<double> scale_ptr,
1277 boost::shared_ptr<PhysicalEquations> physics_ptr);
1278
1279 std::vector<double> activeVariables;
1280 std::vector<double> dependentVariablesPiola;
1281 std::vector<double> dependentVariablesPiolaDirevatives;
1282
1283
1284
1285
1286
1287 template <int S>
1288 inline static DTensor2Ptr get_VecTensor2(std::vector<double> &
v) {
1289 return DTensor2Ptr(&
v[S + 0], &
v[S + 1], &
v[S + 2], &
v[S + 3], &
v[S + 4],
1290 &
v[S + 5], &
v[S + 6], &
v[S + 7], &
v[S + 8]);
1291 }
1292
1293 template <int S>
1294 inline static DTensor0Ptr get_VecTensor0(std::vector<double> &
v) {
1295 return DTensor0Ptr(&
v[S + 0]);
1296 }
1297
1298 template <int S0>
1299 inline static DTensor3Ptr get_vecTensor3(std::vector<double> &
v,
1300 const int nba) {
1301
1302 const int A00 = nba * 0 + S0;
1303 const int A01 = nba * 1 + S0;
1304 const int A02 = nba * 2 + S0;
1305 const int A10 = nba * 3 + S0;
1306 const int A11 = nba * 4 + S0;
1307 const int A12 = nba * 5 + S0;
1308 const int A20 = nba * 6 + S0;
1309 const int A21 = nba * 7 + S0;
1310 const int A22 = nba * 8 + S0;
1311
1312 return DTensor3Ptr(
1313
1314 &
v[A00 + 0], &
v[A00 + 1], &
v[A00 + 2], &
v[A01 + 0], &
v[A01 + 1],
1315 &
v[A01 + 2], &
v[A02 + 0], &
v[A02 + 1], &
v[A02 + 2],
1316
1317 &
v[A10 + 0], &
v[A10 + 1], &
v[A10 + 2], &
v[A11 + 0], &
v[A11 + 1],
1318 &
v[A11 + 2], &
v[A12 + 0], &
v[A12 + 1], &
v[A12 + 2],
1319
1320 &
v[A20 + 0], &
v[A20 + 1], &
v[A20 + 2], &
v[A21 + 0], &
v[A21 + 1],
1321 &
v[A21 + 2], &
v[A22 + 0], &
v[A22 + 1], &
v[A22 + 2]
1322
1323 );
1324 }
1325
1326
1327
1328
1329
1330
1331
1332 inline DTensor2Ptr get_h() { return get_VecTensor2<0>(activeVariables); }
1333
1334
1335
1336
1337
1338
1339
1340 inline DTensor2Ptr get_P() {
1341 return get_VecTensor2<0>(dependentVariablesPiola);
1342 }
1343
1344
1345
1346
1347
1348
1349
1350 inline DTensor3Ptr get_P_dh0() {
1351 return get_vecTensor3<0>(dependentVariablesPiolaDirevatives,
1352 activeVariables.size());
1353 }
1354 inline DTensor3Ptr get_P_dh1() {
1355 return get_vecTensor3<3>(dependentVariablesPiolaDirevatives,
1356 activeVariables.size());
1357 }
1358 inline DTensor3Ptr get_P_dh2() {
1359 return get_vecTensor3<6>(dependentVariablesPiolaDirevatives,
1360 activeVariables.size());
1361 }
1362
1363
1364};
1365
1366struct BcDisp {
1367 BcDisp(std::string name, std::vector<double> attr,
Range faces);
1368 std::string blockName;
1370 VectorDouble3 vals;
1371 VectorInt3 flags;
1372};
1374
1375struct BcRot {
1376 BcRot(std::string name, std::vector<double> attr,
Range faces);
1377 std::string blockName;
1379 VectorDouble vals;
1380 double theta;
1381};
1382using BcRotVec = std::vector<BcRot>;
1383
1385
1386struct TractionBc {
1387 TractionBc(std::string name, std::vector<double> attr,
Range faces);
1388 std::string blockName;
1390 VectorDouble3 vals;
1391 VectorInt3 flags;
1392};
1394
1395struct NormalDisplacementBc {
1396 NormalDisplacementBc(std::string name, std::vector<double> attr,
Range faces);
1397 std::string blockName;
1399 double val;
1400};
1402
1403struct AnalyticalDisplacementBc {
1404 AnalyticalDisplacementBc(std::string name, std::vector<double> attr,
1406 std::string blockName;
1408 VectorInt3 flags;
1409};
1411
1412struct AnalyticalTractionBc {
1413 AnalyticalTractionBc(std::string name, std::vector<double> attr,
Range faces);
1414 std::string blockName;
1416 VectorInt3 flags;
1417};
1419
1420struct PressureBc {
1421 PressureBc(std::string name, std::vector<double> attr,
Range faces);
1422 std::string blockName;
1424 double val;
1425};
1427
1428struct ExternalStrain {
1429 ExternalStrain(std::string name, std::vector<double> attr,
Range ents);
1430 std::string blockName;
1432 double val;
1433 double bulkModulusK;
1434};
1435
1436 #ifdef ENABLE_PYTHON_BINDING
1437struct AnalyticalExprPython {
1438 AnalyticalExprPython() = default;
1439 virtual ~AnalyticalExprPython() = default;
1440
1442 MoFEMErrorCode evalAnalyticalDisp(
double delta_t,
double t, np::ndarray x,
1443 np::ndarray y, np::ndarray z,
1444 np::ndarray nx, np::ndarray ny,
1445 np::ndarray nz,
1446 const std::string &block_name,
1447 np::ndarray &analytical_expr);
1448 MoFEMErrorCode evalAnalyticalTraction(
double delta_t,
double t, np::ndarray x,
1449 np::ndarray y, np::ndarray z,
1450 np::ndarray nx, np::ndarray ny,
1451 np::ndarray nz,
1452 const std::string &block_name,
1453 np::ndarray &analytical_expr);
1454
1455 template <typename T>
1456 inline std::vector<T>
1457 py_list_to_std_vector(const boost::python::object &iterable) {
1458 return std::vector<T>(boost::python::stl_input_iterator<T>(iterable),
1459 boost::python::stl_input_iterator<T>());
1460 }
1461
1462private:
1463 bp::object mainNamespace;
1464 bp::object analyticalDispFun;
1465 bp::object analyticalTractionFun;
1466};
1467
1468extern boost::weak_ptr<AnalyticalExprPython> AnalyticalExprPythonWeakPtr;
1469 #endif
1470
1473
1474}
1475
1476#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)