Jets: enforce stationary rule at ObjectManager.set_body_state too

Move the Jet motion check into ObjectManager.validate_jet_motion (uses the
synced field's cut-link jet_id) and call it from both Simulation.set_body
and the direct ObjectManager.set_body_state entry, before any state or
action change. Test both entries, vx too, and that action is untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-15 08:32:29 +00:00
1 parent 62c525e735
commit f7753be0e4
3 files changed
+23 -7

No files matched your search

+7 -1
View File
@@ -243,8 +243,14 @@ def test_set_body_rejects_motion_of_jet_driven_body(device):
sim = SimpleNamespace(bodies=bodies, field=field, lbm_cfg=field.cfg, _initialized=True)
with pytest.raises(ValueError, match="stationary"):
Simulation.set_body(sim, 0, omega=.01)
assert bodies.get(0).state.omega == 0
with pytest.raises(ValueError, match="stationary"):
Simulation.set_body(sim, 0, vx=.01)
action = bodies.action.copy()
with pytest.raises(ValueError, match="stationary"):
bodies.set_body_state(0, omega=.01) # direct manager entry
assert bodies.get(0).state.omega == 0 and np.array_equal(bodies.action, action)
Simulation.set_body(sim, 0, omega=0.) # stationary updates stay allowed
bodies.set_body_state(0, omega=0.)
def test_fine_boundary_keeps_edge_frame_hits_and_checks_jets():