Skip to content

ISLANDS - M1: phase-space grids + operator-stack skeleton + MMS/AD harness#320

Merged
logan-nc merged 9 commits into
feature/islandsfrom
feature/islands-m1
Jul 8, 2026
Merged

ISLANDS - M1: phase-space grids + operator-stack skeleton + MMS/AD harness#320
logan-nc merged 9 commits into
feature/islandsfrom
feature/islands-m1

Conversation

@logan-nc

@logan-nc logan-nc commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Milestone M1 of the Islands module (src/Islands/) — the drift-kinetic
island/layer solver. Lands the numerical skeleton and verification harness,
not the physics numbers (design docs 03 §1–2, 04, ladder A1/A2;
src/Islands/CLAUDE.md [VERIFY] policy).

What's here

  • phasespace/PhaseSpace.jl — the (x, ξ, y, E, σ) phase space with
    layer-clustered maps (04 §1): Fourier spectral ∂ξ; Fornberg high-order
    finite differences for ∂x/∂y on sinh-stretched grids (window sized
    per-derivative so D1 and D2 are both 4th-order including boundaries);
    composite-Simpson quadrature weights; Gauss–Laguerre energy nodes. Pure
    numerics — no physics coefficients.
  • operators/Operators.jlAbstractTerm + apply! + residual! and the
    term structs of 03 §2 (ParallelStreaming, MagneticDrift with the
    :original/:improved toggle, ExBDrift as the (x,ξ) Poisson bracket,
    Collisions, GradientDrive, PerpTransport/RadiationSink L4 stubs,
    Quasineutrality field residual). Every physics coefficient is a supplied
    data field — never a literal.
    Allocation-free; generic over eltype so
    ForwardDiff duals flow through.
  • verify/Verify.jl — the manufactured-solution (MMS) + AD-vs-FD JVP harness
    and allocation probes. Manufactured coefficients are arbitrary order-unity test
    values (not physics), exercising the discretization only.
  • Tests (test/runtests_islands_{grids,operators}.jl, wired into
    runtests.jl), all green:
    • A1 per-operator MMS → 4th order for ∂x/∂y terms, machine precision
      for the Fourier ∂ξ term; assembled kinetic residual → 4th order.
    • A2 forward-mode-AD JVP of the (nonlinear) assembled residual matches the
      central-difference directional derivative to ~1e-9.
    • Allocation regression: every apply! / residual! hot path allocates
      0 bytes.
  • ForwardDiff added to Project.toml (04 §9).

Verification

  • Full suite green: julia --project=. test/runtests.jl passes (incl. the 53 new
    Islands tests).
  • physics-verifier subagent: PASS — audited all six new/changed files; no
    [VERIFY]-policy violation. The flagged literature numbers (8.73/1.46 ρ_bi,
    k=−1.173, …) appear only in docstring prose, never assigned to a coefficient.

[VERIFY] discipline

No [VERIFY]/[CHECKED] physics coefficient, sign, or normalization is assigned
a value anywhere in src/. Physics operators (drift frequencies, collision
kernels, the Δ moments, York thresholds) land in later milestones and stay gated
until their tags are human-cleared. docs/src/islands/QUESTIONS.md Q1
(julia-on-PATH) is resolved.

docs-not-needed: M1 changes no physics behavior; the Islands docs page is
updated with the M1 status and the design docs remain the normative spec.

🤖 Generated with Claude Code

logan-nc and others added 8 commits July 8, 2026 09:21
M1 needs forward-mode AD for the JVP/AD-compatibility checks (design
docs/src/islands/design/04-numerics.md §9). Adds ForwardDiff to Project.toml
(already present transitively in the manifest); removes nothing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ck + verify harness

Land the milestone-M1 numerical skeleton (design 03 §1-2, 04; ladder A1/A2),
structure only — no [VERIFY] physics coefficients assigned in src/.

- phasespace/PhaseSpace.jl: the (x, ξ, y, E, σ) grids with layer-clustered maps.
  Fourier spectral ∂ξ; Fornberg high-order finite differences for ∂x/∂y on
  sinh-stretched grids (per-derivative window widths so D1 and D2 are both
  4th-order including boundaries); composite-Simpson quadrature weights;
  Gauss-Laguerre energy nodes. Pure numerics.
- operators/Operators.jl: AbstractTerm + apply! + residual! and the term structs
  of 03 §2 (ParallelStreaming, MagneticDrift with the :original/:improved toggle,
  ExBDrift as the (x,ξ) Poisson bracket, Collisions, GradientDrive, PerpTransport
  and RadiationSink L4 stubs, Quasineutrality field residual). Every physics
  coefficient is a supplied data field, never a literal; allocation-free and
  generic over eltype so ForwardDiff duals flow through.
- verify/Verify.jl: manufactured-solution (MMS) + AD-vs-finite-difference JVP
  harness, plus allocation probes. Manufactured coefficients are arbitrary
  order-unity test values (not physics), exercising the discretization only.
- Islands.jl: wire the three submodules.

physics-verifier: PASS (no [VERIFY]-policy violation).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…to runtests

test/runtests_islands_grids.jl and test/runtests_islands_operators.jl, included
in test/runtests.jl:

- A1 per-operator MMS: 4th-order convergence for the ∂x/∂y differential terms,
  machine precision for the Fourier ∂ξ (drift) term; assembled kinetic residual
  converges at 4th order.
- A2: forward-mode-AD JVP of the (nonlinear) assembled residual matches the
  central finite-difference directional derivative to ~1e-9.
- Allocation regression: every apply! and residual! hot path allocates 0 bytes.
- Grid unit tests: Fourier exactness, mapped-FD order, Simpson/Gauss quadrature,
  layer-clustered packing, IslandGrid assembly and input validation.

All 53 Islands tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…path)

- docs/src/islands.md: document the M1 skeleton (PhaseSpace/Operators/Verify),
  restating the structure-only [VERIFY] discipline.
- LOG.md: M1 session entry (what moved / blocked / next).
- QUESTIONS.md: Q1 RESOLVED — julia is at the ncl2128 software dir and must be
  invoked with a clean LD_LIBRARY_PATH (OMFIT contamination); used here to run
  the suite locally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Set up the next milestone (M2 — L0 solve machinery) for the autonomous loop,
mirroring the M1 launch-prompt bootstrap.

- docs/src/islands/design/M2-launch-prompt.md: the M2 milestone contract. Scope
  = full L0 solve machinery (solvers/, moments/, frames/, fields/, species/,
  neoclassical-matching BCs) as AD-compatible allocation-free structure with every
  physics coefficient a [VERIFY]-gated parameter. DoD = the physics-free structural
  gates (A5 null, assembled solve-MMS, A8 y_c conditioning, A4 conservation, A3
  parity, A7 ⟨∂²h/∂x²⟩=0) + suite + PR + Paper-I OUTLINE + the clearance queue.
  The York gates (B5a/b/c, B2, B4) are explicitly OUT — they need human-cleared
  physics; reaching one by hardcoding is a policy violation, not completion.
- QUESTIONS.md: seed the parallel-human clearance queue — Q2 (ratify D7/D8),
  Q3 (clear the L0 [CHECKED] coefficient set with exact cites), Q4 (open [VERIFY]s:
  the psi-tilde q_s'/q_s typo, B5a collisionality, acquire WCHH96 + Park 2022).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the overnight-loop framing (dontAsk/--continue header, unattended language,
Stop-hook exit-criteria) — M2 is driven interactively via /goal in auto mode.
Blocked coefficients are surfaced to the user to clear live rather than only
parked in QUESTIONS.md. The contract (scope, DoD, [VERIFY] hard rule, gated York
gates) is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…docs missing_docs)

Documenter's checkdocs=:exports requires every exported docstring in the
package (including submodules) to appear in a page; the islands.md @autodocs
block only listed the top-level Islands module, so the PhaseSpace/Operators/
Verify exports failed the docs build. Add per-submodule @autodocs sections.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr
@logan-nc logan-nc merged commit f48aa55 into feature/islands Jul 8, 2026
2 of 3 checks passed
@logan-nc logan-nc deleted the feature/islands-m1 branch July 8, 2026 21:25
@logan-nc logan-nc restored the feature/islands-m1 branch July 8, 2026 21:26
@logan-nc logan-nc deleted the feature/islands-m1 branch July 8, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant