mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-07 23:13:01 -06:00
Opm::WellState::init(): Handle shut wells
This is a minor bugfix to account for the presence of shut wells (characterised by "ctrls[w]->current < 0"). The existing code would lead to indexing outside the "ctrls" array in the context of a shut well.
This commit is contained in:
parent
e5ff636860
commit
d0fa32011b
@ -42,12 +42,15 @@ namespace Opm
|
||||
// to pressure in first perforation cell.
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
const WellControls* ctrl = wells->ctrls[w];
|
||||
if (ctrl->type[ctrl->current] == BHP) {
|
||||
bhp_[w] = ctrl->target[ctrl->current];
|
||||
} else {
|
||||
|
||||
if ((ctrl->current < 0) || // SHUT
|
||||
(ctrl->type[ctrl->current] != BHP)) {
|
||||
const int cell = wells->well_cells[wells->well_connpos[w]];
|
||||
bhp_[w] = state.pressure()[cell];
|
||||
}
|
||||
else {
|
||||
bhp_[w] = ctrl->target[ctrl->current];
|
||||
}
|
||||
}
|
||||
perfrates_.resize(wells->well_connpos[nw], 0.0);
|
||||
perfpress_.resize(wells->well_connpos[nw], -1e100);
|
||||
|
Loading…
Reference in New Issue
Block a user