fix(spectrax1d): separable per-axis Hou-Li filter#274
Merged
Conversation
The previous 3D-radial formula filter[n,m,p] = exp(-α·(√(n²+m²+p²)/h_max)^p) used a single h_max = √((Nn-1)²+(Nm-1)²+(Np-1)²) for all axes. When mode counts are anisotropic (e.g. Nn=64, Nm=4), h_max is dominated by the longest axis and the short axes never reach the filter knee — every mode on the short axis sees filter ≈ 1.0, leaving the top mode there with no dealiasing. This caused energy to pile up at the highest m mode under Lorentz-force coupling and led to numerical blow-up in SRS configurations with low Nm. Replace with a separable tensor product f_n(n) · f_m(m) · f_p(p) so each axis has its own taper exp(-strength · (i/(N_axis-1))^order). The top mode on every axis is now damped at the configured strength regardless of how the mode counts compare to each other. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6776741 to
1ca6126
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Hou-Li dealiasing filter in
SpectraxVectorField._houli_filteris built as a single 3D radial taper, but the radius is normalized by the diagonalh_max = √((Nn-1)² + (Nm-1)² + (Np-1)²). When mode counts are anisotropic (e.g.Nn=64, Nm=4, Np=1),h_maxis dominated by the longest axis and the short axes never reach the filter knee — every mode onmandpseesfilter ≈ 1.0.Concretely with
Nn=16, Nm=4, Np=1, strength=36, order=36:So the top
mmode has zero damping. In SRS-like configurations where the Lorentz force pumps energy into the highest retained transverse Hermite mode, this leads to a numerical pile-up that eventually blows the run up. We hit this withNn=16, Nm=4, dt=0.1at1e15 W/cm²on a 0.5 ps run — Ey grew cleanly to ~0.08 then wentNaNat t ≈ 0.22 ps.Change
Replace the 3D-radial formula with a separable tensor product
f_n(n) · f_m(m) · f_p(p), where each axis has its own 1D taperexp(-strength · (i/(N_axis-1))^order). The top mode on every axis is nowdamped at the configured strength regardless of how the mode counts compare.
The 1-mode axis edge case (
N=1) returns[1.0]to avoid the0/0in the normalization.Test plan
Nn ≫ Nm) survives long-time integration without NaNNn=Nm=Np) gives ≈ the same filter values as before at the corners (radial and separable taper agree on the diagonal up to small differences from thei^ordervs√(n²+m²)^ordershape)🤖 Generated with Claude Code