From 4cd1c355d9def15babedaa80f7935672a7f5a6b8 Mon Sep 17 00:00:00 2001
From: Michael Kuron <mkuron@icp.uni-stuttgart.de>
Date: Tue, 13 Aug 2019 18:07:10 +0200
Subject: [PATCH] Fluctuating LB needs zero mean and unit variance random
 numbers

---
 lbmpy/fluctuatinglb.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lbmpy/fluctuatinglb.py b/lbmpy/fluctuatinglb.py
index 8659187..833b93f 100644
--- a/lbmpy/fluctuatinglb.py
+++ b/lbmpy/fluctuatinglb.py
@@ -63,7 +63,8 @@ def fluctuation_correction(method, rng_generator, variances=SymbolGen("variance"
     conserved_moments = {sp.sympify(1), *MOMENT_SYMBOLS}
 
     # A diagonal matrix containing the random fluctuations
-    random_matrix = sp.Matrix([0 if m in conserved_moments else next(rng_generator) for m in method.moments])
+    random_matrix = sp.Matrix([0 if m in conserved_moments else (next(rng_generator) - 0.5) * sp.sqrt(12)
+                               for m in method.moments])
     random_variance = sp.diag(*[v for v, _ in zip(iter(variances), method.moments)])
 
     # corrections are applied in real space hence we need to convert to real space here
-- 
GitLab