Commit c98cac51 authored by Christoph Rettinger's avatar Christoph Rettinger

Explicitly set moments in codegen files to avoid unnoticed changes in lbmpy

parent 5c808551
......@@ -5,15 +5,26 @@ from lbmpy_walberla import generate_lattice_model
from pystencils_walberla import CodeGeneration
from lbmpy.creationfunctions import create_lb_collision_rule
from lbmpy.moments import is_even, get_order
from lbmpy.moments import is_even, get_order, MOMENT_SYMBOLS
from lbmpy.stencils import get_stencil
from lbmpy.methods import mrt_orthogonal_modes_literature
with CodeGeneration() as ctx:
stencil = get_stencil("D3Q19", 'walberla')
omega = sp.symbols("omega_:%d" % len(stencil))
moments = mrt_orthogonal_modes_literature(stencil, True, False)
x, y, z = MOMENT_SYMBOLS
one = sp.Rational(1, 1)
sq = x ** 2 + y ** 2 + z ** 2
moments = [
[one, x, y, z], # [0, 3, 5, 7]
[sq - 1], # [1]
[3 * sq ** 2 - 6 * sq + 1], # [2]
[(3 * sq - 5) * x, (3 * sq - 5) * y, (3 * sq - 5) * z], # [4, 6, 8]
[3 * x ** 2 - sq, y ** 2 - z ** 2, x * y, y * z, x * z], # [9, 11, 13, 14, 15]
[(2 * sq - 3) * (3 * x ** 2 - sq), (2 * sq - 3) * (y ** 2 - z ** 2)], # [10, 12]
[(y ** 2 - z ** 2) * x, (z ** 2 - x ** 2) * y, (x ** 2 - y ** 2) * z] # [16, 17, 18]
]
method = create_lb_method(stencil=stencil, method='mrt', maxwellian_moments=False, nested_moments=moments)
def modification_func(moment, eq, rate):
......
......@@ -5,10 +5,9 @@ from lbmpy_walberla import generate_lattice_model
from pystencils_walberla import CodeGeneration
from lbmpy.creationfunctions import create_lb_collision_rule
from lbmpy.moments import is_even, get_order
from lbmpy.moments import is_even, get_order, MOMENT_SYMBOLS
from lbmpy.stencils import get_stencil
from lbmpy.forcemodels import Luo
from lbmpy.methods import mrt_orthogonal_modes_literature
with CodeGeneration() as ctx:
......@@ -18,7 +17,19 @@ with CodeGeneration() as ctx:
stencil = get_stencil("D3Q19", 'walberla')
omega = sp.symbols("omega_:%d" % len(stencil))
moments = mrt_orthogonal_modes_literature(stencil, True, False)
x, y, z = MOMENT_SYMBOLS
one = sp.Rational(1, 1)
sq = x ** 2 + y ** 2 + z ** 2
moments = [
[one, x, y, z], # [0, 3, 5, 7]
[sq - 1], # [1]
[3 * sq ** 2 - 6 * sq + 1], # [2]
[(3 * sq - 5) * x, (3 * sq - 5) * y, (3 * sq - 5) * z], # [4, 6, 8]
[3 * x ** 2 - sq, y ** 2 - z ** 2, x * y, y * z, x * z], # [9, 11, 13, 14, 15]
[(2 * sq - 3) * (3 * x ** 2 - sq), (2 * sq - 3) * (y ** 2 - z ** 2)], # [10, 12]
[(y ** 2 - z ** 2) * x, (z ** 2 - x ** 2) * y, (x ** 2 - y ** 2) * z] # [16, 17, 18]
]
methodWithForce = create_lb_method(stencil=stencil, method='mrt', maxwellian_moments=False,
force_model=forcemodel, nested_moments=moments)
......
Markdown is supported
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