Skip to content

ISLANDS - M2: Level-0 solve machinery (Newton-Krylov, Δ moments, species/frames/fields) — structure, gated physics#324

Merged
logan-nc merged 11 commits into
feature/islandsfrom
feature/islands-m2
Jul 9, 2026
Merged

ISLANDS - M2: Level-0 solve machinery (Newton-Krylov, Δ moments, species/frames/fields) — structure, gated physics#324
logan-nc merged 11 commits into
feature/islandsfrom
feature/islands-m2

Conversation

@logan-nc

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

Copy link
Copy Markdown
Collaborator

Milestone M2 of the Islands module per the contract
docs/src/islands/design/M2-launch-prompt.md: the full Level-0 solve
machinery as structure
, with every physics coefficient a supplied
[VERIFY]-gated parameter. Stacked on #320 (M1) — this PR retargets to
feature/islands when #320 merges; review only the M2 commits here.

What's here

  • solvers/ — matrix-free Newton–Krylov (Decision D2, 04 §5):
    Krylov.jl GMRES on a preallocated ForwardDiff JVP operator, Eisenstat–Walker
    forcing, backtracking line search, convergence on norm and max-norm;
    YBlockJacobi physics-block preconditioner skeleton with TSVD-regularized
    pencil solves (the explicit y_c treatment of 04 §3); dense tiny-grid debug
    Jacobian; pseudo-arclength continuation with fold detection from day one.
  • species/ — first-class species plumbing (D3, 02 §1): backgrounds,
    Bulk/Trace roles, trace-criteria checks (warn, never silently degrade).
  • frames/ — the ω/normalization conversion forms; every sign a
    NaN-defaulted FrameConvention field: an un-cleared convention poisons
    results instead of guessing (QUESTIONS Q3).
  • fields/Q(Ω)/h(Ω) flattened-electron closure structure (supplied
    prefactor) + NaN-gated ElectronClosure constants; the coefficient-free
    identity ⟨∂²h/∂x²⟩_Ω = 0.
  • moments/J̄_∥ assembly, Δ_cos/Δ_sin Ampère projections with
    required gated prefactors (ψ̃ carries an open [VERIFY]; sin
    normalization [DERIVED]-unpinned — QUESTIONS Q4), ⟨·⟩_Ω diagnostics.
  • operators/ additionsPitchAngleDiffusion in mimetic divergence
    form
    (exact discrete particle conservation + entropy sign);
    FarFieldConditions neoclassical-matching BCs (never bare Neumann,
    01 §3); weighted_moment!; flat-index helpers; IslandGrid.y_c.
  • Skipped B-ladder benchmarks (benchmarks/islands/): B2/B4/B5a-c each name
    the QUESTIONS IDs gating them. Regression case islands_l0_structural
    (solve-MMS error, Newton/GMRES counts, A7 identity, σ_min(y_c)) — verified
    locally. Paper-I OUTLINE (docs/src/islands/papers/paper-1/): the Level-0
    figure contract, C1–C3 green / C4–C8 gated.

Structural gates (all green; 67 new tests, 120 Islands total)

Gate Result
A5 zero-drive null residual exactly machine zero at g ≡ 0; Newton falls back to zero
A1-solve assembled solve-MMS Newton–Krylov recovers the manufactured state at order 3.98 (nx 17→33)
A4 conservation/entropy exact to ≲1e-11 / definite sign (mimetic form)
A3 parity Δ_cos even / Δ_sin odd under ξ-reflection, spectrally exact
A7 closure identity ⟨∂²h/∂x²⟩_Ω ≈ 1e-16 across Ω and prefactors
A8 y_c conditioning σ_min monitor finite/positive + detects a singularized pencil
Preconditioner stiff collisional solve: 79.5 s/28 Newton → 0.6 s/7 (same solution to 3e-11)
Continuation toy fold detected; steps around it, both branches visited

Verification

  • Full suite green locally: julia --project=. test/runtests.jl (all 120
    Islands tests incl. the new runtests_islands_solve.jl).
  • physics-verifier subagent: PASS — no [VERIFY]-policy violation; the
    literature numbers (−1.173, 1−1.46√ε, 8.73/1.46 ρ_bi, w_ψ/2√2) appear only as
    docstring provenance on NaN-gated fields, never assigned.
  • All new kernels pass a forced --check-bounds=yes run (M1 lesson).
  • New deps: Krylov.jl (04 §9). Nothing removed.

Explicitly NOT here (gated on the human clearance queue)

The York gates (B5a/b/c), large-w limits (B2), polarization curve (B4), and
Paper-I claims C4–C8 — all require the QUESTIONS.md Q2 (ratify D7/D8),
Q3 (clear the L0 [CHECKED] coefficient set), Q4 (open [VERIFY]s)
clearances. A thin follow-up fills the numbers and un-skips the B-ladder once
cleared.

docs-not-needed: no — docs included: docs/src/islands.md M2 status,
Paper-I OUTLINE, LOG entry.

🤖 Generated with Claude Code

https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr

logan-nc and others added 9 commits July 8, 2026 13:43
…ylov solver

Matrix-free GMRES backend for the L0 solve (design docs/src/islands/design/04-numerics.md $5, $9).

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

Land the Level-0 solve structure (design 03 §1-3, 04 §3-5; M2 contract), every
physics coefficient a supplied [VERIFY]-gated parameter — no literal in src/:

- solvers/Solvers.jl: matrix-free Newton-Krylov (Krylov.jl GMRES on a
  preallocated ForwardDiff JVP operator; Eisenstat-Walker forcing; backtracking
  line search; convergence on both norm and max-norm per 04 §5), YBlockJacobi
  physics-block preconditioner skeleton with TSVD-regularized pencil solves
  (the explicit y_c treatment of 04 §3), dense tiny-grid debug Jacobian, and a
  pseudo-arclength continuation scaffold with fold detection from day one.
- species/Species.jl: Species{AbstractBackground}, Maxwellian/SlowingDown,
  Bulk/Trace roles, validation + trace-criteria check (warn, never degrade) —
  the D3 first-class species plumbing (02 §1).
- frames/Frames.jl: Level0Parameters input vector (01 §5) and the frame
  conversion FORMS with every sign/normalization a NaN-defaulted gated
  FrameConvention field — an un-cleared convention poisons results instead of
  guessing (QUESTIONS Q3).
- fields/Fields.jl: Q(Ω)/h(Ω) flattened-electron closure structure (prefactor
  supplied), the coefficient-free A7 identity ⟨∂²h/∂x²⟩_Ω = 0, and the
  NaN-gated ElectronClosure constant set.
- moments/Moments.jl: J̄_∥ assembly from charge-scaled weighted moments,
  Δ_cos/Δ_sin projections with REQUIRED gated prefactors (ψ̃ open [VERIFY],
  sin normalization unpinned — QUESTIONS Q4), Ω label + ⟨·⟩_Ω average +
  channel-split diagnostics (pinned half-width convention).
- operators/: PitchAngleDiffusion in mimetic divergence form (exact discrete
  particle conservation + entropy sign, ladder A4), FarFieldConditions
  matching BCs (never bare Neumann, 01 §3), weighted_moment!, flat-index
  helpers; IslandGrid now records y_c for the A8 monitor.
- verify/: solve-level MMS + zero-drive configurations (A5/A1-solve) and the
  yc_block_sigma_min conditioning monitor (A8, the L23 §4.2 silent-noise
  regression tripwire).

All new kernels pass a --check-bounds=yes run (M1 lesson).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr
…/A8 + solve-MMS)

test/runtests_islands_solve.jl (67 tests, wired into runtests.jl):
- A5 zero-drive null: residual exactly machine zero at g ≡ 0; Newton falls back
  to the zero state from a perturbation.
- A1-solve: assembled Newton-Krylov solve recovers the manufactured state at
  design order (observed 3.98 on the nx = 17→33 pair).
- A4: exact discrete particle conservation (≲1e-11) + entropy sign of the
  mimetic pitch-angle operator; allocation-free apply!.
- A3: Δ_cos even / Δ_sin odd under ξ-reflection, spectrally exact projections.
- A7: ⟨∂²h/∂x²⟩_Ω = 0 to 1e-10 across Ω and prefactors (coefficient-free).
- A8: y_c-block σ_min monitor is finite/positive and detects an artificially
  singularized pencil.
- Preconditioner gate: YBlockJacobi cuts GMRES iterations >2× at identical
  solutions; far-field BC rows; pseudo-arclength fold detection; species +
  gated-frames plumbing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr
…ctural regression case

- benchmarks/islands/ (+ figures/): the docs/05 B-ladder scripts B2 (large-w
  limits), B4 (polarization ω_E structure), B5a/b/c (York threshold triangle) —
  all SKIPPED, each naming the QUESTIONS.md entries (Q2-Q4) whose human
  clearance un-gates it. Un-skipping by filling in a coefficient is the
  forbidden action; the scripts say so.
- regression-harness: new computed case islands_l0_structural tracking the
  structural numbers that silently move if the discretization/solver/quadratures
  drift — solve-MMS error + Newton/GMRES iteration counts (nx=17), the A7
  closure identity, and the A8 y_c-block sigma_min. Verified locally:
  err=5.254e-2, 6 Newton / 1210 GMRES, A7=8.0e-17, sigma_min=0.1139.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr
- docs/src/islands/papers/paper-1/OUTLINE.md: the Level-0 figure contract
  (docs/07 §3), claims → figures → ladder IDs. C1-C3 (discretization order,
  solver conditioning, conservation structure) are green as CI artifacts;
  C4-C8 (neoclassics, large-w limits, the York triangle, the Δ_pol(ω_E)
  reversal, the L23 electron-Δ_pol question) are gated on QUESTIONS Q2-Q4.
- docs/src/islands.md: M2 status (all seven submodules, gating summary).
- LOG.md: M2 session entry, including the solve-well-posedness lesson (generic
  y-diffusion without BCs is unstable; the mimetic degenerate form + far-field
  x-BCs are the correct structure).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr
…ocs missing_docs)

Extend the islands.md API reference with @autodocs sections for the five M2
submodules (SpeciesLists, Frames, Fields, Moments, Solvers) on top of the M1
fix — checkdocs=:exports requires every exported docstring covered. Local
docs build passes clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr
@logan-nc logan-nc deleted the branch feature/islands July 8, 2026 21:25
@logan-nc logan-nc closed this Jul 8, 2026
@logan-nc logan-nc reopened this Jul 8, 2026
@logan-nc logan-nc changed the base branch from feature/islands-m1 to feature/islands July 8, 2026 21:26
logan-nc and others added 2 commits July 8, 2026 17:45
…uations + figures, Islands site section

Address the missing narrative documentation: the design docs existed in-repo
but were never wired into the rendered site, and no figures existed because the
figure pipeline was contracted to the (gated) B-ladder.

- docs/src/islands/numerics.md: "numerics as implemented (M1-M2)" — the
  equations of everything actually built (sinh layer maps, spectral/Fornberg
  operators, the operator-stack residual, the mimetic collision form with its
  exact discrete conservation/entropy identities, Newton-Krylov + EW forcing +
  TSVD preconditioning, pseudo-arclength fold detection, Ω/⟨·⟩_Ω/h(Ω) geometry
  and the A7 identity, the Δ projections with gated prefactors), each anchored
  to its implementing symbols, with the A-ladder evidence table.
- benchmarks/islands/figures/make_structural_figures.jl: pinned script
  (docs/07 §2) generating the five structural figures from the verification
  machinery (grid clustering, MMS+solve convergence, Q/h profiles + A7,
  preconditioner GMRES comparison, continuation fold); PNGs committed under
  docs/src/islands/figures/ (gitignore exception) as docs assets.
- docs/make.jl: new "Islands" nav section — overview, numerics chapter,
  Paper-I figure contract, and the full design-document set (00-08).
- docs/src/islands.md: now links the narrative pages from the API reference.

Local docs build passes clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr
@logan-nc logan-nc merged commit 8220e53 into feature/islands Jul 9, 2026
2 checks passed
@logan-nc logan-nc deleted the feature/islands-m2 branch July 9, 2026 00:22
logan-nc added a commit that referenced this pull request Jul 9, 2026
…tract (derivation lane)

User decisions (2026-07-08): PR #324 merged; D7 and D8 ratified as written
(Decision Log updated, Q2 RESOLVED); Q3 clearance mode = re-derivation first.

M2b-launch-prompt.md is the next milestone contract: independent derivations of
the L0 coefficient set into docs/src/islands/derivations/ with cross-check
tables against the [CHECKED] transcriptions, item-by-item human sign-off
(recorded in docs/01) clearing coefficients into a named-configuration builder,
progressive un-skipping of the B-ladder with docs/05 reporting, and honest
triage of any threshold disagreement. Provenance rules sharpened: [DERIVED]
never presented as transcription, no unsigned coefficient in src/, no tuning
to pass benchmarks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pUwoFRo9a5AjF8HuwcZMr
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