test: cover channel outlet clamp and damping controls

This commit is contained in:
2026-10-17 23:53:24 -07:00
parent 5b4610441c
commit fa5d0c22a9
2 changed files with 8 additions and 4 deletions
+4 -2
View File
@@ -13,9 +13,11 @@ from .test_numerical_operators import compile_run
@pytest.mark.parametrize("shift", [0, 1])
@pytest.mark.parametrize("profile", [0, 1])
def test_actual_kernel_uniform_parity(tmp_path, shift, profile):
@pytest.mark.parametrize("clamp,damping", [(1, ".5f"), (0, ".8f")])
def test_actual_kernel_uniform_parity(tmp_path, shift, profile, clamp, damping):
"""Nonuniform ghosts, corners, top wall, global profile and outlet halo donor."""
defines = dict(USE_DDF_SHIFTING=shift, INLET_PROFILE=profile)
defines = dict(USE_DDF_SHIFTING=shift, INLET_PROFILE=profile,
OUTLET_BACKFLOW_CLAMP=clamp, OUTLET_SRT_NEQ_DAMP=damping)
uniform = np.array(compile_run(tmp_path, "channel_root.cpp", dict(
defines, UNIFORM=1, NX=24, NY=20)), np.float32)
assert np.isfinite(uniform).all()
@@ -82,9 +82,11 @@ class ChannelRootGPU(unittest.TestCase):
def test_uniform_matched_root(self):
with CudaContext(0) as context:
for shifted in (False, True):
for profile in ("uniform", "parabolic"):
for profile, clamp, damping in (("uniform", True, .5), ("parabolic", True, .5),
("parabolic", False, .8)):
cfg = LBMConfig(nx=24, ny=20, viscosity=.1, velocity=.025,
ddf_shifting=shifted, inlet_profile=profile)
ddf_shifting=shifted, inlet_profile=profile,
outlet_backflow_clamp=clamp, outlet_srt_neq_damp=damping)
initial = _encode_physical(state(cfg.ny, cfg.nx), shifted)
expected = run_root(cfg, context, initial)
self.assertTrue(np.isfinite(expected).all())