From 0b2edf3074e31df6885f86de8f5e4bee8d3f73c7 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch <bernd@iws.uni-stuttgart.de> Date: Mon, 9 Jan 2012 15:15:17 +0000 Subject: [PATCH] fixed bug in Richards model, use shorthand notation for calculation of normal fluxes in box models git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7319 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- dumux/boxmodels/1p/1plocalresidual.hh | 5 +---- dumux/boxmodels/1p2c/1p2cfluxvariables.hh | 5 +---- dumux/boxmodels/2p/2plocalresidual.hh | 5 +---- dumux/boxmodels/2p2c/2p2cfluxvariables.hh | 5 +---- dumux/boxmodels/richards/richardslocalresidual.hh | 5 +---- 5 files changed, 5 insertions(+), 20 deletions(-) diff --git a/dumux/boxmodels/1p/1plocalresidual.hh b/dumux/boxmodels/1p/1plocalresidual.hh index 0454731a4e..eeb39d9d83 100644 --- a/dumux/boxmodels/1p/1plocalresidual.hh +++ b/dumux/boxmodels/1p/1plocalresidual.hh @@ -118,10 +118,7 @@ public: fluxVars.intrinsicPermeability().mv(fluxVars.potentialGrad(), tmpVec); - Scalar normalFlux = 0; - for (int i = 0; i < Vector::size; ++i) - normalFlux += tmpVec[i]*fluxVars.face().normal[i]; - normalFlux *= -1; + Scalar normalFlux = -(tmpVec*fluxVars.face().normal); const VolumeVariables &up = this->curVolVars_(fluxVars.upstreamIdx(normalFlux)); const VolumeVariables &dn = this->curVolVars_(fluxVars.downstreamIdx(normalFlux)); diff --git a/dumux/boxmodels/1p2c/1p2cfluxvariables.hh b/dumux/boxmodels/1p2c/1p2cfluxvariables.hh index 79096bfcec..c1cf464a23 100644 --- a/dumux/boxmodels/1p2c/1p2cfluxvariables.hh +++ b/dumux/boxmodels/1p2c/1p2cfluxvariables.hh @@ -412,10 +412,7 @@ protected: const ElementVolumeVariables &elemDat) { K_.mv(potentialGrad_, Kmvp_); - KmvpNormal_ = 0; - for (int i = 0; i < Vector::size; ++i) - KmvpNormal_ += Kmvp_[i] * face().normal[i]; - KmvpNormal_ *= -1; + KmvpNormal_ = -(Kmvp_*face().normal); // set the upstream and downstream vertices upstreamIdx_ = face().i; diff --git a/dumux/boxmodels/2p/2plocalresidual.hh b/dumux/boxmodels/2p/2plocalresidual.hh index 1e840efdb0..1c9a2a1f0e 100644 --- a/dumux/boxmodels/2p/2plocalresidual.hh +++ b/dumux/boxmodels/2p/2plocalresidual.hh @@ -153,10 +153,7 @@ public: // (the minus comes from the Darcy law which states that // the flux is from high to low pressure potentials.) fluxVars.intrinsicPermeability().mv(fluxVars.potentialGrad(phaseIdx), tmpVec); - Scalar normalFlux = 0; - for (int i = 0; i < Vector::size; ++i) - normalFlux += tmpVec[i]*fluxVars.face().normal[i]; - normalFlux *= -1; + Scalar normalFlux = -(tmpVec*fluxVars.face().normal); // data attached to upstream and the downstream vertices // of the current phase diff --git a/dumux/boxmodels/2p2c/2p2cfluxvariables.hh b/dumux/boxmodels/2p2c/2p2cfluxvariables.hh index 706197bc91..38dfe09807 100644 --- a/dumux/boxmodels/2p2c/2p2cfluxvariables.hh +++ b/dumux/boxmodels/2p2c/2p2cfluxvariables.hh @@ -231,10 +231,7 @@ protected: fvElemGeom_, face().j)); K.mv(potentialGrad_[phaseIdx], Kmvp_[phaseIdx]); - KmvpNormal_[phaseIdx] = 0; - for (int i = 0; i < Vector::size; ++i) - KmvpNormal_[phaseIdx] += Kmvp_[phaseIdx][i] * face().normal[i]; - KmvpNormal_[phaseIdx] *= -1; + KmvpNormal_[phaseIdx] = -(Kmvp_[phaseIdx]*face().normal); } // set the upstream and downstream vertices diff --git a/dumux/boxmodels/richards/richardslocalresidual.hh b/dumux/boxmodels/richards/richardslocalresidual.hh index 4fdc70f551..7d5e74e2cb 100644 --- a/dumux/boxmodels/richards/richardslocalresidual.hh +++ b/dumux/boxmodels/richards/richardslocalresidual.hh @@ -129,10 +129,7 @@ public: Vector tmpVec; fluxVars.intrinsicPermeability().mv(fluxVars.potentialGradW(), tmpVec); - Scalar normalFlux = 0; - for (int i = 0; i < Vector::size; ++ i) - normalFlux += tmpVec[i] + fluxVars.face().normal[i]; - normalFlux *= -1; + Scalar normalFlux = -(tmpVec*fluxVars.face().normal); // data attached to upstream and the downstream vertices // of the current phase -- GitLab