diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index a6a8e6801..827d90f7f 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -2565,8 +2565,8 @@ namespace Opm duneDSolver_.reset(); - well_state.wellVaporizedOilRates()[index_of_well_] = 0.; - well_state.wellDissolvedGasRates()[index_of_well_] = 0.; + well_state.wellVaporizedOilRates(index_of_well_) = 0.; + well_state.wellDissolvedGasRates(index_of_well_) = 0.; // for the black oil cases, there will be four equations, // the first three of them are the mass balance equations, the last one is the pressure equations. @@ -2660,8 +2660,8 @@ namespace Opm // updating the solution gas rate and solution oil rate if (this->isProducer()) { - well_state.wellDissolvedGasRates()[index_of_well_] += perf_dis_gas_rate; - well_state.wellVaporizedOilRates()[index_of_well_] += perf_vap_oil_rate; + well_state.wellDissolvedGasRates(index_of_well_) += perf_dis_gas_rate; + well_state.wellVaporizedOilRates(index_of_well_) += perf_vap_oil_rate; } // store the perf pressure and rates diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index f34ec15c8..9c5c89b2b 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -584,8 +584,8 @@ namespace Opm const double volume = 0.002831684659200; // 0.1 cu ft; // the solution gas rate and solution oil rate needs to be reset to be zero for well_state. - well_state.wellVaporizedOilRates()[index_of_well_] = 0.; - well_state.wellDissolvedGasRates()[index_of_well_] = 0.; + well_state.wellVaporizedOilRates(index_of_well_) = 0.; + well_state.wellDissolvedGasRates(index_of_well_) = 0.; const int np = number_of_phases_; @@ -719,8 +719,8 @@ namespace Opm // updating the solution gas rate and solution oil rate if (this->isProducer()) { - well_state.wellDissolvedGasRates()[index_of_well_] += perf_dis_gas_rate; - well_state.wellVaporizedOilRates()[index_of_well_] += perf_vap_oil_rate; + well_state.wellDissolvedGasRates(index_of_well_) += perf_dis_gas_rate; + well_state.wellVaporizedOilRates(index_of_well_) += perf_vap_oil_rate; } if constexpr (has_energy) { diff --git a/opm/simulators/wells/WellState.cpp b/opm/simulators/wells/WellState.cpp index 2dbf0e9a4..6b622218b 100644 --- a/opm/simulators/wells/WellState.cpp +++ b/opm/simulators/wells/WellState.cpp @@ -255,8 +255,8 @@ void WellState::init(const std::vector& cellPressures, } well_reservoir_rates_.clear(); - well_dissolved_gas_rates_.resize(nw, 0.0); - well_vaporized_oil_rates_.resize(nw, 0.0); + well_dissolved_gas_rates_.clear(); + well_vaporized_oil_rates_.clear(); this->events_.clear(); { @@ -307,6 +307,8 @@ void WellState::init(const std::vector& cellPressures, first_perf_index_[w] = connpos; this->well_reservoir_rates_.add(wname, std::vector(np, 0)); + this->well_dissolved_gas_rates_.add(wname, 0); + this->well_vaporized_oil_rates_.add(wname, 0); } is_producer_.clear(); diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index 7fc40eac3..513f06c43 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -182,14 +182,14 @@ public: return well_reservoir_rates_[well_index]; } - std::vector& wellDissolvedGasRates() + double& wellDissolvedGasRates(std::size_t well_index) { - return well_dissolved_gas_rates_; + return well_dissolved_gas_rates_[well_index]; } - std::vector& wellVaporizedOilRates() + double& wellVaporizedOilRates(std::size_t well_index) { - return well_vaporized_oil_rates_; + return well_vaporized_oil_rates_[well_index]; } const std::vector& segRates() const @@ -498,11 +498,11 @@ private: // dissolved gas rates or solution gas production rates // should be zero for injection wells - std::vector well_dissolved_gas_rates_; + WellContainer well_dissolved_gas_rates_; // vaporized oil rates or solution oil producation rates // should be zero for injection wells - std::vector well_vaporized_oil_rates_; + WellContainer well_vaporized_oil_rates_; // some events happens to the well, like this well is a new well // or new well control keywords happens