diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index db13d5802..fdd8f86cf 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -929,33 +929,6 @@ setWsolvent(const Group& group, } } -data::GuideRateValue -BlackoilWellModelGeneric:: -getGuideRateValues(const Well& well) const -{ - auto grval = data::GuideRateValue{}; - - const auto& wname = well.name(); - if (!this->wellState().has(wname)) { - // No flow rates for 'wname' -- might be before well comes - // online (e.g., for the initial condition before simulation - // starts). - return grval; - } - - if (!this->guideRate_.has(wname)) { - // No guiderates exist for 'wname'. - return grval; - } - - const auto qs = WellGroupHelpers:: - getWellRateVector(this->wellState(), this->phase_usage_, wname); - - BlackoilWellModelGuideRates(*this).getGuideRateValues(qs, well.isInjector(), wname, grval); - - return grval; -} - data::GuideRateValue BlackoilWellModelGeneric:: getGuideRateValues(const Group& group) const @@ -1195,7 +1168,7 @@ calculateAllGroupGuiderates(const int reportStepIdx) const ? gr[gname].injection : gr[gname].production; - grval += this->getGuideRateValues(well); + grval += BlackoilWellModelGuideRates(*this).getGuideRateValues(well); }); // Visit wells and groups before their parents, meaning no group is diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index 193575c0e..6c5209ebe 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -272,7 +272,6 @@ protected: std::vector& resv_coeff) = 0; data::GuideRateValue getGuideRateValues(const Group& group) const; - data::GuideRateValue getGuideRateValues(const Well& well) const; data::GuideRateValue getGuideRateInjectionGroupValues(const Group& group) const; void assignWellGuideRates(data::Wells& wsrpt, diff --git a/opm/simulators/wells/BlackoilWellModelGuideRates.cpp b/opm/simulators/wells/BlackoilWellModelGuideRates.cpp index 2e703c93b..30a1f2683 100644 --- a/opm/simulators/wells/BlackoilWellModelGuideRates.cpp +++ b/opm/simulators/wells/BlackoilWellModelGuideRates.cpp @@ -58,4 +58,32 @@ getGuideRateValues(const GuideRate::RateVector& qs, } } +data::GuideRateValue +BlackoilWellModelGuideRates:: +getGuideRateValues(const Well& well) const +{ + auto grval = data::GuideRateValue{}; + + const auto& wname = well.name(); + if (!wellModel_.wellState().has(wname)) { + // No flow rates for 'wname' -- might be before well comes + // online (e.g., for the initial condition before simulation + // starts). + return grval; + } + + if (!wellModel_.guideRate().has(wname)) { + // No guiderates exist for 'wname'. + return grval; + } + + const auto qs = WellGroupHelpers:: + getWellRateVector(wellModel_.wellState(), wellModel_.phaseUsage(), wname); + + this->getGuideRateValues(qs, well.isInjector(), wname, grval); + + return grval; +} + + } diff --git a/opm/simulators/wells/BlackoilWellModelGuideRates.hpp b/opm/simulators/wells/BlackoilWellModelGuideRates.hpp index 690cd0795..14640646a 100644 --- a/opm/simulators/wells/BlackoilWellModelGuideRates.hpp +++ b/opm/simulators/wells/BlackoilWellModelGuideRates.hpp @@ -32,6 +32,7 @@ namespace Opm { class BlackoilWellModelGeneric; namespace data { class GuideRateValue; } class Group; +class Well; /// Class for handling the guide rates in the blackoil well model. class BlackoilWellModelGuideRates @@ -48,6 +49,9 @@ public: const std::string& wgname, data::GuideRateValue& grval) const; + //! \brief Obtain guide rate values for well. + data::GuideRateValue getGuideRateValues(const Well& well) const; + private: const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model };