diff --git a/opm/simulators/wells/WellState.cpp b/opm/simulators/wells/WellState.cpp index 3aca9016f..3b2870bc9 100644 --- a/opm/simulators/wells/WellState.cpp +++ b/opm/simulators/wells/WellState.cpp @@ -273,7 +273,7 @@ void WellState::init(const std::vector& cellPressures, report_step, wells_ecl); well_rates.clear(); - this->inactive_well_names_ = schedule.getInactiveWellNamesAtEnd(); + this->permanently_inactive_well_names_ = schedule.getInactiveWellNamesAtEnd(); for (const auto& wname : schedule.wellNames(report_step)) { well_rates.insert({wname, std::make_pair(false, std::vector(this->numPhases()))}); @@ -695,6 +695,9 @@ void WellState::initWellStateMSWell(const std::vector& wells_ecl, // what we do here, is to set the segment rates and perforation rates for (int w = 0; w < nw; ++w) { const auto& well_ecl = wells_ecl[w]; + if (this->is_permanently_inactive_well(well_ecl.name())) + continue; + auto& ws = this->well(w); if (well_ecl.isMultiSegment()) { @@ -725,14 +728,9 @@ void WellState::initWellStateMSWell(const std::vector& wells_ecl, n_activeperf++; } } - // If perf_data does not contain all active perfs, the well is distributed or inactive - // For inactive wells there is no need for calculating an initial solution - // \todo{ Update the procedure below to work for actually distributed wells. } + if (static_cast(ws.perf_data.size()) != n_activeperf) - if (this->is_inactive_well(well_ecl.name())) - continue; - else - throw std::logic_error("Distributed multi-segment wells cannot be initialized properly yet."); + throw std::logic_error("Distributed multi-segment wells cannot be initialized properly yet."); std::vector> segment_inlets(well_nseg); @@ -1061,7 +1059,7 @@ bool WellState::operator==(const WellState& rhs) const return this->alq_state == rhs.alq_state && this->well_rates == rhs.well_rates && this->wells_ == rhs.wells_ && - this->inactive_well_names_ == rhs.inactive_well_names_; + this->permanently_inactive_well_names_ == rhs.permanently_inactive_well_names_; } template diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index 56c1ba550..d6d085234 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -348,12 +348,12 @@ public: for (auto& w : wells_) { serializer(w); } - serializer(inactive_well_names_); + serializer(permanently_inactive_well_names_); } private: - bool is_inactive_well(const std::string& wname) const { - return std::find(this->inactive_well_names_.begin(), this->inactive_well_names_.end(), wname) != this->inactive_well_names_.end(); + bool is_permanently_inactive_well(const std::string& wname) const { + return std::find(this->permanently_inactive_well_names_.begin(), this->permanently_inactive_well_names_.end(), wname) != this->permanently_inactive_well_names_.end(); } PhaseUsage phase_usage_; @@ -377,8 +377,8 @@ private: // not. std::map>> well_rates; - // Keep track of inactive well names - std::vector inactive_well_names_; + // Keep track of permanently inactive well names + std::vector permanently_inactive_well_names_; data::Segment reportSegmentResults(const int well_id,