feat(pipekit): spectral diagnostics — energy, enstrophy, isotropic spectra, filters

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

Nobody has claimed this yet.

Assessment

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

Research direction

Start by checking the implementation and acceptance criteria for dependencies #151, #110, and #108, then identify how spectral inputs, reductions, and rfft layouts are represented in the project. The issue specifies zero transforms for spectral inputs and tests against physical-space sums, analytic spectra, total energy, and Parseval weights for both layouts; done means those criteria pass.

Written by the indexing model from the issue text.

Description

enhancement

Part of epic #148. Depends on: #151 (E4.1); the spectra ops wrap #110's Tier-A functions once they exist.

Proposal

op math transforms on Spectral input
Energy E = ½ ∑ |k|² |ψ̂|² / N² (from ψ or q) 0
Enstrophy Z = ½ ∑ |q̂|² / N² (Parseval) 0
IsotropicSpectrum E(k) = ∑_{k−½ ≤ |k′| < k+½} ½|k′|²|ψ̂(k′)|², binned 0
Filter wraps SpectralFilter2D (exponential, Hou–Li, …); strength is a leaf 0

All ops reduce the trailing grid axes and keep leading (time, ensemble) axes: [T, Ny, Nx] → [T] or [T, n_k].

Prototype check: enstrophy decays monotonically under hyperviscosity (Z/Z₀ = 1 → 0.9415 over 400 steps), computed with 0 transforms on the spectral trajectory.

Acceptance criteria

  • Energy / Enstrophy equal physical-space sums (allclose) and use 0 transforms on Spectral input.
  • IsotropicSpectrum reproduces a known analytic spectrum (single-mode and power-law fields), and its bin sum equals total energy.
  • With rfft layout (#108), Parseval weights double the interior kₓ columns correctly (test for both layouts).

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.