Commit 098e09aa authored by Michael Kuron's avatar Michael Kuron
Browse files

Change tests from Guo to Luo if they don’t use SRT

parent d63fcb72
......@@ -242,11 +242,11 @@
%% Cell type:code id: tags:
``` python
method = create_lb_method(method='mrt', weighted=True, stencil='D2Q9', force=(1e-6, 0),
relaxation_rates=[0, 0, ω, 1.9, 1.9])
force_model='luo', relaxation_rates=[0, 0, ω, 1.9, 1.9])
method
```
%%%% Output: execute_result
......
......@@ -41,6 +41,13 @@
publisher={APS}
}
@phdthesis{schiller2008thermal,
title={Thermal fluctuations and boundary conditions in the lattice Boltzmann method},
author={Schiller, Ulf Daniel},
year={2008},
school={Johannes Gutenberg Universit{\"a}t Mainz}
}
@article{Wohrwag2018,
archivePrefix = {arXiv},
......
......@@ -201,6 +201,7 @@ class Buick:
simple = Simple(self._force)
shear_relaxation_rate = get_shear_relaxation_rate(lb_method)
assert len(set(lb_method.relaxation_rates)) == 1, "Buick only works for SRT"
correction_factor = (1 - sp.Rational(1, 2) * shear_relaxation_rate)
return [correction_factor * t for t in simple(lb_method)]
......
......@@ -10,13 +10,13 @@ from lbmpy.stencils import get_stencil
def test_entropic_methods():
sc_kbc = create_lid_driven_cavity((20, 20), method='trt-kbc-n4', relaxation_rate=1.9999,
entropic_newton_iterations=3, entropic=True, compressible=True,
force=(-1e-10, 0))
force=(-1e-10, 0), force_model="luo")
sc_srt = create_lid_driven_cavity((40, 40), relaxation_rate=1.9999, lid_velocity=0.05, compressible=True,
force=(-1e-10, 0))
force=(-1e-10, 0), force_model="luo")
sc_entropic = create_lid_driven_cavity((40, 40), method='entropic-srt', relaxation_rate=1.9999,
lid_velocity=0.05, compressible=True, force=(-1e-10, 0))
lid_velocity=0.05, compressible=True, force=(-1e-10, 0), force_model="luo")
sc_srt.run(1000)
sc_kbc.run(1000)
......
......@@ -5,7 +5,7 @@ from lbmpy.scenarios import create_channel
def test_fluctuating_generation_pipeline():
ch = create_channel((10, 10), stencil='D2Q9', method='mrt', weighted=True, relaxation_rates=[1.5] * 5, force=1e-5,
fluctuating={'temperature': 1e-9}, kernel_params={'time_step': 1, 'seed': 312},
force_model='luo', fluctuating={'temperature': 1e-9}, kernel_params={'time_step': 1, 'seed': 312},
optimization={'cse_global': True})
ch.run(10)
......
from pystencils.session import *
from lbmpy.session import *
from lbmpy.macroscopic_value_kernels import macroscopic_values_setter
import pytest
import lbmpy.forcemodels
import pytest
from contextlib import ExitStack as does_not_raise
force_models = [fm.lower() for fm in dir(lbmpy.forcemodels) if fm[0].isupper()]
......@@ -25,14 +27,22 @@ def test_total_momentum(method, force_model, omega):
ρ = dh.add_array('rho')
u = dh.add_array('u', values_per_cell=dh.dim)
collision = create_lb_update_rule(method=method,
stencil=stencil,
relaxation_rate=omega,
compressible=True,
force_model=force_model,
force=F,
kernel_type='collide_only',
optimization={'symbolic_field': src})
expectation = does_not_raise()
skip = False
if force_model in ['guo', 'buick'] and method != 'srt':
expectation = pytest.raises(AssertionError)
skip = True
with expectation:
collision = create_lb_update_rule(method=method,
stencil=stencil,
relaxation_rate=omega,
compressible=True,
force_model=force_model,
force=F,
kernel_type='collide_only',
optimization={'symbolic_field': src})
if skip:
return
stream = create_stream_pull_with_output_kernel(collision.method, src, dst,
{'density': ρ, 'velocity': u})
......
......@@ -16,6 +16,7 @@ def test_split_number_of_operations():
common_params = {'stencil': stencil,
'method': method,
'compressible': compressible,
'force_model': 'luo',
'force': (1e-6, 1e-5, 1e-7)
}
ast_with_splitting = create_lb_ast(optimization={'split': True}, **common_params)
......
......@@ -4,7 +4,7 @@ known acceptable values.
"""
import sympy as sp
from lbmpy.forcemodels import Guo
from lbmpy.forcemodels import Luo
from lbmpy.methods import create_srt, create_trt, create_trt_with_magic_number
from lbmpy.methods.momentbasedsimplifications import cse_in_opposing_directions
from lbmpy.simplificationfactory import create_simplification_strategy
......@@ -55,13 +55,13 @@ def test_simplifications_trt_d2q9_compressible():
def test_simplifications_trt_d3q19_force_incompressible():
o1, o2 = sp.symbols("omega_1 omega_2")
force_model = Guo([sp.Rational(1, 3), sp.Rational(1, 2), sp.Rational(1, 5)])
force_model = Luo([sp.Rational(1, 3), sp.Rational(1, 2), sp.Rational(1, 5)])
method = create_trt(get_stencil("D3Q19"), o1, o2, compressible=False, force_model=force_model)
check_method(method, [268, 281, 0], [241, 175, 1])
def test_simplifications_trt_d3q19_force_compressible():
o1, o2 = sp.symbols("omega_1 omega_2")
force_model = Guo([sp.Rational(1, 3), sp.Rational(1, 2), sp.Rational(1, 5)])
force_model = Luo([sp.Rational(1, 3), sp.Rational(1, 2), sp.Rational(1, 5)])
method = create_trt_with_magic_number(get_stencil("D3Q19"), o1, compressible=False, force_model=force_model)
check_method(method, [270, 283, 1], [243, 177, 1])
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