Use well index for PerfPhaseRates

This commit is contained in:
Joakim Hove 2021-05-24 08:59:04 +02:00
parent 89a712603f
commit ab5c937268
3 changed files with 7 additions and 9 deletions

View File

@ -1992,7 +1992,7 @@ namespace Opm {
auto& perf_pressure = well_state.perfPress(well_index);
auto& perf_rates = well_state.perfRates(well_index);
auto * perf_phase_rates = well_state.mutable_perfPhaseRates().data() + wm.second[1]*np;
auto * perf_phase_rates = &well_state.mutable_perfPhaseRates()[wm.second[1]*np];
const auto& perf_data = this->well_perf_data_[well_index];
for (std::size_t perf_index = 0; perf_index < perf_data.size(); perf_index++) {

View File

@ -582,20 +582,18 @@ namespace Opm
// the maximum water cut value of the completions
// it is used to identify the most offending completion
double max_ratio_completion = 0;
const int np = number_of_phases_;
const auto * perf_phase_rates = &well_state.perfPhaseRates()[first_perf_ * np];
// look for the worst_offending_completion
for (const auto& completion : completions_) {
const int np = number_of_phases_;
std::vector<double> completion_rates(np, 0.0);
// looping through the connections associated with the completion
const std::vector<int>& conns = completion.second;
for (const int c : conns) {
const int index_con = c + first_perf_;
for (int p = 0; p < np; ++p) {
const double connection_rate = well_state.perfPhaseRates()[index_con * np + p];
const double connection_rate = perf_phase_rates[c * np + p];
completion_rates[p] += connection_rate;
}
} // end of for (const int c : conns)

View File

@ -787,11 +787,11 @@ void WellState::reportConnections(data::Well& well,
for( auto& comp : well.connections) {
const auto connPhaseOffset = np * (wt.second[1] + local_comp_index);
const auto rates = this->perfPhaseRates().begin() + connPhaseOffset;
const auto connPI = this->connectionProductivityIndex().begin() + connPhaseOffset;
const auto * rates = &this->perfPhaseRates()[connPhaseOffset];
const auto connPI = this->connectionProductivityIndex().begin() + connPhaseOffset;
for( int i = 0; i < np; ++i ) {
comp.rates.set( phs[ i ], *(rates + i) );
comp.rates.set( phs[ i ], rates[i] );
comp.rates.set( pi [ i ], *(connPI + i) );
}
if ( pu.has_polymer ) {