mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
[bugfix] Prevent accessing undefined variables for brine.
It seems like currentValue.primaryVarsMeaningBrine() will return an uninitialized variable if enableSaltPrecipitation is false. This can lead to undefined behavior especially in a parallel run. Hence we also check whether salt precipitation is is enabled and do nothing otherwise.
This commit is contained in:
parent
292a4cc517
commit
fc0907b78d
@ -348,7 +348,9 @@ protected:
|
||||
const double sign = delta >= 0. ? 1. : -1.;
|
||||
delta = sign * std::min(std::abs(delta), maxTempChange_);
|
||||
}
|
||||
else if (enableBrine && pvIdx == Indices::saltConcentrationIdx && currentValue.primaryVarsMeaningBrine() == PrimaryVariables::Sp) {
|
||||
else if (enableBrine && pvIdx == Indices::saltConcentrationIdx &&
|
||||
enableSaltPrecipitation &&
|
||||
currentValue.primaryVarsMeaningBrine() == PrimaryVariables::Sp) {
|
||||
const double maxSaltSaturationChange = 0.1;
|
||||
const double sign = delta >= 0. ? 1. : -1.;
|
||||
delta = sign * std::min(std::abs(delta), maxSaltSaturationChange);
|
||||
|
Loading…
Reference in New Issue
Block a user