From fa829cce7ac15d4df1b404ed43d5981ac751774a Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 2 Jun 2021 11:47:45 +0200 Subject: [PATCH] Use well index for polymer perforation rates --- opm/simulators/wells/StandardWell_impl.hpp | 2 +- opm/simulators/wells/WellState.cpp | 4 ++-- opm/simulators/wells/WellState.hpp | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 085d7c4b8..9e91e7556 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -795,7 +795,7 @@ namespace Opm cq_s_poly *= extendEval(intQuants.polymerConcentration() * intQuants.polymerViscosityCorrection()); } // Note. Efficiency factor is handled in the output layer - auto * perf_rate_polymer = &well_state.perfRatePolymer()[first_perf_]; + auto * perf_rate_polymer = well_state.perfRatePolymer(this->index_of_well_); perf_rate_polymer[perf] = cq_s_poly.value(); cq_s_poly *= well_efficiency_factor_; diff --git a/opm/simulators/wells/WellState.cpp b/opm/simulators/wells/WellState.cpp index 503ac0e36..cbfa7d944 100644 --- a/opm/simulators/wells/WellState.cpp +++ b/opm/simulators/wells/WellState.cpp @@ -778,7 +778,7 @@ void WellState::reportConnections(data::Well& well, comp.rates.set( pi [ i ], *(connPI + i) ); } if ( pu.has_polymer ) { - const auto * perf_polymer_rate = &this->perfRatePolymer()[wt.second[1]]; + const auto * perf_polymer_rate = this->perfRatePolymer(well_index); comp.rates.set( rt::polymer, perf_polymer_rate[local_comp_index]); } if ( pu.has_brine ) { @@ -961,7 +961,7 @@ double WellState::solventWellRate(const int w) const double WellState::polymerWellRate(const int w) const { - const auto * perf_rates_polymer = &perfRatePolymer_[first_perf_index_[w]]; + const auto * perf_rates_polymer = this->perfRatePolymer(w); return parallel_well_info_[w]->sumPerfValues(perf_rates_polymer, perf_rates_polymer + this->numPerf(w)); } diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index e3733e0c2..0ba73e6c0 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -160,8 +160,13 @@ public: double solventWellRate(const int w) const; /// One rate pr well connection. - std::vector& perfRatePolymer() { return perfRatePolymer_; } - const std::vector& perfRatePolymer() const { return perfRatePolymer_; } + double * perfRatePolymer(std::size_t well_index) { + return &this->perfRatePolymer_[this->first_perf_index_[well_index]]; + } + + const double * perfRatePolymer(std::size_t well_index) const { + return &this->perfRatePolymer_[this->first_perf_index_[well_index]]; + } /// One rate pr well double polymerWellRate(const int w) const;