Repository navigation
Strict 2/3 de-aliasing mask (3|k| < N) with one active Fourier subspace - #55
Open
rogeriojorge wants to merge 4 commits into
Open
rogeriojorge wants to merge 4 commits into
rogeriojorge wants to merge 4 commits into
Conversation
…state onto it The inclusive bound |k| <= N//3 keeps k = K when N = 3K; the product of two retained +K modes then aliases onto the retained -K mode (amplitude 1/4 for a cosine). Build the mask from integer mode indices with 3|k| < N on every axis, project the initial state onto the same active set, and report the removed norm as initial_projection_residual. The Nx=3 example inputs, which would now retain only k=0, use Nx=4 so they keep their kx=1 mode.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This was referenced Oct 3, 2026
rogeriojorge
added a commit
that referenced
this pull request
Oct 5, 2026
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.
Problem
_twothirds_maskkeeps|k| <= N//3. WhenN = 3K, two retained+Kmodes multiply to2K, which aliases onto the retained-K. Foru = cos(2*pi*K*x/N)the masked square should contain only its mean; on main it keeps a spurious amplitude 1/4 at|k| = K. Reproduced against main (ab87385) for N = 6, 12, 33, 129 on both the rFFT (x) axis and the full-FFT (y) axis. This is a Fourier-product issue, not an rFFT issue. It says nothing yet about how much existing runs were affected; that depends on their spectrum at the cutoff.Change
_twothirds_mask: integer mode indices, keep3*|k| < N(i.e.|k| <= (N-1)//3) on every axis.simulation: projectCk_0,Fk_0onto the same active set so distribution, current and fields share one Fourier subspace; the removed norm is reported asoutput["initial_projection_residual"].Nx=3now useNx=4(still kx=1, same physics).Tests (
tests/test_dealiasing.py, 78 cases)Exact kept set for N in {3..9,12,33,34,129} on y/x/z; exhaustive triad no-alias check; boundary-cosine square on rFFT and full axes; 2D mixed triads (even/odd, divisible by 3); initial projection + residual reporting. 39 of them fail on main's mask.
Evidence (tested SHA 4f8939f, local, Python 3.12.9, JAX 0.11.2, diffrax 0.7.2)
python -m pytest -n 2 -q tests-> main: 8 passed; this branch: 86 passed.Landau example IC, t in [0,20]: main at Nx=4 and this branch at Nx=4 give bitwise-identical
EM_energy. Main at Nx=3 gives exactly half of it: the kx=1 mode is counted as Nyquist with weight 1 at odd Nx (the weight bug fixed by #9), the dynamics agree.No dependencies. Conflicts with #13 in
simulation(initial state + output dict); resolution = project, then reshape to the structured tuple (see branchintegration/dark-baseline-a1, all six PRs combined: 115 passed locally). GitHub CI on 4f8939f: 3.11 and 3.12 passed.