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