From 23034c0beef5ef9bee3ac0d2f3f46c6c7ec3a500 Mon Sep 17 00:00:00 2001 From: hnil Date: Thu, 29 Feb 2024 11:01:05 +0100 Subject: [PATCH] Avoid deleting derivatives with zero pressure difference --- opm/models/blackoil/blackoillocalresidualtpfa.hh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/opm/models/blackoil/blackoillocalresidualtpfa.hh b/opm/models/blackoil/blackoillocalresidualtpfa.hh index f52e9544d..42dcee725 100644 --- a/opm/models/blackoil/blackoillocalresidualtpfa.hh +++ b/opm/models/blackoil/blackoillocalresidualtpfa.hh @@ -374,15 +374,13 @@ public: // Use arithmetic average (more accurate with harmonic, but that requires recomputing the transmissbility) const Evaluation transMult = (intQuantsIn.rockCompTransMultiplier() + Toolbox::value(intQuantsEx.rockCompTransMultiplier()))/2; Evaluation darcyFlux; - if (pressureDifference == 0) { - darcyFlux = 0.0; // NB maybe we could drop calculations - } else { - if (globalUpIndex == globalIndexIn) + if (globalUpIndex == globalIndexIn) { darcyFlux = pressureDifference * up.mobility(phaseIdx, facedir) * transMult * (-trans / faceArea); - else - darcyFlux = pressureDifference * - (Toolbox::value(up.mobility(phaseIdx, facedir)) * transMult * (-trans / faceArea)); + } else { + darcyFlux = pressureDifference * + (Toolbox::value(up.mobility(phaseIdx, facedir)) * transMult * (-trans / faceArea)); } + unsigned activeCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::solventComponentIndex(phaseIdx)); darcy[conti0EqIdx + activeCompIdx] = darcyFlux.value() * faceArea; // NB! For the FLORES fluxes without derivatives