Skip to content

Add Hermite boundary-resolution diagnostic#17

Open
rogeriojorge wants to merge 1 commit into
agent/fix-odd-rfft-energyfrom
agent/hermite-tail-diagnostic
Open

Add Hermite boundary-resolution diagnostic#17
rogeriojorge wants to merge 1 commit into
agent/fix-odd-rfft-energyfrom
agent/hermite-tail-diagnostic

Conversation

@rogeriojorge

@rogeriojorge rogeriojorge commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

  • add hermite_tail_fraction(output, width=1) as a post-processing diagnostic
  • measure the perturbation coefficient norm in the outer retained modes of every active Hermite axis, separately by time and species
  • reuse the even/odd RFFT Parseval weights from Fix odd-grid RFFT energy weights #9
  • leave the solver and RHS unchanged, so there is no simulation-time overhead

This is stacked on #9. After rebasing onto its simplified head, the incremental patch is 88 additions and 5 deletions across two files; the former duplicate weighting logic is now a shared three-line helper.

Physics and numerical rationale

Fourier-Hermite phase mixing transfers perturbed free energy toward high Hermite moments. A growing boundary fraction therefore warns that the velocity-space truncation is populated and recurrence or truncation error may follow. For SPECTRAX's matched-Maxwellian basis, the squared-coefficient norm is proportional to perturbed-distribution free energy; this function deliberately reports that normalized proxy rather than calling it total plasma energy.

Reference: Parker & Dellar, Fourier-Hermite spectral representation for the Vlasov-Poisson system in the weakly collisional limit, https://arxiv.org/abs/1407.1932

Validation

  • pytest -q: 10 passed
  • ruff check spectrax/_diagnostics.py tests/test_diagnostics.py: passed
  • synthetic coverage: odd-RFFT weighting, independent species, union of active boundaries, inactive axes, zero norm, and invalid width
  • two-stream, Nx=65, t=50, 501 outputs:
    • Nn=64: peak outermost fraction 2.87e-4; peak outer-eight fraction 1.66e-3
    • Nn=32: peak outermost fraction 2.46e-3; peak outer-eight fraction 1.71e-2
    • the outer-eight metric is about 10.3x larger at lower Hermite resolution

@rogeriojorge
rogeriojorge changed the base branch from agent/fix-odd-rfft-energy to main July 13, 2026 04:01
@rogeriojorge rogeriojorge reopened this Jul 13, 2026
@rogeriojorge
rogeriojorge changed the base branch from main to agent/fix-odd-rfft-energy July 13, 2026 04:01
@rogeriojorge
rogeriojorge marked this pull request as ready for review July 13, 2026 04:02
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
spectrax/_diagnostics.py 93.93% 1 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
spectrax/_diagnostics.py 78.81% <93.93%> (+4.36%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rogeriojorge
rogeriojorge force-pushed the agent/fix-odd-rfft-energy branch from b3454d7 to c3a6598 Compare July 16, 2026 13:46
@rogeriojorge
rogeriojorge force-pushed the agent/hermite-tail-diagnostic branch from af08512 to bc90950 Compare July 16, 2026 14:21
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