test_quicktests.py 1.37 KB
Newer Older
Markus Holzer's avatar
Markus Holzer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import numpy as np
import sympy as sp

import pystencils as ps
from lbmpy.enums import ForceModel, Method, Stencil
from lbmpy.scenarios import create_lid_driven_cavity

from lbmpy_tests.poiseuille import poiseuille_channel


def test_poiseuille_channel_quicktest():
    poiseuille_channel(target=ps.Target.CPU, stencil_name=Stencil.D2Q9)


def test_entropic_methods():
Markus Holzer's avatar
Markus Holzer committed
16
    sc_kbc = create_lid_driven_cavity((40, 40), method=Method.TRT_KBC_N4,
Markus Holzer's avatar
Markus Holzer committed
17
18
                                      relaxation_rates=[1.9999, sp.Symbol("omega_free")],
                                      entropic_newton_iterations=3, entropic=True, compressible=True,
19
                                      zero_centered=False, force=(-1e-10, 0), force_model=ForceModel.LUO)
Markus Holzer's avatar
Markus Holzer committed
20
21

    sc_srt = create_lid_driven_cavity((40, 40), relaxation_rate=1.9999, lid_velocity=0.05, compressible=True,
22
                                      zero_centered=False, force=(-1e-10, 0), force_model=ForceModel.LUO)
Markus Holzer's avatar
Markus Holzer committed
23
24
25
26
27
28
29
30

    sc_srt.run(1000)
    sc_kbc.run(1000)
    assert np.isnan(np.max(sc_srt.velocity[:, :]))
    assert np.isfinite(np.max(sc_kbc.velocity[:, :]))


def test_cumulant_ldc():
Markus Holzer's avatar
Markus Holzer committed
31
    sc_cumulant = create_lid_driven_cavity((40, 40), method=Method.CUMULANT, relaxation_rate=1.999999,
Markus Holzer's avatar
Markus Holzer committed
32
33
34
35
                                           compressible=True, force=(-1e-10, 0))

    sc_cumulant.run(100)
    assert np.isfinite(np.max(sc_cumulant.velocity[:, :]))