From 1a2e0ec01e23473ad86ca3e295f34891b7f669bb Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 3 Dec 2020 11:03:06 +0100 Subject: [PATCH] The summary calculator should return zero PI for non flowing wells --- src/opm/output/eclipse/Summary.cpp | 46 ++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index 841ad0f83..9fd7fd10e 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -971,28 +971,50 @@ inline quantity potential_rate( const fn_args& args ) { inline quantity preferred_phase_productivty_index(const fn_args& args) { if (args.schedule_wells.empty()) - return potential_rate(args); + return {0, rate_unit()}; - switch (args.schedule_wells.front().getPreferredPhase()) { - case Opm::Phase::OIL: - return potential_rate(args); + const auto& well = args.schedule_wells.front(); + auto preferred_phase = well.getPreferredPhase(); + if (well.getStatus() == Opm::Well::Status::OPEN) { - case Opm::Phase::GAS: - return potential_rate(args); + switch (preferred_phase) { + case Opm::Phase::OIL: + return potential_rate(args); - case Opm::Phase::WATER: - return potential_rate(args); + case Opm::Phase::GAS: + return potential_rate(args); - default: - break; + case Opm::Phase::WATER: + return potential_rate(args); + + default: + break; + } + } else { + + switch (preferred_phase) { + case Opm::Phase::OIL: + return {0, rate_unit()}; + + case Opm::Phase::GAS: + return {0, rate_unit()}; + + case Opm::Phase::WATER: + return {0, rate_unit()}; + + default: + break; + + } } throw std::invalid_argument { "Unsupported \"preferred\" phase: " + - std::to_string(static_cast(args.schedule_wells.front().getPreferredPhase())) - }; + std::to_string(static_cast(args.schedule_wells.front().getPreferredPhase())) + }; } + inline quantity connection_productivity_index(const fn_args& args) { const quantity zero = { 0.0, rate_unit() };