From ccc1ca0b766d34f6780ab1c503f4227b859c2f95 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 8 Mar 2016 10:56:11 +0100 Subject: [PATCH] BlackoilPropertiesFromDeck: properly calculate the Rs and Rv values for viscosity the dissolution factors used for the viscosities were always zero so far. this was not discovered earlier because flow is completely unaffected by this since the only place where this class is used in flow is the equilibration code and the equilibration code does not need phase viscosities. thanks to @atgeirr for finding this. --- opm/core/props/BlackoilPropertiesFromDeck.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/opm/core/props/BlackoilPropertiesFromDeck.cpp b/opm/core/props/BlackoilPropertiesFromDeck.cpp index 4ca597a4d..b4c508125 100644 --- a/opm/core/props/BlackoilPropertiesFromDeck.cpp +++ b/opm/core/props/BlackoilPropertiesFromDeck.cpp @@ -242,6 +242,7 @@ namespace Opm double* dmudp) const { const auto& pu = phaseUsage(); + const int np = numPhases(); enum PressureEvalTag {}; typedef Opm::LocalAd::Evaluation LadEval; @@ -254,6 +255,9 @@ namespace Opm pLad.derivatives[0] = 1.0; + R_.resize(n*np); + this->compute_R_(n, p, T, z, cells, &R_[0]); + for (int i = 0; i < n; ++ i) { int cellIdx = cells[i]; int pvtRegionIdx = cellPvtRegionIdx_[cellIdx]; @@ -268,6 +272,7 @@ namespace Opm } if (pu.phase_used[BlackoilPhases::Liquid]) { + RsLad.value = R_[i*np + pu.phase_pos[BlackoilPhases::Liquid]]; muLad = oilPvt_.viscosity(pvtRegionIdx, TLad, pLad, RsLad); int offset = pu.num_phases*cellIdx + pu.phase_pos[BlackoilPhases::Liquid]; mu[offset] = muLad.value; @@ -275,6 +280,7 @@ namespace Opm } if (pu.phase_used[BlackoilPhases::Vapour]) { + RvLad.value = R_[i*np + pu.phase_pos[BlackoilPhases::Vapour]]; muLad = gasPvt_.viscosity(pvtRegionIdx, TLad, pLad, RvLad); int offset = pu.num_phases*cellIdx + pu.phase_pos[BlackoilPhases::Vapour]; mu[offset] = muLad.value;