| 37 | } |
| 38 | |
| 39 | ModelParameters readModelParameters(ParameterReader* baseReader) { |
| 40 | auto* reader = baseReader->readSubNode("equations"); |
| 41 | |
| 42 | const auto boundaryFileName = reader->readPath("boundaryfileName"); |
| 43 | const std::string materialFileName = |
| 44 | reader->readPathOrFail("materialfilename", "No material file given."); |
| 45 | const bool hasBoundaryFile = !boundaryFileName.value_or("").empty(); |
| 46 | |
| 47 | const bool plasticity = reader->readWithDefault("plasticity", false); |
| 48 | const bool useCellHomogenizedMaterial = |
| 49 | reader->readWithDefault("usecellhomogenizedmaterial", true); |
| 50 | |
| 51 | const double gravitationalAcceleration = |
| 52 | reader->readWithDefault("gravitationalacceleration", 9.81); |
| 53 | const double tv = reader->readWithDefault("tv", 0.1); |
| 54 | |
| 55 | const auto freqCentral = reader->readIfRequired<double>("freqcentral", isModelViscoelastic()); |
| 56 | const auto freqRatio = reader->readIfRequired<double>("freqratio", isModelViscoelastic()); |
| 57 | if constexpr (isModelViscoelastic()) { |
| 58 | if (freqRatio <= 0) { |
| 59 | logError() |
| 60 | << "The freqratio parameter must be positive---but that is currently not the case."; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | const ITMParameters itmParameters = readITMParameters(baseReader); |
| 65 | |
| 66 | reader->warnDeprecated({"adjoint", "adjfilename", "anisotropy"}); |
| 67 | |
| 68 | const auto flux = |
| 69 | reader->readWithDefaultStringEnum<NumericalFlux>("numflux", |
| 70 | "godunov", |
| 71 | { |
| 72 | {"godunov", NumericalFlux::Godunov}, |
| 73 | {"rusanov", NumericalFlux::Rusanov}, |
| 74 | }); |
| 75 | |
| 76 | const auto fluxNearFault = |
| 77 | reader->readWithDefaultStringEnum<NumericalFlux>("numfluxnearfault", |
| 78 | "godunov", |
| 79 | { |
| 80 | {"godunov", NumericalFlux::Godunov}, |
| 81 | {"rusanov", NumericalFlux::Rusanov}, |
| 82 | }); |
| 83 | |
| 84 | return ModelParameters{hasBoundaryFile, |
| 85 | plasticity, |
| 86 | useCellHomogenizedMaterial, |
| 87 | freqCentral, |
| 88 | freqRatio, |
| 89 | gravitationalAcceleration, |
| 90 | tv, |
| 91 | boundaryFileName.value_or(""), |
| 92 | materialFileName, |
| 93 | itmParameters, |
| 94 | flux, |
| 95 | fluxNearFault}; |
| 96 | } |
no test coverage detected