From eec353454e1f46be01a695957c2bef0aa41c95db Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Thu, 12 Dec 2024 08:37:56 +0100 Subject: [PATCH] Allow for zero guiderates computed from NETV --- opm/input/eclipse/Schedule/Group/Group.hpp | 3 +-- opm/input/eclipse/Schedule/Group/GuideRate.cpp | 14 +++++++------- opm/input/eclipse/Schedule/Group/GuideRate.hpp | 8 ++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/opm/input/eclipse/Schedule/Group/Group.hpp b/opm/input/eclipse/Schedule/Group/Group.hpp index e394cd0155d..4b8b72d7c05 100644 --- a/opm/input/eclipse/Schedule/Group/Group.hpp +++ b/opm/input/eclipse/Schedule/Group/Group.hpp @@ -119,8 +119,7 @@ class Group { VOID = 2, NETV = 3, RESV = 4, - POTN = 5, - NO_GUIDE_RATE = 6 + NO_GUIDE_RATE = 5 }; static GuideRateInjTarget GuideRateInjTargetFromString( const std::string& stringValue ); static GuideRateInjTarget GuideRateInjTargetFromInt(int ecl_id); diff --git a/opm/input/eclipse/Schedule/Group/GuideRate.cpp b/opm/input/eclipse/Schedule/Group/GuideRate.cpp index e05f8e7ea55..75ca53ddb4b 100644 --- a/opm/input/eclipse/Schedule/Group/GuideRate.cpp +++ b/opm/input/eclipse/Schedule/Group/GuideRate.cpp @@ -283,22 +283,22 @@ void Opm::GuideRate::group_compute(const std::string& wgname, } } -void Opm::GuideRate::compute(const std::string& wgname, - const Phase& phase, - const std::size_t report_step, - const double guide_rate) +void Opm::GuideRate::compute(const std::string& wgname, + const Phase& phase, + const std::size_t report_step, + const std::optional guide_rate) { const auto& config = this->schedule[report_step].guide_rate(); if (!config.has_injection_group(phase, wgname)) return; - if (guide_rate > 0) { - this->injection_group_values[std::make_pair(phase, wgname)] = guide_rate; + if (guide_rate) { + this->injection_group_values[std::make_pair(phase, wgname)] = *guide_rate; return; } const auto& group = config.injection_group(phase, wgname); - if (group.target == Group::GuideRateInjTarget::POTN) { + if (group.target == Group::GuideRateInjTarget::NO_GUIDE_RATE) { return; } this->injection_group_values[std::make_pair(phase, wgname)] = group.guide_rate; diff --git a/opm/input/eclipse/Schedule/Group/GuideRate.hpp b/opm/input/eclipse/Schedule/Group/GuideRate.hpp index 110b353f8d4..79ab0165098 100644 --- a/opm/input/eclipse/Schedule/Group/GuideRate.hpp +++ b/opm/input/eclipse/Schedule/Group/GuideRate.hpp @@ -122,10 +122,10 @@ class GuideRate const double gas_pot, const double wat_pot); - void compute(const std::string& wgname, - const Phase& phase, - const std::size_t report_step, - const double guide_rate); + void compute(const std::string& wgname, + const Phase& phase, + const std::size_t report_step, + const std::optional guide_rate); bool has(const std::string& name) const; bool hasPotentials(const std::string& name) const;