diff --git a/opm/simulators/wells/WellState.cpp b/opm/simulators/wells/WellState.cpp index 65cf6691d..b88aaa0db 100644 --- a/opm/simulators/wells/WellState.cpp +++ b/opm/simulators/wells/WellState.cpp @@ -285,7 +285,6 @@ void WellState::init(const std::vector& cellPressures, perf_skin_pressure_.clear(); perf_skin_pressure_.resize(nperf, 0.0); - num_perf_.resize(nw, 0); first_perf_index_.resize(nw, 0); first_perf_index_[0] = 0; for (int w = 0; w < nw; ++w) { @@ -307,7 +306,6 @@ void WellState::init(const std::vector& cellPressures, } perf_press[perf] = cellPressures[well_perf_data[w][perf].cell_index]; } - num_perf_[w] = num_perf_this_well; first_perf_index_[w] = connpos; this->well_reservoir_rates_.add(wname, std::vector(np, 0)); @@ -1020,19 +1018,19 @@ WellState::calculateSegmentRates(const std::vector>& segment_in double WellState::solventWellRate(const int w) const { const auto * perf_rates_solvent = &perfRateSolvent_[first_perf_index_[w]]; - return parallel_well_info_[w]->sumPerfValues(perf_rates_solvent, perf_rates_solvent + this->num_perf_[w]); + return parallel_well_info_[w]->sumPerfValues(perf_rates_solvent, perf_rates_solvent + this->numPerf(w)); } double WellState::polymerWellRate(const int w) const { const auto * perf_rates_polymer = &perfRatePolymer_[first_perf_index_[w]]; - return parallel_well_info_[w]->sumPerfValues(perf_rates_polymer, perf_rates_polymer + this->num_perf_[w]); + return parallel_well_info_[w]->sumPerfValues(perf_rates_polymer, perf_rates_polymer + this->numPerf(w)); } double WellState::brineWellRate(const int w) const { const auto * perf_rates_brine = &perfRateBrine_[first_perf_index_[w]]; - return parallel_well_info_[w]->sumPerfValues(perf_rates_brine, perf_rates_brine + this->num_perf_[w]); + return parallel_well_info_[w]->sumPerfValues(perf_rates_brine, perf_rates_brine + this->numPerf(w)); } int WellState::topSegmentIndex(const int w) const @@ -1065,7 +1063,7 @@ void WellState::shutWell(int well_index) } const auto first = this->first_perf_index_[well_index]*np; - const auto last = first + this->num_perf_[well_index]*np; + const auto last = first + this->numPerf(well_index)*np; std::fill(this->conn_productivity_index_.begin() + first, this->conn_productivity_index_.begin() + last, 0.0); } diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index cf9262e91..7feb28b4f 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -449,6 +449,8 @@ public: const std::vector& perfPress(const std::string& wname) const { return perfpress_[wname]; } + std::size_t numPerf(std::size_t well_index) const { return this->perfpress_[well_index].size(); } + private: WellMapType wellMap_; @@ -477,7 +479,6 @@ private: // iterate over all perforations of a given well // for (int perf = first_perf_index_[well_index]; perf < first_perf_index_[well_index] + num_perf_[well_index]; ++perf) std::vector first_perf_index_; - std::vector num_perf_; WellContainer current_injection_controls_; WellContainer current_production_controls_;