diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index e1448a510..52cf2bc89 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -677,6 +677,10 @@ public: drift_.resize(numDof); drift_ = 0.0; } + + if (enableExperiments) + checkDeckCompatibility_(); + } void prefetch(const Element& elem) const @@ -1678,6 +1682,55 @@ public: private: + void checkDeckCompatibility_() const + { + const auto& deck = this->simulator().vanguard().deck(); + + if (enableSolvent && !deck.hasKeyword("SOLVENT")) + throw std::runtime_error("The simulator requires the solvent option to be enabled, but the deck does not."); + else if (!enableSolvent && deck.hasKeyword("SOLVENT")) + throw std::runtime_error("The deck enables the solvent option, but the simulator is compiled without it."); + + if (enablePolymer && !deck.hasKeyword("POLYMER")) + throw std::runtime_error("The simulator requires the polymer option to be enabled, but the deck does not."); + else if (!enablePolymer && deck.hasKeyword("POLYMER")) + throw std::runtime_error("The deck enables the polymer option, but the simulator is compiled without it."); + + if (deck.hasKeyword("TEMP") && deck.hasKeyword("THERMAL")) + throw std::runtime_error("The deck enables both, the TEMP and the THERMAL options, but they are mutually exclusive."); + + bool deckEnergyEnabled = (deck.hasKeyword("TEMP") || deck.hasKeyword("THERMAL")); + if (enableEnergy && !deckEnergyEnabled) + throw std::runtime_error("The simulator requires the TEMP or the THERMAL option to be enabled, but the deck activates neither."); + else if (!enableEnergy && deckEnergyEnabled) + throw std::runtime_error("The deck enables the TEMP or the THERMAL option, but the simulator is not compiled to support either."); + + if (deckEnergyEnabled && deck.hasKeyword("TEMP")) + std::cout << "WARNING: The deck requests the TEMP option, i.e., treating energy " + << "conservation as a post processing step. This is currently unsupported, " + << "i.e., energy conservation is always handled fully implicitly."; + + int numDeckPhases = FluidSystem::numActivePhases(); + if (numDeckPhases < Indices::numPhases) + std::cout << "WARNING: The number of active phases specified by the deck (" + << numDeckPhases << ") is smaller than the number of compiled-in phases (" + << Indices::numPhases << "). This usually results in a significant " + << "performance degradation compared to using a specialized simulator."; + else if (numDeckPhases < Indices::numPhases) + throw std::runtime_error("The deck enables "+std::to_string(numDeckPhases)+" phases " + "while this simulator can only handle "+ + std::to_string(Indices::numPhases)+"."); + + // make sure that the correct phases are active + if (FluidSystem::phaseIsActive(oilPhaseIdx) && !Indices::oilEnabled) + throw std::runtime_error("The deck enables oil, but this simulator cannot handle it."); + if (FluidSystem::phaseIsActive(gasPhaseIdx) && !Indices::gasEnabled) + throw std::runtime_error("The deck enables gas, but this simulator cannot handle it."); + if (FluidSystem::phaseIsActive(waterPhaseIdx) && !Indices::waterEnabled) + throw std::runtime_error("The deck enables water, but this simulator cannot handle it."); + // the opposite cases should be fine (albeit a bit slower than possible) + } + bool drsdtActive_() const { int epsiodeIdx = std::max(this->simulator().episodeIndex(), 0);