Skip to content

test(vlasov1d,vlasov2d): guard the Hou-Li velocity-space rejection - #333

Open
joglekara wants to merge 1 commit into
mainfrom
test/vlasov-hou-li-velocity-guard
Open

test(vlasov1d,vlasov2d): guard the Hou-Li velocity-space rejection#333
joglekara wants to merge 1 commit into
mainfrom
test/vlasov-hou-li-velocity-guard

Conversation

@joglekara

Copy link
Copy Markdown
Member

PR #305 removed velocity-space Hou-Li filtering. The filter is FFT-based, hence periodic in whichever axis it filters, and v is a bounded domain (f -> 0 at ±vmax) — so filtering in v wraps the forward tail onto the -v edge and corrupts f(v). x (and x/y in 2d) are periodic, so filtering there is correct and is unchanged.

What prevents that from being reintroduced from a deck is the HouLiFilterConfig.dimensions validator — and nothing tested it. Since #305 also deleted the velocity kernel precompute, a re-added velocity dimension would not fail loudly at construction; it would depend entirely on the validator still being there.

What this adds

Test-only. No source changes.

  • tests/test_vlasov1d/test_config_validation.py — velocity dimensions rejected (["v"], ["x","v"], ["v","x"]); ["x"] still validates; default stays ["x"].
  • tests/test_vlasov2d/test_hou_li_filter_config.py (new) — vx/vy and mixed spatial+velocity lists rejected; ["x"]/["y"]/["x","y"] still validate; default stays ["x","y"].

The tests assert on the pydantic ValidationError message, so they pin the diagnostic a user actually sees, not just the failure.

Verification

  • 31 passed (tests/test_vlasov1d/test_config_validation.py + the new 2d file).
  • Confirmed these are genuine guards, not tautologies: against the pre-Remove velocity-space Hou-Li filtering (vlasov1d + vlasov2d) #305 datamodel (57b0bce) HouLiFilterConfig(is_on=True, dimensions=["v"]) constructs successfully and the default is ["x","v"], so both tests fail there.
  • ruff check / ruff format --check clean.

How this surfaced

Auditing a downstream repo that had selected the Hou-Li filter as a grid-scale sink in v for a large-box two-stream run, before #305 landed. Upstream had already reached the same conclusion and removed it; the downstream configs then failed validation on a compute node. The removal is right — this just makes sure it stays removed.

🤖 Generated with Claude Code

PR #305 removed velocity-space Hou-Li filtering: the filter is FFT-based, hence
periodic in whichever axis it filters, and v is a bounded domain (f -> 0 at
+/-vmax), so filtering in v wraps the forward tail onto the -v edge and corrupts
f(v). x (and x/y in 2d) are periodic, so filtering there is correct and unchanged.

What keeps that from being reintroduced from a deck is the HouLiFilterConfig
`dimensions` validator, and nothing tested it. The kernel precompute for v is
gone, so a re-added velocity dimension would not fail loudly at construction —
it would fall back to whatever the config path happened to accept.

Adds the missing coverage on both solvers:
- velocity dimensions are rejected (v in 1d; vx/vy, and mixed spatial+velocity
  lists, in 2d)
- configuration-space dimensions still validate
- the default stays configuration-space only, so an unspecified deck cannot
  filter in velocity

Both tests fail against the pre-#305 datamodel, which accepted dimensions=["v"]
and defaulted to ["x", "v"].

Found while auditing a downstream repo that had picked the filter as a
grid-scale sink in v before #305 landed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant