Merge pull request #4834 from steink/assure_non_negative_oil_fraction

Prevent negative oil fractions in well segments
This commit is contained in:
Bård Skaflestad
2023-09-06 12:44:21 +02:00
committed by GitHub

View File

@@ -499,6 +499,12 @@ volumeFraction(const int seg,
/* if (has_solvent) {
oil_fraction -= evaluation_[seg][SFrac];
} */
// oil_fraction may turn out negative due to round-off, in that case
// set to zero (but keep derivatives)
if (oil_fraction.value() < 0.0) {
oil_fraction.setValue(0.0);
}
return oil_fraction;
}