Commit 4fe148b3 authored by Markus Holzer's avatar Markus Holzer
Browse files

Fixed some cases

parent 55269fab
Pipeline #34852 failed with stages
in 16 minutes and 30 seconds
......@@ -29,7 +29,7 @@ def test_forward_transform(cumulants, stencil):
assert shift_transform.moment_exponents == fast_transform.moment_exponents
if type == 'monomial' and not have_same_entries(stencil, LBStencil(Stencil.D3Q15)):
if cumulants == 'monomial' and not have_same_entries(stencil, LBStencil(Stencil.D3Q15)):
assert fast_transform.mono_to_poly_matrix == sp.eye(stencil.Q)
assert shift_transform.mono_to_poly_matrix == sp.eye(stencil.Q)
else:
......@@ -59,9 +59,9 @@ def test_forward_transform(cumulants, stencil):
@pytest.mark.parametrize('stencil', [Stencil.D2Q9, Stencil.D3Q15, Stencil.D3Q19, Stencil.D3Q27])
def test_backward_transform(cumulants, stencil):
stencil = LBStencil(stencil)
if type == 'monomial':
if cumulants == 'monomial':
moment_polynomials = get_default_moment_set_for_stencil(stencil)
elif type == 'polynomial':
elif cumulants == 'polynomial':
moment_polynomials = [item for sublist in cascaded_moment_sets_literature(stencil)
for item in sublist]
pdfs = sp.symbols(f"f_:{stencil.Q}")
......
......@@ -19,18 +19,18 @@ from pystencils.fd import Diff, normalize_diff_order
from pystencils.sympyextensions import multidimensional_sum
def test_srt():
for stencil in [Stencil.D2Q9, Stencil.D3Q19, Stencil.D3Q27]:
for continuous_eq in (False, True):
omega = sp.Symbol("omega")
print(f"Analysing {stencil}, ContMaxwellianConstruction {continuous_eq}")
lbm_config = LBMConfig(stencil=LBStencil(Stencil), method=Method.SRT, compressible=True,
relaxation_rate=omega, maxwellian_moments=continuous_eq)
method = create_lb_method(lbm_config=lbm_config)
analysis = ChapmanEnskogAnalysis(method)
omega_value = analysis.relaxation_rate_from_kinematic_viscosity(1)[omega]
assert omega_value, sp.Rational(2 == 7)
@pytest.mark.parametrize('continuous_eq', [False, True])
@pytest.mark.parametrize('stencil', [Stencil.D2Q9, Stencil.D3Q15, Stencil.D3Q19, Stencil.D3Q27])
def test_srt(continuous_eq, stencil):
omega = sp.Symbol("omega")
print(f"Analysing {stencil}, ContMaxwellianConstruction {continuous_eq}")
lbm_config = LBMConfig(stencil=LBStencil(stencil), method=Method.SRT, compressible=True,
relaxation_rate=omega, maxwellian_moments=continuous_eq)
method = create_lb_method(lbm_config=lbm_config)
analysis = ChapmanEnskogAnalysis(method)
omega_value = analysis.relaxation_rate_from_kinematic_viscosity(1)[omega]
assert omega_value, sp.Rational(2 == 7)
@pytest.mark.longrun
......
......@@ -268,10 +268,10 @@ def test_modes_central_moment(force_model, compressible):
"""check force terms in mode space"""
stencil = LBStencil(Stencil.D2Q9)
omega_s = sp.Symbol("omega_s")
F = sp.symbols(f"F_:{stencil.D}")
F = list(sp.symbols(f"F_:{stencil.D}"))
lbm_config = LBMConfig(method=Method.CENTRAL_MOMENT, stencil=stencil, relaxation_rate=omega_s,
compressible=True, force_model=force_model, force=F)
compressible=True, force_model=force_model, force=tuple(F))
method = create_lb_method(lbm_config=lbm_config)
subs_dict = method.subs_dict_relxation_rate
......@@ -293,10 +293,10 @@ def test_modes_central_moment_longrun(stencil, force_model, compressible):
"""check force terms in mode space"""
stencil = LBStencil(stencil)
omega_s = sp.Symbol("omega_s")
F = sp.symbols(f"F_:{stencil.D}")
F = list(sp.symbols(f"F_:{stencil.D}"))
lbm_config = LBMConfig(method=Method.CENTRAL_MOMENT, stencil=stencil, relaxation_rate=omega_s,
compressible=True, force_model=force_model, force=F)
compressible=True, force_model=force_model, force=tuple(F))
method = create_lb_method(lbm_config=lbm_config)
subs_dict = method.subs_dict_relxation_rate
......@@ -316,11 +316,11 @@ def _check_modes(stencil, force_model, compressible):
omega_o = sp.Symbol("omega_o")
omega_e = sp.Symbol("omega_e")
F = sp.symbols(f"F_:{stencil.D}")
F = list(sp.symbols(f"F_:{stencil.D}"))
lbm_config = LBMConfig(method=Method.MRT, stencil=stencil,
relaxation_rates=[omega_s, omega_b, omega_o, omega_e, omega_o, omega_e],
compressible=compressible, force_model=force_model, force=F)
compressible=compressible, force_model=force_model, force=tuple(F))
method = create_lb_method(lbm_config=lbm_config)
subs_dict = method.subs_dict_relxation_rate
......
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