mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-16 20:24:48 -06:00
assemble: Fix out-of-bounds indexing
The 'material_balance_eq' is indexed by active, not canonical, phase indices. Replace 'Oil' and 'Gas' with the appropriate 'phase_pos' values.
This commit is contained in:
parent
78b87b8857
commit
a5d3017062
@ -732,18 +732,18 @@ namespace {
|
||||
// The extra terms in the accumulation part of the equation are already handled.
|
||||
if (active_[ Oil ] && active_[ Gas ]) {
|
||||
const int po = fluid_.phaseUsage().phase_pos[ Oil ];
|
||||
const int pg = fluid_.phaseUsage().phase_pos[ Gas ];
|
||||
|
||||
const UpwindSelector<double> upwindOil(grid_, ops_,
|
||||
rq_[po].head.value());
|
||||
const ADB rs_face = upwindOil.select(state.rs);
|
||||
|
||||
residual_.material_balance_eq[ Gas ] += ops_.div * (rs_face * rq_[po].mflux);
|
||||
|
||||
const int pg = fluid_.phaseUsage().phase_pos[ Gas ];
|
||||
const UpwindSelector<double> upwindGas(grid_, ops_,
|
||||
rq_[pg].head.value());
|
||||
const ADB rv_face = upwindGas.select(state.rv);
|
||||
|
||||
residual_.material_balance_eq[ Oil ] += ops_.div * (rv_face * rq_[pg].mflux);
|
||||
residual_.material_balance_eq[ pg ] += ops_.div * (rs_face * rq_[po].mflux);
|
||||
residual_.material_balance_eq[ po ] += ops_.div * (rv_face * rq_[pg].mflux);
|
||||
|
||||
// DUMP(residual_.material_balance_eq[ Gas ]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user