Integrate grok/wall-transfer-validation for bounded validation

This commit is contained in:
Frank14f committed 2026-10-15 10:53:20 +08:00
commit 99c86e441c
2 files changed
+21 -2

No files matched your search

+18
View File
@@ -213,3 +213,21 @@ def test_fine_rejects_ghost_solids_unresolved_circle_and_overlap(objects):
cfg, patch = setup_patch()
with pytest.raises(ValueError):
refinement.prepare_fine_boundary(cfg, patch, objects)
@pytest.mark.parametrize('margin, ok', [(4, True), (3, False)])
def test_fine_wall_guard_allows_read_only_bulk_donor_rows(margin, ok):
cfg = LBMConfig(nx=24, ny=24, viscosity=.05)
cfg.validate()
patch = FixedPatch2D.from_config(cfg, (4, margin, 20, 24-margin))
_, coarse, _ = refinement._transfer_footprint(patch)
rows = {k // cfg.nx for k in coarse}
assert min(rows) == margin-2 and max(rows) == cfg.ny-margin+1
source = circle(center=(12.25, 12.25))
# Footprint never violates the plain bulk-cell checks; only the wall rule differs.
refinement.prepare_fine_boundary(cfg, patch, [source])
if ok:
refinement.prepare_fine_boundary(cfg, patch, [source], wall_aware=True)
else:
with pytest.raises(ValueError, match='wall reconstruction'):
refinement.prepare_fine_boundary(cfg, patch, [source], wall_aware=True)