From 4e9e60a71b39e314065e3cec4c24adf568f8ab40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 20 Oct 2020 00:10:27 +0200 Subject: [PATCH] Refactor Well Guide Rate Summary Assignment In anticipation of adding more steps later. --- opm/simulators/wells/BlackoilWellModel.hpp | 12 ++-------- .../wells/BlackoilWellModel_impl.hpp | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 43b079a0c..80713e911 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -214,16 +214,7 @@ namespace Opm { { auto wsrpt = well_state_.report(phase_usage_, Opm::UgGridHelpers::globalCell(grid())); - for (const auto& well : this->wells_ecl_) { - auto xwPos = wsrpt.find(well.name()); - if (xwPos == wsrpt.end()) { // No well results. Unexpected. - continue; - } - - auto& grval = xwPos->second.guide_rates; - grval.clear(); - grval += this->getGuideRateValues(well); - } + this->assignWellGuideRates(wsrpt); return wsrpt; } @@ -473,6 +464,7 @@ namespace Opm { void setWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, double wsolvent); + void assignWellGuideRates(data::Wells& wsrpt) const; void assignGroupValues(const int reportStepIdx, const Schedule& sched, std::map& gvalues) const; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 32cda46d1..79c99e14e 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2591,6 +2591,29 @@ namespace Opm { } } + + + + + template + void + BlackoilWellModel:: + assignWellGuideRates(data::Wells& wsrpt) const + { + for (const auto& well : this->wells_ecl_) { + auto xwPos = wsrpt.find(well.name()); + if (xwPos == wsrpt.end()) { // No well results. Unexpected. + continue; + } + + xwPos->second.guide_rates = this->getGuideRateValues(well); + } + } + + + + + template void BlackoilWellModel::