avoid nan in the density calculation

This commit is contained in:
Tor Harald Sandve 2019-10-22 13:04:29 +02:00
parent 5267f3cf17
commit 775573e3b2

View File

@ -2338,10 +2338,10 @@ namespace Opm
const unsigned oilpos = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx); const unsigned oilpos = Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx);
double rs = 0.0; double rs = 0.0;
double rv = 0.0; double rv = 0.0;
if (!rsmax_perf.empty() && mix[oilpos] > 0.0) { if (!rsmax_perf.empty() && mix[oilpos] > 1e-12) {
rs = std::min(mix[gaspos]/mix[oilpos], rsmax_perf[perf]); rs = std::min(mix[gaspos]/mix[oilpos], rsmax_perf[perf]);
} }
if (!rvmax_perf.empty() && mix[gaspos] > 0.0) { if (!rvmax_perf.empty() && mix[gaspos] > 1e-12) {
rv = std::min(mix[oilpos]/mix[gaspos], rvmax_perf[perf]); rv = std::min(mix[oilpos]/mix[gaspos], rvmax_perf[perf]);
} }
if (rs != 0.0) { if (rs != 0.0) {