From 0d85f3642cfdd481f6fddd34d44d1f3c5ad134b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Mon, 25 Apr 2016 15:31:03 +0200 Subject: [PATCH] Access water/gas quantities only if active phase. --- opm/autodiff/BlackoilModelBase_impl.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index 088670211e..32d7bee7bb 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -1613,7 +1613,9 @@ namespace detail { auto ixg = sg < 0; for (int c = 0; c < nc; ++c) { if (ixg[c]) { - sw[c] = sw[c] / (1-sg[c]); + if (active_[Water]) { + sw[c] = sw[c] / (1-sg[c]); + } so[c] = so[c] / (1-sg[c]); sg[c] = 0; } @@ -1624,8 +1626,12 @@ namespace detail { auto ixo = so < 0; for (int c = 0; c < nc; ++c) { if (ixo[c]) { - sw[c] = sw[c] / (1-so[c]); - sg[c] = sg[c] / (1-so[c]); + if (active_[Water]) { + sw[c] = sw[c] / (1-so[c]); + } + if (active_[Gas]) { + sg[c] = sg[c] / (1-so[c]); + } so[c] = 0; } } @@ -1636,7 +1642,9 @@ namespace detail { for (int c = 0; c < nc; ++c) { if (ixw[c]) { so[c] = so[c] / (1-sw[c]); - sg[c] = sg[c] / (1-sw[c]); + if (active_[Gas]) { + sg[c] = sg[c] / (1-sw[c]); + } sw[c] = 0; } }