From 7606cc911b5d65b234e61d9067ae5ff48c4d6d14 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Wed, 13 Jan 2021 13:00:29 +0100 Subject: [PATCH] Fix 2-phase blackoil boundary --- opm/models/blackoil/blackoilboundaryratevector.hh | 3 +++ opm/models/blackoil/blackoilratevector.hh | 13 ++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/opm/models/blackoil/blackoilboundaryratevector.hh b/opm/models/blackoil/blackoilboundaryratevector.hh index 1cb28ca78..a32dde4d9 100644 --- a/opm/models/blackoil/blackoilboundaryratevector.hh +++ b/opm/models/blackoil/blackoilboundaryratevector.hh @@ -106,6 +106,9 @@ public: //////// (*this) = 0.0; for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + if (!FluidSystem::phaseIsActive(phaseIdx)) { + continue; + } const auto& pBoundary = fluidState.pressure(phaseIdx); const Evaluation& pInside = insideIntQuants.fluidState().pressure(phaseIdx); diff --git a/opm/models/blackoil/blackoilratevector.hh b/opm/models/blackoil/blackoilratevector.hh index e253238bb..3c4dd4ca5 100644 --- a/opm/models/blackoil/blackoilratevector.hh +++ b/opm/models/blackoil/blackoilratevector.hh @@ -71,7 +71,6 @@ class BlackOilRateVector enum { enablePolymerMolarWeight = getPropValue() }; enum { enableFoam = getPropValue() }; enum { enableBrine = getPropValue() }; - using Toolbox = Opm::MathToolbox; using ParentType = Dune::FieldVector; @@ -95,15 +94,15 @@ public: // convert to "surface volume" if requested if (getPropValue()) { if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { - (*this)[FluidSystem::gasCompIdx] /= + (*this)[Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx)] /= FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, pvtRegionIdx); } if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) { - (*this)[FluidSystem::oilCompIdx] /= + (*this)[Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx)] /= FluidSystem::referenceDensity(FluidSystem::oilPhaseIdx, pvtRegionIdx); } if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { - (*this)[FluidSystem::waterCompIdx] /= + (*this)[Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx)] /= FluidSystem::referenceDensity(FluidSystem::waterPhaseIdx, pvtRegionIdx); } if (enableSolvent) { @@ -148,15 +147,15 @@ public: // convert to "surface volume" if requested if (getPropValue()) { if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) { - (*this)[FluidSystem::gasCompIdx] /= + (*this)[Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx)] /= FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, pvtRegionIdx); } if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) { - (*this)[FluidSystem::oilCompIdx] /= + (*this)[Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx)] /= FluidSystem::referenceDensity(FluidSystem::oilPhaseIdx, pvtRegionIdx); } if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) { - (*this)[FluidSystem::waterCompIdx] /= + (*this)[Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx)] /= FluidSystem::referenceDensity(FluidSystem::waterPhaseIdx, pvtRegionIdx); } if (enableSolvent) {