From b0dc5c0a63e8289eb7839579d09c59298d883fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Fri, 27 Nov 2020 14:50:08 +0100 Subject: [PATCH] Well PI: Use Appropriate Calculator for Each Well The original code assumed that well_container_.size() == numLocalWells() This assumption does not hold when wells open/shut dynamically in the context of WECON and/or WTEST. Switch to indexing into the 'prod_index_calc_' vector using the well's own linear index instead of manually advancing iterators. Pointy Hat: [at]bska --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 2bc298e80..52e3cf1be 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1471,13 +1471,11 @@ namespace Opm { return; } - auto piCalc = this->prod_index_calc_.begin(); for (const auto& wellPtr : this->well_container_) { wellPtr->updateProductivityIndex(this->ebosSimulator_, - *piCalc, + this->prod_index_calc_[wellPtr->indexOfWell()], this->well_state_, deferred_logger); - ++piCalc; } }