prevent negative oil fractions

This commit is contained in:
Stein Krogstad 2023-09-04 16:24:31 +02:00
parent 392573289f
commit 7981253f39

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;
}