Avoid deleting derivatives with zero pressure difference

This commit is contained in:
hnil 2024-02-29 11:01:05 +01:00
parent 8cc1a0e3f7
commit 23034c0bee

View File

@ -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