From 4eda84b775737064c20f1383501ab8dcc16b36a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org>
Date: Thu, 8 Sep 2016 14:54:19 +0200
Subject: [PATCH] [h2oair] Use sqrt instead of pow to speedup viscosity
 evaluation

test_stokes2c with refined grid speeds up by 2.7%.
---
 dumux/material/fluidsystems/h2oair.hh | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/dumux/material/fluidsystems/h2oair.hh b/dumux/material/fluidsystems/h2oair.hh
index 2768b4abb8..900f74a901 100644
--- a/dumux/material/fluidsystems/h2oair.hh
+++ b/dumux/material/fluidsystems/h2oair.hh
@@ -493,11 +493,9 @@ public:
                     Scalar divisor = 0;
                     for (int j = 0; j < numComponents; ++j)
                     {
-                        Scalar phiIJ = 1 + sqrt(mu[i]/mu[j]) * // 1 + (mu[i]/mu[j]^1/2
-                            pow(M[j]/M[i], 1./4.0);   // (M[i]/M[j])^1/4
-
-                        phiIJ *= phiIJ;
-                        phiIJ /= sqrt(8*(1 + M[i]/M[j]));
+                        // 1 + (mu[i]/mu[j]^1/2 * (M[i]/M[j])^1/4)
+                        Scalar phiIJ = 1 + sqrt(mu[i]/mu[j] * sqrt(M[j]/M[i]));
+                        phiIJ = phiIJ * phiIJ / sqrt(8*(1 + M[i]/M[j]));
                         divisor += fluidState.moleFraction(phaseIdx, j)*phiIJ;
                     }
                     muResult += fluidState.moleFraction(phaseIdx, i)*mu[i] / divisor;
-- 
GitLab