Skip to content

Commit 5b45e20

Browse files
d-burgclaude
andcommitted
TEST - IMPROVEMENT - Re-pin Delta' diagonal for the two-pass grid
The pinned delta_prime_matrix diagonal in runtests_parallel_integration.jl was measured on the old auto-mpsi grid. Adopting develop's two-pass measured-curvature grid moves dpm[1,1] from 6.1887 to 7.7036, which failed the pin and aborted the whole suite at that include, so the 20 test files after it never ran. Re-pinned to the new grid's values. Tolerances are unchanged (rtol=1e-1) — only the reference point moved, because the grid generator did. The full suite now runs to completion: 54 testsets, no failures. Also records the underlying problem in docs/src/developer_notes.md: these pins are single points on a curve that varies ~50% across a psi_accuracy scan, so they must be re-pinned whenever the grid changes. The note sets out the plateau-based criterion (scan psi_accuracy x truncation, pin where the result is stationary) that would make the reference a property of the physics rather than of the discretization, along with what implementing it requires. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 70c1e7c commit 5b45e20

2 files changed

Lines changed: 43 additions & 9 deletions

File tree

docs/src/developer_notes.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,38 @@ Where CODE is the module name (EQUIL, ForceFreeStates, VAC, PERTURBED EQUILIBRIU
2020

2121
The regression harness **must be run on every pull request before merging into `develop`**. It is the project's primary safeguard for tracking how numerical results evolve across changes, so it is only useful if every PR exercises it. When you open a PR, paste the regression report into the PR thread so reviewers can see what moved (and what did not). If your change touches a quantity that is not yet tracked, add a new regression case — or extend an existing one — in the same PR.
2222

23+
### Open problem: pinning grid-sensitive Δ′ robustly
24+
25+
The ideal-MHD Δ′ values pinned in `test/runtests_parallel_integration.jl`
26+
(`delta_prime_matrix` diagonal) and tracked by the harness are **single-point
27+
snapshots**: one value at one `psi_accuracy` on one grid. They exist to catch
28+
unintended changes, and are explicitly *not* converged Δ′. The extraction is
29+
intrinsically grid-sensitive — a `psi_accuracy` scan from 2e-3 to 2.5e-4 swings
30+
the DIII-D-like `dpm[1,1]` by roughly 50% (about 6.2 to 9.9), and switching the
31+
grid generator moves it again. Any such pin therefore encodes an arbitrary point
32+
on a varying curve, and re-pinning is required whenever the grid changes, which
33+
weakens it as a regression signal.
34+
35+
A more defensible criterion is to pin the **plateau**: scan Δ′ across
36+
`psi_accuracy` and the integration-truncation controls, and take the value where
37+
the result is stationary — the mode of the resulting distribution rather than any
38+
single sample. Where a plateau exists it is a property of the physics rather than
39+
of the discretization, so it would survive grid changes and would be a genuine
40+
convergence statement.
41+
42+
This is not implemented. Doing it properly needs:
43+
44+
- a scan driver over `psi_accuracy` × truncation (`psihigh`, `dmlim`, `qhigh`)
45+
that records the Δ′ diagonal per configuration;
46+
- a plateau/mode detector with an explicit stationarity tolerance, plus a
47+
defined failure mode for surfaces where no plateau exists (the
48+
near-separatrix surfaces are expected to fall in this class);
49+
- a harness case that pins plateau values and their scan width, replacing the
50+
single-point pins.
51+
52+
Until then, treat the pinned diagonal as an order-of-magnitude and sign
53+
diagnostic only, and expect to re-pin it whenever the equilibrium grid changes.
54+
2355
### Regression Harness: Quick usage guide
2456

2557
Set up an alias for convenience (optional):

test/runtests_parallel_integration.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -544,20 +544,22 @@ using TOML
544544
end
545545

546546
# Pinned diagonal `delta_prime_matrix` REAL parts, PEST3-convention self-response Δ' from
547-
# the STRIDE BVP with vacuum coupling, on the two-pass auto grid (rational surfaces pinned
548-
# as mandatory knots). These pin the value at the default psi_accuracy on a fixed grid so
549-
# the test catches unintended changes; they are NOT converged Δ'. The ideal-MHD Δ'
550-
# extraction is intrinsically grid-sensitive: a psi_accuracy scan (2e-3→2.5e-4) swings
551-
# dpm[1,1] by ~50% (6.2–9.9), and a finer ldp mpsi=512 grid gives ≈8.5, so treat the
552-
# diagonal as an order-of-magnitude/sign diagnostic pending the resistive-layer Δ' work.
547+
# the STRIDE BVP with vacuum coupling, on the two-pass measured-curvature grid (rational
548+
# surfaces pinned as mandatory knots). These pin one point at the default psi_accuracy so
549+
# the test catches unintended changes; they are NOT converged Δ'. The extraction is
550+
# intrinsically grid-sensitive — a psi_accuracy scan (2e-3→2.5e-4) swings dpm[1,1] by ~50%
551+
# (6.2–9.9) and a finer ldp mpsi=512 grid gives ≈8.5 — so treat the diagonal as an
552+
# order-of-magnitude/sign diagnostic, and expect to re-pin whenever the grid generator
553+
# changes (as here). See the "pinning grid-sensitive Δ′ robustly" open problem in
554+
# docs/src/developer_notes.md for the plateau criterion meant to replace single-point pins.
553555
# (et[1], NTV torque, and ‖resonant flux‖ stay grid-robust to <1% — the sensitivity is
554556
# local to the singular-layer matching, not the global response.) Only real parts are
555557
# pinned; the imaginary parts are dominated by the PEST3 four-term cancellation and are
556558
# FP/platform-sensitive. Near-separatrix surfaces q=5,6 keep only the finiteness/non-zero
557559
# checks above. Values use this testset's mode range (mpert=27, vs full-pipeline mpert=35).
558-
@test isapprox(real(dpm[1, 1]), +6.188700e+00; rtol=1e-1) # q=2
559-
@test isapprox(real(dpm[2, 2]), -5.554900e+00; rtol=1e-1) # q=3
560-
@test isapprox(real(dpm[3, 3]), -1.578700e+01; rtol=1e-1) # q=4
560+
@test isapprox(real(dpm[1, 1]), +7.703609e+00; rtol=1e-1) # q=2
561+
@test isapprox(real(dpm[2, 2]), -5.344199e+00; rtol=1e-1) # q=3
562+
@test isapprox(real(dpm[3, 3]), -1.590034e+01; rtol=1e-1) # q=4
561563
end
562564

563565
end

0 commit comments

Comments
 (0)