25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
"""Explicit, isolated low-Mach GPU test configuration."""
|
|
import json
|
|
from pathlib import Path
|
|
from tempfile import TemporaryDirectory
|
|
|
|
from CelerisLab.simulation import Simulation
|
|
|
|
|
|
def make_sim(nx=128, ny=64, *, streaming="double_buffer", precision="FP32",
|
|
shifted=False, collision="SRT", y_wall="bounce_back", **physics):
|
|
config_path = Path(__file__).resolve().parents[2] / "src/CelerisLab/configs/config_lbm.json"
|
|
cfg = json.loads(config_path.read_text())
|
|
cfg["grid"].update(nx=nx, ny=ny, nz=1, lattice_model="D2Q9")
|
|
cfg["physics"].update(viscosity=0.05, velocity=0.02, rho=1.0)
|
|
cfg["physics"].update(physics)
|
|
cfg["method"].update(collision=collision, streaming=streaming,
|
|
store_precision=precision, ddf_shifting=shifted, y_wall_bc=y_wall)
|
|
cfg["method"]["les"]["enabled"] = False
|
|
with TemporaryDirectory(prefix="celeris-test-config-") as temp:
|
|
lbm = Path(temp) / "lbm.json"
|
|
bodies = Path(temp) / "bodies.json"
|
|
lbm.write_text(json.dumps(cfg))
|
|
bodies.write_text('{"objects": []}')
|
|
return Simulation(lbm_config_path=str(lbm), body_config_path=str(bodies))
|