From f62b0a5d1e21548595a69bd49e40c662b3d0c3ed Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 2 Jun 2021 11:32:11 +0200 Subject: [PATCH] Use well index for well water perf velocity --- opm/simulators/wells/StandardWell_impl.hpp | 4 ++-- opm/simulators/wells/WellState.cpp | 4 ++-- opm/simulators/wells/WellState.hpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 877824976..085d7c4b8 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -1305,7 +1305,7 @@ namespace Opm // other primary variables related to polymer injectivity study if constexpr (Base::has_polymermw) { if (this->isInjector()) { - auto * perf_water_velocity = &well_state.perfWaterVelocity()[this->first_perf_]; + auto * perf_water_velocity = well_state.perfWaterVelocity(this->index_of_well_); auto * perf_skin_pressure = well_state.perfSkinPressure(this->index_of_well_); for (int perf = 0; perf < number_of_perforations_; ++perf) { perf_water_velocity[perf] = primary_variables_[Bhp + 1 + perf]; @@ -2833,7 +2833,7 @@ namespace Opm // other primary variables related to polymer injection if constexpr (Base::has_polymermw) { if (this->isInjector()) { - const auto * water_velocity = &well_state.perfWaterVelocity()[first_perf_]; + const auto * water_velocity = well_state.perfWaterVelocity(this->index_of_well_); const auto * skin_pressure = well_state.perfSkinPressure(this->index_of_well_); for (int perf = 0; perf < number_of_perforations_; ++perf) { primary_variables_[Bhp + 1 + perf] = water_velocity[perf]; diff --git a/opm/simulators/wells/WellState.cpp b/opm/simulators/wells/WellState.cpp index fb6784480..503ac0e36 100644 --- a/opm/simulators/wells/WellState.cpp +++ b/opm/simulators/wells/WellState.cpp @@ -482,11 +482,11 @@ void WellState::init(const std::vector& cellPressures, { auto * throughput_target = this->perfThroughput(newIndex); auto * pressure_target = this->perfSkinPressure(newIndex); - auto * velocity_target = &perf_water_velocity_[connpos]; + auto * velocity_target = this->perfWaterVelocity(newIndex); const auto * throughput_src = prevState->perfThroughput(oldIndex); const auto * pressure_src = prevState->perfSkinPressure(oldIndex); - const auto * velocity_src = &prevState->perfWaterVelocity()[oldPerf_idx_beg]; + const auto * velocity_src = prevState->perfWaterVelocity(oldIndex); for (int perf = 0; perf < num_perf_this_well; ++perf) { diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index df2edf11f..e3733e0c2 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -254,12 +254,12 @@ public: return &perf_skin_pressure_[this->first_perf_index_[well_index]]; } - std::vector& perfWaterVelocity() { - return perf_water_velocity_; + double * perfWaterVelocity(std::size_t well_index) { + return &perf_water_velocity_[this->first_perf_index_[well_index]]; } - const std::vector& perfWaterVelocity() const { - return perf_water_velocity_; + const double * perfWaterVelocity(std::size_t well_index) const { + return &perf_water_velocity_[this->first_perf_index_[well_index]]; } template