Test: fine jet ownership uses remapped physical owners
Caller obj_id 99 spanning 2x2 fine blocks: driven rows carry the single remapped owner 0 across several block ids, accepted; source id unchanged. Caller ids (99, 7) under one tube are rejected at amplitude 0 and .002 on the 32x24 fixture; source ids unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bf0adda45f
commit
99ddb5fc27
@@ -18,7 +18,7 @@ import pycuda.driver as cuda
|
||||
|
||||
from CelerisLab.cuda import compiler_v2 as compiler
|
||||
from CelerisLab.lbm.descriptors import SOLID
|
||||
from CelerisLab.lbm.refinement import ACTIVE, FixedPatch2D
|
||||
from CelerisLab.lbm.refinement import ACTIVE, FixedPatch2D, prepare_fine_boundary
|
||||
from CelerisLab.lbm.refinement_stepper import FixedPatchStepper
|
||||
from test_refinement_blocked_fine import (BOUNDS, FINE_BLOCKS, NX, NY, STEPS, actuation,
|
||||
circle, config, fine_circle, raw, state)
|
||||
@@ -58,6 +58,34 @@ class JetStepperCPU(unittest.TestCase):
|
||||
self.assertGreater(len(np.unique(backend._fine_tables["block"][jet_id == 0])), 1)
|
||||
backend.close()
|
||||
|
||||
def test_fine_ownership_uses_remapped_physical_owner(self):
|
||||
# Caller ids (99, 7) are remapped to fine owners (0, 1); block ids never count.
|
||||
import math
|
||||
from CelerisLab.body.geometry.circle import CircleGeometry
|
||||
from CelerisLab.body.jets import Jet, Parallel, Radial, Sector, Tube
|
||||
from CelerisLab.body.objects import SimObject
|
||||
C = (16.0, 12.0)
|
||||
source = SimObject(99, geometry=CircleGeometry(*C, 2.15), center=C, radius=2.15)
|
||||
whole = Jet(Sector(C, .1, math.pi, 3.), Radial(C, inward=False), amplitude=0.)
|
||||
backend, _ = mocked([source], [whole], FINE_BLOCKS[1])
|
||||
_, jet_id = backend._jet_cache
|
||||
owners = backend.fine_boundary.curved_host[3][jet_id == 0]
|
||||
self.assertEqual(np.unique(owners).tolist(), [0])
|
||||
self.assertGreater(len(np.unique(backend._fine_tables["block"][jet_id == 0])), 1)
|
||||
self.assertEqual(source.obj_id, 99)
|
||||
backend.close()
|
||||
cfg = config("periodic")
|
||||
patch_ = FixedPatch2D.from_config(cfg, BOUNDS)
|
||||
A, B = (12.5, 12.0), (19.5, 12.0)
|
||||
pair = [SimObject(i, geometry=CircleGeometry(*c, 1.5), center=c, radius=1.5)
|
||||
for i, c in ((99, A), (7, B))]
|
||||
for amplitude in (0., .002):
|
||||
with self.assertRaisesRegex(ValueError, "one jet may drive only one body"):
|
||||
prepare_fine_boundary(cfg, patch_, pair,
|
||||
jets=[Jet(Tube((9., 12.), 0., 14., .5), Parallel(0.),
|
||||
amplitude=amplitude)])
|
||||
self.assertEqual([o.obj_id for o in pair], [99, 7])
|
||||
|
||||
def test_blocked_jet_velocity_matches_legacy_rows(self):
|
||||
legacy, _ = mocked([circle(actuation(SPEED))], (), FINE_BLOCKS[1])
|
||||
driven, _ = mocked([circle()], [jet()], FINE_BLOCKS[1])
|
||||
|
||||
Reference in New Issue
Block a user