Merge pull request #2263 from bska/fix-oob-ssol-index

Restart: Don't Access Solvent Saturation Unless Active
This commit is contained in:
Atgeirr Flø Rasmussen 2020-01-06 14:49:28 +01:00 committed by GitHub
commit 83c9efea04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2569,10 +2569,22 @@ private:
eclWriter_->eclOutputModule().initHysteresisParams(simulator, elemIdx);
eclWriter_->eclOutputModule().assignToFluidState(elemFluidState, elemIdx);
if (enableSolvent)
solventSaturation_[elemIdx] = eclWriter_->eclOutputModule().getSolventSaturation(elemIdx);
// Note: Function processRestartSaturations_() mutates the
// 'ssol' argument--the value from the restart file--if solvent
// is enabled. Then, store the updated solvent saturation into
// 'solventSaturation_'. Otherwise, just pass a dummy value to
// the function and discard the unchanged result. Do not index
// into 'solventSaturation_' unless solvent is enabled.
{
auto ssol = enableSolvent
? eclWriter_->eclOutputModule().getSolventSaturation(elemIdx)
: Scalar(0);
processRestartSaturations_(elemFluidState, solventSaturation_[elemIdx]);
processRestartSaturations_(elemFluidState, ssol);
if (enableSolvent)
solventSaturation_[elemIdx] = ssol;
}
lastRs_[elemIdx] = elemFluidState.Rs();
lastRv_[elemIdx] = elemFluidState.Rv();