From 89eb6e56598eabbecdcfd27f61dfe205c4a840f0 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 10 Feb 2021 14:58:13 +0100 Subject: [PATCH] Extract functionality to update ecl wells to separate function --- opm/simulators/wells/BlackoilWellModel.hpp | 1 + .../wells/BlackoilWellModel_impl.hpp | 43 ++++++++++++------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 50f18cb83..d9015afb4 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -480,6 +480,7 @@ namespace Opm { void setWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, double wsolvent); + void updateEclWell(int timeStepIdx, int well_index); void runWellPIScaling(const int timeStepIdx, DeferredLogger& local_deferredLogger); void assignWellGuideRates(data::Wells& wsrpt) const; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 219c3f9fe..e1ba85743 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -2551,6 +2551,32 @@ namespace Opm { + template + void + BlackoilWellModel:: + updateEclWell(int timeStepIdx, int well_index) + { + const auto& schedule = this->ebosSimulator_.vanguard().schedule(); + const auto& wname = this->wells_ecl_[well_index].name(); + this->wells_ecl_[well_index] = schedule.getWell(wname, timeStepIdx); + + const auto& well = this->wells_ecl_[well_index]; + auto& pd = this->well_perf_data_[well_index]; + auto pdIter = pd.begin(); + for (const auto& conn : well.getConnections()) { + if (conn.state() != Connection::State::SHUT) { + pdIter->connection_transmissibility_factor = conn.CF(); + ++pdIter; + } + } + + this->well_state_.resetConnectionTransFactors(well_index, pd); + this->prod_index_calc_[well_index].reInit(well); + } + + + + template void BlackoilWellModel:: @@ -2607,23 +2633,9 @@ namespace Opm { { const auto& wname = this->wells_ecl_[well_index].name(); auto& schedule = this->ebosSimulator_.vanguard().schedule(); // Mutable - schedule.applyWellProdIndexScaling(wname, timeStepIdx, newWellPI); - this->wells_ecl_[well_index] = schedule.getWell(wname, timeStepIdx); } - - const auto& well = this->wells_ecl_[well_index]; - auto& pd = this->well_perf_data_[well_index]; - auto pdIter = pd.begin(); - for (const auto& conn : well.getConnections()) { - if (conn.state() != Connection::State::SHUT) { - pdIter->connection_transmissibility_factor = conn.CF(); - ++pdIter; - } - } - - this->well_state_.resetConnectionTransFactors(well_index, pd); - this->prod_index_calc_[well_index].reInit(well); + this->updateEclWell(timeStepIdx, well_index); }; // Minimal well setup to compute PI/II values @@ -2645,7 +2657,6 @@ namespace Opm { } this->calculateProductivityIndexValues(local_deferredLogger); - this->previous_well_state_ = std::move(saved_previous_well_state); }