"`pystencils` does different algebraic modifications to the update equations depending on the streaming pattern. Floating-point addition is not associative! This causes minor numerical differences between the streaming patterns, as visible in the test case."
],
"cell_type": "markdown",
"metadata": {}
},
{
"source": [
"## Macroscopic Values"
...
...
%% Cell type:code id: tags:
```
%load_ext autoreload
%autoreload 2
```
%% Cell type:code id: tags:
```
import numpy as np
import sympy as sp
from pystencils.datahandling import create_data_handling
from pystencils import create_kernel
from pystencils.plot import scalar_field, vector_field, vector_field_magnitude
from lbmpy.creationfunctions import create_lb_collision_rule, create_lb_function
from lbmpy.macroscopic_value_kernels import flexible_macroscopic_values_getter, flexible_macroscopic_values_setter
from lbmpy.stencils import get_stencil
from lbmpy.advanced_streaming import PeriodicityHandling
from lbmpy.advanced_streaming.utility import is_inplace
from numpy.testing import assert_allclose
```
%% Cell type:code id: tags:
```
stencil = get_stencil('D2Q9')
q = len(stencil)
dim = len(stencil[0])
streaming_pattern = 'esotwist'
streaming_pattern = 'push'
inplace = is_inplace(streaming_pattern)
timesteps = ['even', 'odd'] if inplace else ['both']
`pystencils` does different algebraic modifications to the update equations depending on the streaming pattern. Floating-point addition is not associative! This causes minor numerical differences between the streaming patterns, as visible in the test case.