From f5d3489d23fb070532854a268d58c942fbfb7be3 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Wed, 11 Oct 2023 11:33:02 +0200 Subject: [PATCH] distinguishing report step and time step for the funcitons related to createWellContainer() and runWellPIScaling(). So it is not exhaustive, but we should do it gradually. --- opm/simulators/wells/BlackoilWellModel.hpp | 4 +-- .../wells/BlackoilWellModelGeneric.cpp | 26 +++++++++---------- .../wells/BlackoilWellModelGeneric.hpp | 2 +- .../wells/BlackoilWellModel_impl.hpp | 14 +++++----- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 181a84636..d646a8e95 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -370,11 +370,11 @@ namespace Opm { void initializeWellState(const int timeStepIdx); // create the well container - void createWellContainer(const int time_step) override; + void createWellContainer(const int report_step) override; WellInterfacePtr createWellPointer(const int wellID, - const int time_step) const; + const int report_step) const; template std::unique_ptr diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 9e3bf5a09..37e59967d 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -1290,27 +1290,27 @@ updateWellPotentials(const int reportStepIdx, void BlackoilWellModelGeneric:: -runWellPIScaling(const int timeStepIdx, +runWellPIScaling(const int reportStepIdx, DeferredLogger& local_deferredLogger) { - if (this->last_run_wellpi_.has_value() && (*this->last_run_wellpi_ == timeStepIdx)) { + if (this->last_run_wellpi_.has_value() && (*this->last_run_wellpi_ == reportStepIdx)) { // We've already run WELPI scaling for this report step. Most // common for the very first report step. Don't redo WELPI scaling. return; } - auto hasWellPIEvent = [this, timeStepIdx](const int well_index) -> bool + auto hasWellPIEvent = [this, reportStepIdx](const int well_index) -> bool { - return this->schedule()[timeStepIdx].wellgroup_events() + return this->schedule()[reportStepIdx].wellgroup_events() .hasEvent(this->wells_ecl_[well_index].name(), ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX); }; - auto updateEclWell = [this, timeStepIdx](const int well_index) -> void + auto updateEclWell = [this, reportStepIdx](const int well_index) -> void { const auto& schedule = this->schedule(); const auto& wname = this->wells_ecl_[well_index].name(); - this->wells_ecl_[well_index] = schedule.getWell(wname, timeStepIdx); + this->wells_ecl_[well_index] = schedule.getWell(wname, reportStepIdx); const auto& well = this->wells_ecl_[well_index]; auto& pd = this->well_perf_data_[well_index]; @@ -1328,12 +1328,12 @@ runWellPIScaling(const int timeStepIdx, auto rescaleWellPI = - [this, timeStepIdx](const int well_index, - const double newWellPI) -> void + [this, reportStepIdx](const int well_index, + const double newWellPI) -> void { const auto& wname = this->wells_ecl_[well_index].name(); - schedule_.applyWellProdIndexScaling(wname, timeStepIdx, newWellPI); + schedule_.applyWellProdIndexScaling(wname, reportStepIdx, newWellPI); }; // Minimal well setup to compute PI/II values @@ -1341,13 +1341,13 @@ runWellPIScaling(const int timeStepIdx, auto saved_previous_wgstate = this->prevWGState(); this->commitWGState(); - this->createWellContainer(timeStepIdx); + this->createWellContainer(reportStepIdx); this->inferLocalShutWells(); - this->initWellContainer(timeStepIdx); + this->initWellContainer(reportStepIdx); this->calculateProductivityIndexValues(local_deferredLogger); - this->calculateProductivityIndexValuesShutWells(timeStepIdx, local_deferredLogger); + this->calculateProductivityIndexValuesShutWells(reportStepIdx, local_deferredLogger); this->commitWGState(std::move(saved_previous_wgstate)); } @@ -1360,7 +1360,7 @@ runWellPIScaling(const int timeStepIdx, } } - this->last_run_wellpi_ = timeStepIdx; + this->last_run_wellpi_ = reportStepIdx; } bool diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index e7f58457f..6952eefb5 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -407,7 +407,7 @@ protected: DeferredLogger& deferred_logger) = 0; virtual void calculateProductivityIndexValues(DeferredLogger& deferred_logger) = 0; - void runWellPIScaling(const int timeStepIdx, + void runWellPIScaling(const int reportStepIdx, DeferredLogger& local_deferredLogger); /// \brief get compressed index for interior cells (-1, otherwise diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index b89cbc741..80680aeda 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -754,7 +754,7 @@ namespace Opm { template void BlackoilWellModel:: - createWellContainer(const int time_step) + createWellContainer(const int report_step) { DeferredLogger local_deferredLogger; @@ -775,7 +775,7 @@ namespace Opm { const std::string& well_name = well_ecl.name(); const auto well_status = this->schedule() - .getWell(well_name, time_step).getStatus(); + .getWell(well_name, report_step).getStatus(); if ((well_ecl.getStatus() == Well::Status::SHUT) || (well_status == Well::Status::SHUT)) @@ -881,7 +881,7 @@ namespace Opm { wellIsStopped = true; } - well_container_.emplace_back(this->createWellPointer(w, time_step)); + well_container_.emplace_back(this->createWellPointer(w, report_step)); if (wellIsStopped) well_container_.back()->stopWell(); @@ -900,7 +900,7 @@ namespace Opm { for (auto& w : well_container_) well_container_generic_.push_back(w.get()); - const auto& network = schedule()[time_step].network(); + const auto& network = schedule()[report_step].network(); if (network.active() && !this->node_pressures_.empty()) { for (auto& well: well_container_generic_) { // Producers only, since we so far only support the @@ -928,15 +928,15 @@ namespace Opm { template typename BlackoilWellModel::WellInterfacePtr BlackoilWellModel:: - createWellPointer(const int wellID, const int time_step) const + createWellPointer(const int wellID, const int report_step) const { const auto is_multiseg = this->wells_ecl_[wellID].isMultiSegment(); if (! (this->param_.use_multisegment_well_ && is_multiseg)) { - return this->template createTypedWellPointer>(wellID, time_step); + return this->template createTypedWellPointer>(wellID, report_step); } else { - return this->template createTypedWellPointer>(wellID, time_step); + return this->template createTypedWellPointer>(wellID, report_step); } }