diff --git a/opm/simulators/wells/GasLiftSingleWell_impl.hpp b/opm/simulators/wells/GasLiftSingleWell_impl.hpp index 07bd46354..1611f8c43 100644 --- a/opm/simulators/wells/GasLiftSingleWell_impl.hpp +++ b/opm/simulators/wells/GasLiftSingleWell_impl.hpp @@ -156,11 +156,7 @@ setupPhaseVariables_() { const auto& pu = this->phase_usage_; bool num_phases_ok = (pu.num_phases == 3); - if (pu.num_phases == 2 - && pu.phase_used[BlackoilPhases::Aqua] == 1 - && pu.phase_used[BlackoilPhases::Liquid] == 1 - && pu.phase_used[BlackoilPhases::Vapour] == 0) - { + if (pu.num_phases == 2) { // NOTE: We support two-phase oil-water flow, by setting the gas flow rate // to zero. This is done by initializing the potential vector to zero: // @@ -171,7 +167,16 @@ setupPhaseVariables_() // has been adapted to the two-phase oil-water case, see the comment // in WellInterfaceGeneric.cpp for the method adaptRatesForVFP() for // more information. - num_phases_ok = true; // two-phase oil-water is also supported + if ( pu.phase_used[BlackoilPhases::Aqua] == 1 + && pu.phase_used[BlackoilPhases::Liquid] == 1 + && pu.phase_used[BlackoilPhases::Vapour] == 0) + { + num_phases_ok = true; // two-phase oil-water is also supported + } + else { + throw std::logic_error("Two-phase gas lift optimization only supported" + " for oil and water"); + } } assert(num_phases_ok); this->oil_pos_ = pu.phase_pos[Oil]; diff --git a/opm/simulators/wells/WellInterfaceGeneric.cpp b/opm/simulators/wells/WellInterfaceGeneric.cpp index cad14e6f1..a627b1603 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.cpp +++ b/opm/simulators/wells/WellInterfaceGeneric.cpp @@ -109,13 +109,18 @@ WellInterfaceGeneric::WellInterfaceGeneric(const Well& well, void WellInterfaceGeneric::adaptRatesForVFP(std::vector& rates) const { const auto& pu = this->phaseUsage(); - if (pu.num_phases == 2 - && pu.phase_used[BlackoilPhases::Aqua] == 1 - && pu.phase_used[BlackoilPhases::Liquid] == 1 - && pu.phase_used[BlackoilPhases::Vapour] == 0) - { - assert(rates.size() == 2); - rates.push_back(0.0); // set gas rate to zero + if (pu.num_phases == 2) { + if ( pu.phase_used[BlackoilPhases::Aqua] == 1 + && pu.phase_used[BlackoilPhases::Liquid] == 1 + && pu.phase_used[BlackoilPhases::Vapour] == 0) + { + assert(rates.size() == 2); + rates.push_back(0.0); // set gas rate to zero + } + else { + throw std::logic_error("Two-phase VFP calculation only " + "supported for oil and water"); + } } }