| 285 | } |
| 286 | |
| 287 | std::pair<std::vector<std::string>, BaseDRInitializer::Parametrization> |
| 288 | BaseDRInitializer::stressIdentifiers(bool readNucleation) { |
| 289 | std::vector<std::string> tractionNames; |
| 290 | std::vector<std::string> cartesianNames; |
| 291 | if (readNucleation) { |
| 292 | tractionNames = {"Tnuc_n", "Tnuc_s", "Tnuc_d"}; |
| 293 | cartesianNames = {"nuc_xx", "nuc_yy", "nuc_zz", "nuc_xy", "nuc_yz", "nuc_xz"}; |
| 294 | } else { |
| 295 | tractionNames = {"T_n", "T_s", "T_d"}; |
| 296 | cartesianNames = {"s_xx", "s_yy", "s_zz", "s_xy", "s_yz", "s_xz"}; |
| 297 | } |
| 298 | #ifdef USE_POROELASTIC |
| 299 | if (readNucleation) { |
| 300 | tractionNames.push_back("nuc_p"); |
| 301 | cartesianNames.push_back("nuc_p"); |
| 302 | } else { |
| 303 | tractionNames.push_back("p"); |
| 304 | cartesianNames.push_back("p"); |
| 305 | } |
| 306 | #endif |
| 307 | |
| 308 | bool allTractionParametersSupplied = true; |
| 309 | bool allCartesianParametersSupplied = true; |
| 310 | bool anyTractionParametersSupplied = false; |
| 311 | bool anyCartesianParametersSupplied = false; |
| 312 | for (size_t i = 0; i < 3; i++) { |
| 313 | const auto b = faultProvides(tractionNames[i]); |
| 314 | allTractionParametersSupplied &= b; |
| 315 | anyTractionParametersSupplied |= b; |
| 316 | } |
| 317 | for (size_t i = 0; i < 6; i++) { |
| 318 | const auto b = faultProvides(cartesianNames[i]); |
| 319 | allCartesianParametersSupplied &= b; |
| 320 | anyCartesianParametersSupplied |= b; |
| 321 | } |
| 322 | |
| 323 | if (allCartesianParametersSupplied && !anyTractionParametersSupplied) { |
| 324 | return {cartesianNames, Parametrization::Cartesian}; |
| 325 | } else if (allTractionParametersSupplied && !anyCartesianParametersSupplied) { |
| 326 | return {tractionNames, Parametrization::Traction}; |
| 327 | } else { |
| 328 | logError() << "Please specify a correct parametrization of the " |
| 329 | << (readNucleation ? "nucleation stress." : "initial stress.") |
| 330 | << "You have either not specified all parameters or an uncommom mixture of " |
| 331 | "parameters. Give either all of " |
| 332 | << (readNucleation |
| 333 | ? "(nuc_xx, nuc_yy, nuc_zz, nuc_xy, nuc_yz, nuc_xz) or all of (Tnuc_n, " |
| 334 | "Tnuc_s, Tnuc_d)" |
| 335 | : "(s_xx, s_yy, s_zz, s_xy, s_yz, s_xz) or all of (T_n, T_s, T_d)") |
| 336 | << ", but not a mixture"; |
| 337 | return {}; |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | } // namespace seissol::dr::initializer |
no test coverage detected