From abd775fe21266efb80618c1686acb541ffd43e4b Mon Sep 17 00:00:00 2001 From: Paul Egberts Date: Sun, 1 Aug 2021 21:19:13 +0200 Subject: [PATCH] fix for gas-water system --- opm/models/blackoil/blackoilprimaryvariables.hh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/opm/models/blackoil/blackoilprimaryvariables.hh b/opm/models/blackoil/blackoilprimaryvariables.hh index 01f106af1..0a4cee6a7 100644 --- a/opm/models/blackoil/blackoilprimaryvariables.hh +++ b/opm/models/blackoil/blackoilprimaryvariables.hh @@ -86,8 +86,10 @@ class BlackOilPrimaryVariables : public FvBasePrimaryVariables enum { pressureSwitchIdx = Indices::pressureSwitchIdx }; 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; // phase indices from the fluid system enum { numPhases = getPropValue() }; @@ -315,7 +317,13 @@ public: else if (primaryVarsMeaning() == Sw_po_Sg) { if (waterEnabled) (*this)[waterSaturationIdx] = FsToolbox::value(fluidState.saturation(waterPhaseIdx)); - (*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(oilPhaseIdx)); + if (gasEnabled && waterEnabled && !oilEnabled) { + //-> water-gas system + (*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(gasPhaseIdx)); + } + else if (oilEnabled) { + (*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(oilPhaseIdx)); + } if( compositionSwitchEnabled ) (*this)[compositionSwitchIdx] = FsToolbox::value(fluidState.saturation(gasPhaseIdx)); }