968 {
969
971
972 using CachePhi = boost::tuple<int, int, MatrixDouble>;
973
974 CGGUserPolynomialBase(boost::shared_ptr<CachePhi> cache_phi = nullptr);
975 ~CGGUserPolynomialBase() = default;
976
977 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
978 BaseFunctionUnknownInterface **iface) const;
980 boost::shared_ptr<BaseFunctionCtx> ctx_ptr);
981
982private:
983 MatrixDouble shapeFun;
984 boost::shared_ptr<CachePhi> cachePhiPtr;
985
987};
988
989struct ContactTree;
990
998};
1000
1001using MatrixPtr = boost::shared_ptr<MatrixDouble>;
1002using VectorPtr = boost::shared_ptr<VectorDouble>;
1003
1004using EntData = EntitiesFieldData::EntData;
1007using FaceUserDataOperator = FaceElementForcesAndSourcesCore::UserDataOperator;
1008using EleOnSide = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::FaceSideEle;
1009using SideEleOp = EleOnSide::UserDataOperator;
1010
1011struct PhysicalEquations;
1012
1013struct AnalyticalExprPython;
1014
1016 : public boost::enable_shared_from_this<DataAtIntegrationPts> {
1017
1018 MatrixDouble approxPAtPts;
1019 MatrixDouble approxSigmaAtPts;
1020 MatrixDouble divPAtPts;
1021 MatrixDouble divSigmaAtPts;
1022 MatrixDouble wL2AtPts;
1023 MatrixDouble wL2DotAtPts;
1024 MatrixDouble wL2DotDotAtPts;
1025 MatrixDouble logStretchTensorAtPts;
1026 MatrixDouble stretchTensorAtPts;
1027 VectorDouble jacobianAtPts;
1028 MatrixDouble tractionAtPts;
1029
1030 MatrixDouble diffStretchTensorAtPts;
1031 VectorDouble detStretchTensorAtPts;
1032 MatrixDouble detStretchTensorAtPts_du;
1033 MatrixDouble logStretchDotTensorAtPts;
1034 MatrixDouble gradLogStretchDotTensorAtPts;
1035 MatrixDouble rotAxisAtPts;
1036 MatrixDouble rotAxisDotAtPts;
1037 MatrixDouble rotAxisGradDotAtPts;
1038 MatrixDouble rotAxis0AtPts;
1039 MatrixDouble WAtPts;
1040 MatrixDouble W0AtPts;
1041 MatrixDouble GAtPts;
1042 MatrixDouble G0AtPts;
1043 MatrixDouble wH1AtPts;
1044 MatrixDouble XH1AtPts;
1045 MatrixDouble contactL2AtPts;
1046 MatrixDouble wGradH1AtPts;
1047 MatrixDouble logStretch2H1AtPts;
1048 MatrixDouble logStretchTotalTensorAtPts;
1049
1050 MatrixDouble hAtPts;
1051 MatrixDouble hdOmegaAtPts;
1052 MatrixDouble hdLogStretchAtPts;
1053 MatrixDouble leviKirchhoffAtPts;
1054 MatrixDouble leviKirchhoffdOmegaAtPts;
1055 MatrixDouble leviKirchhoffdLogStreatchAtPts;
1056 MatrixDouble leviKirchhoffPAtPts;
1057 MatrixDouble adjointPdstretchAtPts;
1058 MatrixDouble adjointPdUAtPts;
1059 MatrixDouble adjointPdUdOmegaAtPts;
1060 MatrixDouble adjointPdUdPAtPts;
1061 MatrixDouble rotMatAtPts;
1062 MatrixDouble PAtPts;
1063 MatrixDouble SigmaAtPts;
1064 VectorDouble energyAtPts;
1065 MatrixDouble flowL2AtPts;
1066
1067 MatrixDouble varRotAxis;
1068 MatrixDouble varLogStreach;
1069 MatrixDouble varPiola;
1070 MatrixDouble varDivPiola;
1071 MatrixDouble varWL2;
1072
1073 MatrixDouble P_du;
1074
1075 MatrixDouble eigenVals;
1076 MatrixDouble eigenVecs;
1077 VectorInt nbUniq;
1078 MatrixDouble eigenValsC;
1079 MatrixDouble eigenVecsC;
1080 VectorInt nbUniqC;
1081
1082 MatrixDouble matD;
1083 MatrixDouble matAxiatorD;
1084 MatrixDouble matDeviatorD;
1085 MatrixDouble matInvD;
1086
1087 MatrixDouble internalStressAtPts;
1088
1089 MatrixDouble facePiolaAtPts;
1090 MatrixDouble gradHybridDispAtPts;
1091 MatrixDouble faceMaterialForceAtPts;
1092 VectorDouble normalPressureAtPts;
1093
1096 double piolaScale = 1.;
1097 double faceEnergy = 0.;
1098
1099 inline auto getPiolaScalePtr() {
1100 return boost::shared_ptr<double>(shared_from_this(), &piolaScale);
1101 }
1102
1103 inline MatrixPtr getApproxSigmaAtPts() {
1104 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1105 &approxSigmaAtPts);
1106 }
1108 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &approxPAtPts);
1109 }
1110
1112 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divPAtPts);
1113 }
1114
1116 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &divSigmaAtPts);
1117 }
1118
1120 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2AtPts);
1121 }
1122
1123 inline MatrixPtr getSmallWL2DotAtPts() {
1124 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotAtPts);
1125 }
1126
1127 inline MatrixPtr getSmallWL2DotDotAtPts() {
1128 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wL2DotDotAtPts);
1129 }
1130
1131 inline MatrixPtr getLogStretchTensorAtPts() {
1132 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1133 &logStretchTensorAtPts);
1134 }
1135
1136 inline MatrixPtr getStretchTensorAtPts() {
1137 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1138 &stretchTensorAtPts);
1139 }
1140
1141 inline MatrixPtr getLogStretchDotTensorAtPts() {
1142 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1143 &logStretchDotTensorAtPts);
1144 }
1145
1146 inline MatrixPtr getGradLogStretchDotTensorAtPts() {
1147 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1148 &gradLogStretchDotTensorAtPts);
1149 }
1150
1152 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxisAtPts);
1153 }
1154
1156 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &rotAxis0AtPts);
1157 }
1158
1160 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1161 &rotAxisDotAtPts);
1162 }
1163
1164 inline MatrixPtr getRotAxisGradDotAtPts() {
1165 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1166 &rotAxisGradDotAtPts);
1167 }
1168
1170 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
1171 }
1172
1174 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &GAtPts);
1175 }
1176
1178 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matD);
1179 }
1180
1182 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matInvD);
1183 }
1184
1186 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matAxiatorD);
1187 }
1188
1190 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &matDeviatorD);
1191 }
1192
1194 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wH1AtPts);
1195 }
1196
1198 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &XH1AtPts);
1199 }
1200
1202 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &contactL2AtPts);
1203 }
1204
1205 inline MatrixPtr getSmallWGradH1AtPts() {
1206 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &wGradH1AtPts);
1207 }
1208
1210 return boost::shared_ptr<VectorDouble>(shared_from_this(), &jacobianAtPts);
1211 }
1212
1213 inline MatrixPtr getLeviKirchhoffAtPts() {
1214 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1215 &leviKirchhoffAtPts);
1216 };
1217
1219 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varRotAxis);
1220 }
1221
1222 inline MatrixPtr getVarLogStreachPts() {
1223 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varLogStreach);
1224 }
1225
1227 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varPiola);
1228 }
1229
1231 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varDivPiola);
1232 }
1233
1235 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &varWL2);
1236 }
1237
1238 inline MatrixPtr getInternalStressAtPts() {
1239 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1240 &internalStressAtPts);
1241 }
1242
1244 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &facePiolaAtPts);
1245 }
1246
1247 inline MatrixPtr getGradHybridDispAtPts() {
1248 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
1249 &gradHybridDispAtPts);
1250 }
1251
1253 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &eigenVals);
1254 }
1255
1256 boost::shared_ptr<PhysicalEquations> physicsPtr;
1257};
1258
1260
1261
1262struct ExternalStrain;
1264struct PhysicalEquations {
1265
1272
1274
1277
1278 PhysicalEquations() = delete;
1279 PhysicalEquations(const int size_active, const int size_dependent)
1280 : activeVariables(size_active, 0),
1281 dependentVariablesPiola(size_dependent, 0),
1282 dependentVariablesPiolaDirevatives(size_dependent * size_active, 0) {}
1283 virtual ~PhysicalEquations() = default;
1284
1285 virtual MoFEMErrorCode recordTape(
const int tag, DTensor2Ptr *t_h) = 0;
1286
1288 returnOpJacobian(const int tag, const bool eval_rhs, const bool eval_lhs,
1289 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1290 boost::shared_ptr<PhysicalEquations> physics_ptr);
1291
1293 returnOpSpatialPhysical(
const std::string &
field_name,
1294 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1295 const double alpha_u);
1296
1298 returnOpSpatialPhysicalExternalStrain(
1300 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1301 boost::shared_ptr<ExternalStrainVec> external_strain_vec_ptr,
1302 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv);
1303
1305 std::string row_field, std::string col_field,
1306 boost::shared_ptr<DataAtIntegrationPts> data_ptr, const double alpha);
1307
1309 returnOpCalculateEnergy(boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1310 boost::shared_ptr<double> total_energy_ptr);
1311
1313 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1314 boost::shared_ptr<PhysicalEquations> physics_ptr);
1315
1317 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
1318 boost::shared_ptr<PhysicalEquations> physics_ptr);
1319
1321 returnOpSetScale(boost::shared_ptr<double> scale_ptr,
1322 boost::shared_ptr<PhysicalEquations> physics_ptr);
1323
1324 std::vector<double> activeVariables;
1325 std::vector<double> dependentVariablesPiola;
1326 std::vector<double> dependentVariablesPiolaDirevatives;
1327
1328
1329
1330
1331
1332 template <int S>
1333 inline static DTensor2Ptr get_VecTensor2(std::vector<double> &
v) {
1334 return DTensor2Ptr(&
v[S + 0], &
v[S + 1], &
v[S + 2], &
v[S + 3], &
v[S + 4],
1335 &
v[S + 5], &
v[S + 6], &
v[S + 7], &
v[S + 8]);
1336 }
1337
1338 template <int S>
1339 inline static DTensor0Ptr get_VecTensor0(std::vector<double> &
v) {
1340 return DTensor0Ptr(&
v[S + 0]);
1341 }
1342
1343 template <int S0>
1344 inline static DTensor3Ptr get_vecTensor3(std::vector<double> &
v,
1345 const int nba) {
1346
1347 const int A00 = nba * 0 + S0;
1348 const int A01 = nba * 1 + S0;
1349 const int A02 = nba * 2 + S0;
1350 const int A10 = nba * 3 + S0;
1351 const int A11 = nba * 4 + S0;
1352 const int A12 = nba * 5 + S0;
1353 const int A20 = nba * 6 + S0;
1354 const int A21 = nba * 7 + S0;
1355 const int A22 = nba * 8 + S0;
1356
1357 return DTensor3Ptr(
1358
1359 &
v[A00 + 0], &
v[A00 + 1], &
v[A00 + 2], &
v[A01 + 0], &
v[A01 + 1],
1360 &
v[A01 + 2], &
v[A02 + 0], &
v[A02 + 1], &
v[A02 + 2],
1361
1362 &
v[A10 + 0], &
v[A10 + 1], &
v[A10 + 2], &
v[A11 + 0], &
v[A11 + 1],
1363 &
v[A11 + 2], &
v[A12 + 0], &
v[A12 + 1], &
v[A12 + 2],
1364
1365 &
v[A20 + 0], &
v[A20 + 1], &
v[A20 + 2], &
v[A21 + 0], &
v[A21 + 1],
1366 &
v[A21 + 2], &
v[A22 + 0], &
v[A22 + 1], &
v[A22 + 2]
1367
1368 );
1369 }
1370
1371
1372
1373
1374
1375
1376
1377 inline DTensor2Ptr get_h() { return get_VecTensor2<0>(activeVariables); }
1378
1379
1380
1381
1382
1383
1384
1385 inline DTensor2Ptr get_P() {
1386 return get_VecTensor2<0>(dependentVariablesPiola);
1387 }
1388
1389
1390
1391
1392
1393
1394
1395 inline DTensor3Ptr get_P_dh0() {
1396 return get_vecTensor3<0>(dependentVariablesPiolaDirevatives,
1397 activeVariables.size());
1398 }
1399 inline DTensor3Ptr get_P_dh1() {
1400 return get_vecTensor3<3>(dependentVariablesPiolaDirevatives,
1401 activeVariables.size());
1402 }
1403 inline DTensor3Ptr get_P_dh2() {
1404 return get_vecTensor3<6>(dependentVariablesPiolaDirevatives,
1405 activeVariables.size());
1406 }
1407
1408
1409};
1410
1411struct BcDisp {
1412 BcDisp(std::string name, std::vector<double> attr,
Range faces);
1413 std::string blockName;
1415 VectorDouble3 vals;
1416 VectorInt3 flags;
1417};
1419
1420struct BcRot {
1421 BcRot(std::string name, std::vector<double> attr,
Range faces);
1422 std::string blockName;
1424 VectorDouble vals;
1425 double theta;
1426};
1427using BcRotVec = std::vector<BcRot>;
1428
1430
1431struct TractionBc {
1432 TractionBc(std::string name, std::vector<double> attr,
Range faces);
1433 std::string blockName;
1435 VectorDouble3 vals;
1436 VectorInt3 flags;
1437};
1439
1440struct NormalDisplacementBc {
1441 NormalDisplacementBc(std::string name, std::vector<double> attr,
Range faces);
1442 std::string blockName;
1444 double val;
1445};
1447
1448struct AnalyticalDisplacementBc {
1449 AnalyticalDisplacementBc(std::string name, std::vector<double> attr,
1451 std::string blockName;
1453 VectorInt3 flags;
1454};
1456
1457struct AnalyticalTractionBc {
1458 AnalyticalTractionBc(std::string name, std::vector<double> attr,
Range faces);
1459 std::string blockName;
1461 VectorInt3 flags;
1462};
1464
1465struct PressureBc {
1466 PressureBc(std::string name, std::vector<double> attr,
Range faces);
1467 std::string blockName;
1469 double val;
1470};
1472
1473struct ExternalStrain {
1474 ExternalStrain(std::string name, std::vector<double> attr,
Range ents);
1475 std::string blockName;
1477 double val;
1478 double bulkModulusK;
1479};
1480
1481 #ifdef ENABLE_PYTHON_BINDING
1482struct AnalyticalExprPython {
1483 AnalyticalExprPython() = default;
1484 virtual ~AnalyticalExprPython() = default;
1485
1487 MoFEMErrorCode evalAnalyticalDisp(
double delta_t,
double t, np::ndarray x,
1488 np::ndarray y, np::ndarray z,
1489 np::ndarray nx, np::ndarray ny,
1490 np::ndarray nz,
1491 const std::string &block_name,
1492 np::ndarray &analytical_expr);
1493 MoFEMErrorCode evalAnalyticalTraction(
double delta_t,
double t, np::ndarray x,
1494 np::ndarray y, np::ndarray z,
1495 np::ndarray nx, np::ndarray ny,
1496 np::ndarray nz,
1497 const std::string &block_name,
1498 np::ndarray &analytical_expr);
1499
1500 template <typename T>
1501 inline std::vector<T>
1502 py_list_to_std_vector(const boost::python::object &iterable) {
1503 return std::vector<T>(boost::python::stl_input_iterator<T>(iterable),
1504 boost::python::stl_input_iterator<T>());
1505 }
1506
1507private:
1508 bp::object mainNamespace;
1509 bp::object analyticalDispFun;
1510 bp::object analyticalTractionFun;
1511};
1512
1513extern boost::weak_ptr<AnalyticalExprPython> AnalyticalExprPythonWeakPtr;
1514 #endif
1515
1518
1519}
1520
1521#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)