From 88beff7a9dfd0fc1c3375e80953fae61af1ede50 Mon Sep 17 00:00:00 2001 From: hnil Date: Mon, 1 Apr 2019 12:55:06 +0200 Subject: [PATCH] Fixed pressure equation for case where water is not pressent, often used for co2 simulations --- opm/autodiff/ISTLSolverEbos.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opm/autodiff/ISTLSolverEbos.hpp b/opm/autodiff/ISTLSolverEbos.hpp index a336d92eb..964123385 100644 --- a/opm/autodiff/ISTLSolverEbos.hpp +++ b/opm/autodiff/ISTLSolverEbos.hpp @@ -194,7 +194,9 @@ protected: typedef typename GridView::template Codim<0>::Entity Element; typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext; // Due to miscibility oil <-> gas the water eqn is the one we can replace with a pressure equation. - enum { pressureEqnIndex = BlackOilDefaultIndexTraits::waterCompIdx }; + static const bool waterEnabled = Indices::waterEnabled; + static const int pindex = (waterEnabled) ? BlackOilDefaultIndexTraits::waterCompIdx : BlackOilDefaultIndexTraits::oilCompIdx; + enum { pressureEqnIndex = pindex }; enum { pressureVarIndex = Indices::pressureSwitchIdx }; static const int numEq = Indices::numEq;