Use well local indices when iterating over segments

This commit is contained in:
Joakim Hove
2021-05-20 08:01:20 +02:00
parent 1e9a5195e9
commit db731ac1ad
3 changed files with 37 additions and 30 deletions

View File

@@ -2018,16 +2018,18 @@ namespace Opm {
// \Note: eventually we need to hanlde the situations that some segments are shut
assert(0u + segment_set.size() == rst_segments.size());
auto * segment_pressure = &well_state.segPress()[top_segment_index];
auto * segment_rates = &well_state.segRates()[top_segment_index*np];
for (const auto& rst_segment : rst_segments) {
const int segment_index = segment_set.segmentNumberToIndex(rst_segment.first);
// recovering segment rates and pressure from the restart values
const auto pres_idx = data::SegmentPressures::Value::Pressure;
well_state.segPress()[top_segment_index + segment_index] = rst_segment.second.pressures[pres_idx];
segment_pressure[segment_index] = rst_segment.second.pressures[pres_idx];
const auto& rst_segment_rates = rst_segment.second.rates;
for (int p = 0; p < np; ++p) {
well_state.segRates()[(top_segment_index + segment_index) * np + p] = rst_segment_rates.get(phs[p]);
segment_rates[segment_index * np + p] = rst_segment_rates.get(phs[p]);
}
}
}