mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
variableState: Don't reference non-existing variable
The "xvar" exists only if Gas is active. Therefore, we cannot extract that variable from "vars" unless we know that Gas is an active phase. Failing to do so would wrongfully increment 'nextvar' whence the final BHP variable would be an out-of-bounds access.
This commit is contained in:
parent
13d3a42448
commit
35d883319b
@ -532,8 +532,8 @@ namespace {
|
||||
std::vector<int> all_cells = buildAllCells(nc);
|
||||
ADB rsSat = fluidRsSat(state.pressure,all_cells);
|
||||
ADB rvSat = fluidRvSat(state.pressure,all_cells);
|
||||
ADB xvar = vars[ nextvar++ ];
|
||||
if (active_[ Gas]) {
|
||||
ADB xvar = vars[ nextvar++ ];
|
||||
ADB sg = isSg*xvar + isRv* so;
|
||||
state.saturation[ pu.phase_pos[ Gas ] ] = sg;
|
||||
so = so - sg;
|
||||
|
Loading…
Reference in New Issue
Block a user