From f0c738ea34a6e5e4299b4bfeb60f643a0f6788df Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 9 Dec 2020 11:16:15 +0100 Subject: [PATCH] Reflect Well Object's Status Flag in Well State --- opm/simulators/wells/WellState.hpp | 6 ++++++ .../wells/WellStateFullyImplicitBlackoil.hpp | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index bd4059d26..d71cfbe74 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -398,9 +398,15 @@ namespace Opm : (prod_controls.cmode == Well::ProducerCMode::GRUP); const double inj_surf_rate = well.isInjector() ? inj_controls.surface_rate : 0.0; // To avoid a "maybe-uninitialized" warning. + const double local_pressure = well_perf_data_[w].empty() ? 0 : cellPressures[well_perf_data_[w][0].cell_index]; const double global_pressure = well_info.broadcastFirstPerforationValue(local_pressure); + + if (well.getStatus() == Well::Status::OPEN) { + this->openWell(w); + } + if (well.getStatus() == Well::Status::STOP) { // Stopped well: // 1. Rates: zero well rates. diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp index e1f120dec..2c623095c 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp +++ b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp @@ -190,6 +190,23 @@ namespace Opm perfRateBrine_.clear(); perfRateBrine_.resize(nperf, 0.0); + + for (int w = 0; w < nw; ++w) { + switch (wells_ecl[w].getStatus()) { + case Well::Status::SHUT: + this->shutWell(w); + break; + + case Well::Status::STOP: + this->stopWell(w); + break; + + default: + this->openWell(w); + break; + } + } + // intialize wells that have been there before // order may change so the mapping is based on the well name if (prevState && !prevState->wellMap().empty()) {