diff --git a/opm/material/fluidsystems/PhaseUsageInfo.cpp b/opm/material/fluidsystems/PhaseUsageInfo.cpp index 44d97886b93..33827cc5f8a 100644 --- a/opm/material/fluidsystems/PhaseUsageInfo.cpp +++ b/opm/material/fluidsystems/PhaseUsageInfo.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include @@ -92,6 +91,24 @@ void PhaseUsageInfo::initFromState(const EclipseState& eclState) has_biofilm = eclState.runspec().biof(); has_micp = eclState.runspec().micp(); has_co2_or_h2store = eclState.runspec().co2Storage() || eclState.runspec().h2Storage(); + enable_dissolved_gas_ = eclState.getSimulationConfig().hasDISGAS(); + enable_vaporized_oil_ = eclState.getSimulationConfig().hasVAPOIL(); + enable_vaporized_water_ = eclState.getSimulationConfig().hasVAPWAT(); + const bool disgasw = eclState.getSimulationConfig().hasDISGASW(); + if (disgasw) { + if (has_co2_or_h2store) { + enable_dissolved_gas_in_water_ = true; + } else if (eclState.runspec().co2Sol() || eclState.runspec().h2Sol()) { + // For CO2SOL and H2SOL the dissolved gas in water is added in the solvent model + // The HC gas is not allowed to dissolve into water. + // For most HC gases this is a reasonable assumption. + OpmLog::info("CO2SOL/H2SOL is activated together with DISGASW.\n" + "Only CO2/H2 is allowed to dissolve into water"); + } else { + OPM_THROW(std::runtime_error, + "DISGASW is only supported in combination with CO2STORE, H2STORE, CO2SOL, or H2SOL."); + } + } } template @@ -129,9 +146,15 @@ void PhaseUsageInfo::initFromPhases(const Phases& phases) { has_zFraction = phases.active(Phase::ZFRACTION); this->updateIndexMapping_(); + this->updateIndices_(); } #endif +template +void PhaseUsageInfo::updateIndices_() { + contiSolventEqIdx_ = has_solvent ? numActivePhases_ : -1000; +} + // Explicit template instantiations for commonly used IndexTraits template class PhaseUsageInfo; diff --git a/opm/material/fluidsystems/PhaseUsageInfo.hpp b/opm/material/fluidsystems/PhaseUsageInfo.hpp index e4c9f38d6c1..2e43dafbff5 100644 --- a/opm/material/fluidsystems/PhaseUsageInfo.hpp +++ b/opm/material/fluidsystems/PhaseUsageInfo.hpp @@ -154,6 +154,26 @@ class PhaseUsageInfo { return has_co2_or_h2store; } + bool enableDissolvedGas() const noexcept { + return enable_dissolved_gas_; + } + + bool enableVaporizedOil() const noexcept { + return enable_vaporized_oil_; + } + + bool enableVaporizedWater() const noexcept { + return enable_vaporized_water_; + } + + bool enableDissolvedGasInWater() const noexcept { + return enable_dissolved_gas_in_water_; + } + + int contiSolventEqIdx() const noexcept { + return contiSolventEqIdx_; + } + private: // only account for the three main phases: oil, water, gas unsigned char numActivePhases_ = 0; @@ -177,9 +197,20 @@ class PhaseUsageInfo { bool has_micp{}; bool has_co2_or_h2store{}; + bool enable_dissolved_gas_{}; + bool enable_vaporized_oil_{}; + bool enable_vaporized_water_{}; + bool enable_dissolved_gas_in_water_{}; + + + int contiSolventEqIdx_ = -1000; + // updating the mapping between active and canonical phase indices void updateIndexMapping_(); + // update equation indices + void updateIndices_(); + void reset_(); };