feat(pipekit): Fourier derivative operators on the spectral carrier

Open
#152 0 comments 0 reactions 0 assignees View on GitHub

@jejjohnson is already working on this.

Since Oct 17, 2026.

  • #160 by @jejjohnson — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start by reading the referenced Tier-A work in #151, #149, and #150, then locate the Tier-B operator definitions and check_operator tests; the payload does not name file paths. Implement each listed operator as a wrapper around its Tier-A method and check allclose results and compiled HLO transform budgets on both carriers and output modes. Verify the barotropic vorticity RHS totals 5 transforms per evaluation and that the Hyperviscosity gradient matches finite differences; the issue notes the latter depends on #103.

Written by the indexing model from the issue text.

Description

enhancement

Part of epic #148. Depends on: #151 (E4.1), #149 (E4.0a) (traced coefficients), #150 (E4.0b) (spectral_out)

Proposal

One Tier-B op per Tier-A method, each Array | Spectral → Array | Spectral per out. Bodies call Tier A with spectral=isinstance(x, Spectral) and spectral_out=(out == "spectral"). No multipliers are re-implemented.

op math (Fourier) transforms, spectral → spectral transforms, physical → physical
Gradient (ikₓ û, ik_y û) 0 1 + 2
Divergence ikₓ v̂ₓ + ik_y v̂_y 0 2 + 1
Curl ikₓ v̂_y − ik_y v̂ₓ 0 2 + 1
Laplacian −|k|² û 0 1 + 1
InverseLaplacian −û/|k|², mean → 0 0 1 + 1
Biharmonic |k|⁴ û 0 1 + 1
Hyperviscosity −ν |k|²ⁿ û (ν a leaf) 0 1 + 1
VelocityFromStreamfunction (−ik_y ψ̂, ikₓ ψ̂) 0 1 + 2
ProjectVector Leray: v̂ − k(k·v̂)/|k|² 0 2 + 2
Jacobian ℱ[fₓg_y − f_yg_x], 2/3-truncated 4 inv + 1 fwd 2 fwd + 4 inv + dealias round trip (1 + 1), today
AdvectionScalar ℱ[u·∇q], 2/3-truncated 2 inv + 1 fwd if u, v arrive physical; 4 inv + 1 fwd if all three are Spectral per #108
Dealias m ⊙ û 0 1 + 1

Each row's spectral → spectral budget is asserted with check_operator(..., budget=...). The physical → physical column documents today's cost and explains why the carrier exists.

Acceptance criteria

  • Every op equals its Tier-A method (allclose, x64) on both carriers and both out modes.
  • The budgets in the table hold in compiled HLO.
  • Barotropic vorticity RHS −Jacobian(InverseLaplacian(q), q) + Hyperviscosity(q) on a Spectral input with out="spectral": 5 transforms per evaluation, 20 per RK4 step (prototype: 20, vs 40 on the physical carrier).
  • jax.grad w.r.t. Hyperviscosity.nu matches finite differences (prototype: −1.0073e8 vs −1.0063e8). This fails today with TracerBoolConversionError until #103 lands.

Generated by Claude Code

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jejjohnson/spectraldiffx

All issues in jejjohnson/spectraldiffx

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.