From 3dcd7485c9e1b1fb95dab8f0a68a6ef410794e30 Mon Sep 17 00:00:00 2001 From: Andreas Lauser <and@poware.org> Date: Mon, 19 Dec 2011 09:58:32 +0000 Subject: [PATCH] H2O-N2 fluid system: some cosmetic cleanup of the viscosity git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7144 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- .../material/fluidsystems/h2on2fluidsystem.hh | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/dumux/material/fluidsystems/h2on2fluidsystem.hh b/dumux/material/fluidsystems/h2on2fluidsystem.hh index 79cd770643..4493cda453 100644 --- a/dumux/material/fluidsystems/h2on2fluidsystem.hh +++ b/dumux/material/fluidsystems/h2on2fluidsystem.hh @@ -420,24 +420,22 @@ public: H2O::gasViscosity(T, H2O::vaporPressure(T)), N2::gasViscosity(T, p) }; - // molar masses - const Scalar M[numComponents] = { - H2O::molarMass(), - N2::molarMass() - }; + Scalar sumx = 0.0; + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + sumx += fluidState.moleFraction(phaseIdx, compIdx); + sumx = std::max(1e-10, sumx); + for (int i = 0; i < numComponents; ++i) { Scalar divisor = 0; for (int j = 0; j < numComponents; ++j) { - Scalar phiIJ = 1 + sqrt(mu[i]/mu[j]) * - pow(M[j]/M[i], 1/4.0); + Scalar phiIJ = 1 + sqrt(mu[i]/mu[j]) * pow(molarMass(j)/molarMass(i), 1/4.0); phiIJ *= phiIJ; - phiIJ /= sqrt(8*(1 + M[i]/M[j])); - divisor += fluidState.moleFraction(phaseIdx, j)*phiIJ; + phiIJ /= sqrt(8*(1 + molarMass(i)/molarMass(j))); + divisor += fluidState.moleFraction(phaseIdx, j)/sumx * phiIJ; } - muResult += fluidState.moleFraction(phaseIdx, i)*mu[i] / divisor; + muResult += fluidState.moleFraction(phaseIdx, i)/sumx * mu[i] / divisor; } - return muResult; } }; -- GitLab