Commit 4eda84b7 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

[h2oair] Use sqrt instead of pow to speedup viscosity evaluation

test_stokes2c with refined grid speeds up by 2.7%.
parent c0494c0c
...@@ -493,11 +493,9 @@ public: ...@@ -493,11 +493,9 @@ public:
Scalar divisor = 0; Scalar divisor = 0;
for (int j = 0; j < numComponents; ++j) for (int j = 0; j < numComponents; ++j)
{ {
Scalar phiIJ = 1 + sqrt(mu[i]/mu[j]) * // 1 + (mu[i]/mu[j]^1/2 // 1 + (mu[i]/mu[j]^1/2 * (M[i]/M[j])^1/4)
pow(M[j]/M[i], 1./4.0); // (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]));
phiIJ *= phiIJ;
phiIJ /= sqrt(8*(1 + M[i]/M[j]));
divisor += fluidState.moleFraction(phaseIdx, j)*phiIJ; divisor += fluidState.moleFraction(phaseIdx, j)*phiIJ;
} }
muResult += fluidState.moleFraction(phaseIdx, i)*mu[i] / divisor; muResult += fluidState.moleFraction(phaseIdx, i)*mu[i] / divisor;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment