Add jet, surface and fixed-patch tests and runnable examples
This commit is contained in:
@@ -7,9 +7,9 @@ import unittest
|
||||
import tempfile
|
||||
|
||||
import numpy as np
|
||||
import pycuda.autoinit
|
||||
|
||||
from CelerisLab.simulation import Simulation
|
||||
from ._cases import make_sim
|
||||
from CelerisLab.lbm.descriptors import OBSTACLE, FLUID
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class TestBodySyncE2E(unittest.TestCase):
|
||||
|
||||
def test_full_lifecycle(self):
|
||||
"""Create, init, run, add body, remove body, checkpoint, load."""
|
||||
sim = Simulation(device_id=0)
|
||||
sim = make_sim()
|
||||
nx = sim.lbm_cfg.nx
|
||||
ny = sim.lbm_cfg.ny
|
||||
cx, cy = nx // 4, ny // 2
|
||||
@@ -61,7 +61,7 @@ class TestBodySyncE2E(unittest.TestCase):
|
||||
self.assertTrue(os.path.exists(saved_path))
|
||||
|
||||
# 7. Load checkpoint in a new simulation
|
||||
sim2 = Simulation(device_id=0)
|
||||
sim2 = make_sim()
|
||||
sim2.initialize()
|
||||
sim2.run(1)
|
||||
|
||||
@@ -71,9 +71,10 @@ class TestBodySyncE2E(unittest.TestCase):
|
||||
|
||||
# 8. Continue running in restored sim
|
||||
sim2.run(50)
|
||||
# Verify step count advances (DDF may have NaN from pre-existing body)
|
||||
# Verify the restored field remains finite and stepping advances
|
||||
self.assertEqual(sim2.stepper.step_count,
|
||||
sim.stepper.step_count + 50)
|
||||
self.assertTrue(np.all(np.isfinite(sim2.get_ddf())))
|
||||
sim2.close()
|
||||
finally:
|
||||
os.unlink(ckpt_path)
|
||||
@@ -82,7 +83,7 @@ class TestBodySyncE2E(unittest.TestCase):
|
||||
|
||||
def test_add_remove_add_cycle(self):
|
||||
"""Add → run → remove → run → add → run cycle with finite checks."""
|
||||
sim = Simulation(device_id=0)
|
||||
sim = make_sim()
|
||||
nx = sim.lbm_cfg.nx
|
||||
ny = sim.lbm_cfg.ny
|
||||
cx, cy = nx // 4, ny // 2
|
||||
|
||||
Reference in New Issue
Block a user