From bd3fa0af8805f610aab8f9dbdc71b638b4745058 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 10 Dec 2020 08:11:19 +0100 Subject: [PATCH] Use enum Well::Status for well status in WellState --- opm/simulators/wells/WellState.hpp | 11 +++++++---- .../wells/WellStateFullyImplicitBlackoil.hpp | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index 7d51dfa18..98b30018f 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -69,7 +69,7 @@ namespace Opm // const int np = wells->number_of_phases; const int np = pu.num_phases; np_ = np; - open_for_output_.assign(nw, true); + status_.assign(nw, Well::Status::OPEN); bhp_.resize(nw, 0.0); thp_.resize(nw, 0.0); temperature_.resize(nw, 273.15 + 15.56); // standard condition temperature @@ -212,9 +212,12 @@ namespace Opm return np_; } + void openWell(int well_index) { + this->status_[well_index] = Well::Status::OPEN; + } virtual void shutWell(int well_index) { - this->open_for_output_[well_index] = false; + this->status_[well_index] = Well::Status::SHUT; this->thp_[well_index] = 0; this->bhp_[well_index] = 0; const int np = numPhases(); @@ -230,7 +233,7 @@ namespace Opm data::Wells dw; for( const auto& itr : this->wellMap_ ) { const auto well_index = itr.second[ 0 ]; - if (!this->open_for_output_[well_index]) + if (this->status_[well_index] != Well::Status::OPEN) continue; const auto& pwinfo = *parallel_well_info_[well_index]; @@ -307,7 +310,7 @@ namespace Opm std::vector perfpress_; int np_; protected: - std::vector open_for_output_; + std::vector status_; private: WellMapType wellMap_; diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp index 36ef1d02b..036b86021 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp +++ b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp @@ -559,7 +559,7 @@ namespace Opm for( const auto& wt : this->wellMap() ) { const auto w = wt.second[ 0 ]; const auto& pwinfo = *parallel_well_info_[w]; - if (!this->open_for_output_[w] || !pwinfo.isOwner()) + if ((this->status_[w] != Well::Status::OPEN) || !pwinfo.isOwner()) continue; auto& well = res.at( wt.first ); @@ -1178,7 +1178,7 @@ namespace Opm if (it != end) { // ... set the GRUP/not GRUP states. const int well_index = it->second[0]; - if (!this->open_for_output_[well_index]) { + if (this->status_[well_index] != Well::Status::OPEN) { // Well is shut. if (well.isInjector()) { globalIsInjectionGrup_[global_well_index] = 0;