Skip to content
Snippets Groups Projects
Commit 8e221de7 authored by Martin Bauer's avatar Martin Bauer
Browse files

Merge branch 'fluctuating' into 'master'

Fluctuating LB needs zero mean and unit variance random numbers

See merge request pycodegen/lbmpy!4
parents 1c4dfcf8 4cd1c355
Branches
Tags
1 merge request!4Fluctuating LB needs zero mean and unit variance random numbers
Pipeline #17208 passed
...@@ -63,7 +63,8 @@ def fluctuation_correction(method, rng_generator, variances=SymbolGen("variance" ...@@ -63,7 +63,8 @@ def fluctuation_correction(method, rng_generator, variances=SymbolGen("variance"
conserved_moments = {sp.sympify(1), *MOMENT_SYMBOLS} conserved_moments = {sp.sympify(1), *MOMENT_SYMBOLS}
# A diagonal matrix containing the random fluctuations # 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)]) 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 # corrections are applied in real space hence we need to convert to real space here
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment