Merge pull request #117 from bska/master

Release preparation: Fix out-of-bounds indexing in context of shut wells
This commit is contained in:
Atgeirr Flø Rasmussen 2013-01-18 04:30:26 -08:00
commit 40f9970eb8

View File

@ -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);