diff --git a/opm/models/blackoil/blackoilintensivequantities.hh b/opm/models/blackoil/blackoilintensivequantities.hh index bd745a15c..c1a50c0ff 100644 --- a/opm/models/blackoil/blackoilintensivequantities.hh +++ b/opm/models/blackoil/blackoilintensivequantities.hh @@ -96,8 +96,10 @@ class BlackOilIntensiveQuantities enum { dimWorld = GridView::dimensionworld }; enum { compositionSwitchIdx = Indices::compositionSwitchIdx }; - static const bool compositionSwitchEnabled = Indices::gasEnabled; + static const bool compositionSwitchEnabled = Indices::compositionSwitchIdx >= 0; static const bool waterEnabled = Indices::waterEnabled; + static const bool gasEnabled = Indices::gasEnabled; + static const bool oilEnabled = Indices::oilEnabled; using Toolbox = MathToolbox; using DimMatrix = Dune::FieldMatrix; @@ -167,6 +169,9 @@ public: Sg = 0.0; } } + if (gasEnabled && waterEnabled && !oilEnabled) { + Sg = 1.0 - Sw; + } Valgrind::CheckDefined(Sg); Valgrind::CheckDefined(Sw);