feat(operators): missing Fourier operators — 3/2-rule `dealiased_product`, `iterated_laplacian`, `vorticity_from_velocity`/`streamfunction_from_vorticity`, vector advection, energy/enstrophy spectra, hyperviscous Helmholtz inverse for IMEX
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 40/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- jupyter, python
- Domain
- backend-api-design, tooling
Research direction
The issue lists missing operators in spectraldiffx. Start by reading the existing SpectralDerivative class in grid.py and the hand-rolled implementations in demo_qg.py, navier_stokes_2d.py, and test_correctness.py. The first task is likely implementing dealiased_product with 3/2 padding; check the dealias handling in grid.py lines 83, 275, 500. Run the validation tests described in the acceptance criteria to confirm correctness.
Written by the indexing model from the issue text.
Description
Part of #83.
Summary
Operations that every simulation notebook, script, or test hand-rolls, or that the API advertises without implementing:
| Operator | Status today | Where it is hand-rolled |
|---|---|---|
dealiased_product(a, b) with 3/2 zero-padding |
dealias="padding" is accepted by the grid type but is a no-op (grid.py:83, 275, 500); no padding code exists |
– |
iterated_laplacian(u, n) |
only the spherical class has it | demo_qg.py:513-516 loops deriv.laplacian |
vorticity_from_velocity(u, v) = v_x − u_y; streamfunction_from_vorticity(zeta) = ∇⁻²ζ |
– | five call sites do solve + gradient + sign flips instead of velocity_from_streamfunction |
vector advection (u·∇)u |
– | Navier–Stokes notebooks |
energy_spectrum(u), enstrophy_spectrum(zeta) (isotropic shell binning) |
– | demo_qg.py, navier_stokes_2d.py, test_correctness.py |
helmholtz_inverse(u, alpha, nu, order) = (1 − dt(ν∇^{2n} ...))⁻¹ in spectral space for IMEX schemes |
SpectralHelmholtzSolver covers ∇² − α only |
pseudospectral_part2.py |
advection_scalar(..., spectral=...) |
missing the spectral argument the other methods have |
– |
Proposed fix
Implement on SpectralDerivative (N-D class from this epic, or on the existing 2D/3D classes if that lands first):
dealiased_product(a, b): pad both spectra to3N/2per axis, inverse transform, multiply, forward transform, truncate. Provide as the implementation behinddealias="padding", and validate thedealiasfield so unknown strings raise.iterated_laplacian(u, n):(−K2)^nmultiplier, one transform pair.vorticity_from_velocity,streamfunction_from_vorticity(with the null-mode gauge documented),velocity_from_vorticity= composition.advect_vector(u, v):(u·∇)u, (u·∇)vwith the same dealiasing policy asjacobian.energy_spectrum(u)andenstrophy_spectrum(zeta):|k|-shell binning with bin edges at integer wavenumbers; return(k_bins, E).helmholtz_inverse(u_hat, coeffs): general1 / (1 + Σ c_n (−K2)^n)multiplier for IMEX; document with the QG example.
Acceptance criteria
-
dealiased_product(cos(Kx), cos(Kx))atK= largest kept mode has zero energy at the alias index forN ∈ {30, 32, 48, 64}; matches the 2/3-truncated product to 1e-12 on the retained modes. -
iterated_laplacian(u, 2) == biharmonic(u)to 1e-12. -
vorticity_from_velocity(*velocity_from_streamfunction(psi)) == laplacian(psi)to 1e-12. -
energy_spectrumofcos(3x) + cos(4y)puts all energy in bins 3 and 4. - Notebooks
demo_qg.py,navier_stokes_2d.py,qg_model.pyuse the new methods (no hand-rolled spectra or loops).
- Dominant language
- Python
- Stars
- 2
- Forks
- 0
- Avg merge
- 8h 13m
- Merged PRs (30d)
- 8
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jejjohnson/spectraldiffx
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jejjohnson/spectraldiffx#172 ·
-
epic
Difficulty 1/5 Under an hour Newbie friendliness 62/100
jejjohnson/spectraldiffx#167 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
jejjohnson/spectraldiffx#113 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
jejjohnson/spectraldiffx#105 ·
-
dependencies
Difficulty 4/5 3-5 days Newbie friendliness 45/100
jejjohnson/spectraldiffx#181 ·
All issues in jejjohnson/spectraldiffx
Similar issues
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorPossibly taken @jejjohnson claimed this today. Opentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jejjohnson/integrix#144 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
finos/ai-governance-framework#459 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days
-
type/bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainers usually reply within 1 day