Skip to content

Vacuum/ForceFreeStates - BUGFIX! - Put the vacuum and norm matrices in the plasma's Fourier frame - #503

Open
jhalpern30 wants to merge 4 commits into
developfrom
bugfix/vacuum-theta-frame
Open

jhalpern30 wants to merge 4 commits into
developfrom
bugfix/vacuum-theta-frame

Conversation

@jhalpern30

@jhalpern30 jhalpern30 commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Release note

  • Audience: users
  • Numerical impact: δW, Λ and P move for up-down asymmetric equilibria in the harness: δW ≤ 0.05 % on DIII-D, plasma and vacuum energies ±1–2 % each, resonant fields, Δ′, PE energies and NTV torque 0.5–6 %, EFC residual torque ~10 %, Solov'ev ≤ 0.35 % (its loose etol); GGJ, EFIT fixed-boundary and resistive cases unchanged. A 13-case scan outside the harness found up to 30 % in P with a conformal wall (harness @ 94cdf5f)
  • Migration: Hand-built 2D VacuumInput contours, and the ζ = 0 cross-section of 3D boundaries, must now run counter-clockwise in (R, Z) — clockwise input throws an ArgumentError. Clockwise wall files still work and are reversed with a warning. FourierTransform(...; ν=) is now ζ= and takes each point's toroidal angle (pass -ν for a contour on the ϕ = 0 plane). SurfaceGeometries points in gpec.h5 are now stored counter-clockwise.

The free-boundary energy δW, the plasma inductance Λ and the permeability P changed when the poloidal-angle origin of an up-down asymmetric equilibrium was moved. They no longer do: the vacuum response and the edge norm are now in the same Fourier frame as the plasma matrices. The same defect is in Fortran DCON.

Regression report

Develop was merged into the PR (develop 6fc89d021, head 94cdf5f39) after the full 16-case run. diiid_n1, diiid_n1_riccati and solovev_n1 were rerun on Landau at the merged head (develop 6fc89d021 vs PR head 94cdf5f39, run 2026-10-09_pr503_merge, julia 1.12.7, pinned manifest). The other 13 cases were not rerun: their rows and reports are from the earlier run on Feynman, develop 0e68a0553 vs 60af2dda5 (runs 2026-10-05_pr503_main and _errfield). In the three reruns the changed/unchanged counts and the size of the PR's moves match the earlier run (21/32, 6/11, 8/14). The develop baseline itself moved between the two stamps through other develop PRs (DIII-D et +0.03 %, Solov'ev et 0.596 → 0.513, PE toroidal torque 5.1e‑2 → 1.2e‑4), and the PR head moved with it.

Case Changed / unchanged Largest moves
diiid_n1 21 / 32 δW 0.02 %; ep 1.7 %, ev 1.1 %; PE surface energy 5.6 %, PE torque 3.2 %; NTV 3.3 %; b^r 2.7 %
diiid_multi_n 11 / 8 δW 0.04 %; response b̃ 4.3 %; Δ′ 4.6 %; b^r 3.2 %; ideal torque ~2e‑6 (near zero) 25 %
diiid_n1_riccati 6 / 11 δW 0.03 %; ep 1.7 %, ev 1.1 %; Δ′ 0.2–0.9 %
diiid_slayer_n1 2 / 15 γ 0.7 % (7 Hz, above its ~0.13 Hz run-to-run scatter); Q_root 0.03 %
diiid_error_field 6 / 2 EFC residual torque 8.7–9.7 %; whole-field NTV 3.3 %; overlap 0.5 %
solovev_n1 8 / 14 δW 0.30 %; spectra ≤ 0.2 %
solovev_multi_n 6 / 9 δW 0.05 %
solovev_kinetic_multiion 5 / 1 NTV 0.75 %; δW 0.35 %
solovev_kinetic_ntv 2 / 4 δW 0.35 %
solovev_kinetic_calculated 8 / 9 ≤ 0.27 %
solovev_kinetic_nuzero 5 / 9 ≤ 0.01 %
efit_fixedbdy_separatrix, gal_resistive_diiid, ggj_reference, ggj_ray_q500i 0 changed —
gal_resistive_pe 8 N/A on both refs case extracts nothing on develop either; not from this PR

The DIII‑D ev/ep "(all)" vectors move up to 35 % because the eigenvectors of W_t redistribute energy between plasma and vacuum once W_v changes; the eigenvalues themselves (et) move ≤ 0.04 %. The Solov'ev moves match its known up-down asymmetry at etol = 1e-7.

Full reports

Reports for the 13 cases not rerun after the develop merge are from develop 0e68a0553 vs 60af2dda5; diiid_n1, diiid_n1_riccati and solovev_n1 are from develop 6fc89d021 vs 94cdf5f39.

Regression Report: diiid_multi_n
===================================================================================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Quantity                                                      0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff                Status
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
total energy Re(et[1])                                        -5.752606e-01                             -5.750526e-01                             2.081e-04 (0.04%)   ** CHANGED **
total energy (all)                                            [58 elem]                                 [58 elem]                                 1.225e+02 (1.49%)   ** CHANGED **
ODE steps (saved)                                             652                                       652                                       0.0e+00             OK
mpert                                                         29                                        29                                        0.0e+00             OK
npert                                                         2                                         2                                         0.0e+00             OK
toroidal mode label of each mode index (checksum)             8d8d42b8832d...                           8d8d42b8832d...                           identical           OK
permeability diagonal P~_ii (all n blocks)                    [58 elem]                                 [58 elem]                                 2.837e-02 (0.35%)   ** CHANGED **
forcing b~ (root-area-weighted), n = 1, 2                     [58 elem]                                 [58 elem]                                 0.0e+00             OK
response b~ (root-area-weighted), n = 1, 2                    [58 elem]                                 [58 elem]                                 1.215e-05 (4.34%)   ** CHANGED **
PE plasma energy (sum over n)                                 2.933273e+00                              2.936744e+00                              3.471e-03 (0.12%)   ** CHANGED **
PE vacuum energy (sum over n)                                 3.114145e+00                              3.114145e+00                              2.7e-15             OK
PE surface energy (sum over n)                                3.530007e+00                              3.523658e+00                              6.349e-03 (0.18%)   ** CHANGED **
PE toroidal torque sum_n -2n Im(Phi_n' Lambda_nn^-1 Phi_n)/4  2.443052e-06                              1.820377e-06                              6.227e-07 (25.49%)  ** CHANGED **
resonant n per row (rows sorted by psi across n)              [7 elem]                                  [7 elem]                                  0.0e+00             OK
resonant m per row                                            [7 elem]                                  [7 elem]                                  0.0e+00             OK
resonant area-weighted field b^r per row                      [7 elem]                                  [7 elem]                                  3.502e-06 (3.24%)   ** CHANGED **
island half-widths per row                                    [7 elem]                                  [7 elem]                                  1.295e-04 (0.68%)   ** CHANGED **
Chirikov parameter per row                                    [7 elem]                                  [7 elem]                                  1.747e-03 (0.37%)   ** CHANGED **
forcing-driven Delta' per row                                 [7 elem]                                  [7 elem]                                  1.560e-04 (4.57%)   ** CHANGED **
Runtime (s)                                                   320.6s                                    318.4s                                                        --
===================================================================================================================================================================================
Summary: 11 changed, 8 unchanged

Regression Report: diiid_n1
===================================================================================================================================================================
Ref 1: 6fc89d021a18f7a57aa711fdfb9a6ce0364aefd9  @ 6fc89d021 (2026-10-09)
       env: julia 1.12.7, x86_64-linux-gnu, manifest aa94b997 (pinned), 4 threads/4 BLAS, jit build
Ref 2: 94cdf5f397c350c4ccc66d11f495f5b1ffd0b40e  @ 94cdf5f39 (2026-10-09)
       env: julia 1.12.7, x86_64-linux-gnu, manifest aa94b997 (pinned), 4 threads/4 BLAS, jit build
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Quantity                                      6fc89d021a18f7a57aa711fdfb9a6ce0364aefd9  94cdf5f397c350c4ccc66d11f495f5b1ffd0b40e  Diff                Status
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
total energy Re(et[1])                        8.013277e-01                              8.014801e-01                              1.524e-04 (0.02%)   ** CHANGED **
total energy Im(et[1])                        8.238192e-05                              7.912713e-05                              3.255e-06 (3.95%)   ** CHANGED **
plasma energy Re(ep[1])                       -1.348257e+00                             -1.370871e+00                             2.261e-02 (1.68%)   ** CHANGED **
vacuum energy Re(ev[1])                       2.149585e+00                              2.172351e+00                              2.277e-02 (1.06%)   ** CHANGED **
vacuum matrix min eigenvalue                  1.873975e-01                              1.873975e-01                              6.0e-14             OK
plasma energy (all)                           [35 elem]                                 [35 elem]                                 1.240e+02 (1.05%)   ** CHANGED **
vacuum energy (all)                           [35 elem]                                 [35 elem]                                 7.437e+02 (35.60%)  ** CHANGED **
total energy (all)                            [35 elem]                                 [35 elem]                                 7.887e+02 (5.86%)   ** CHANGED **
ODE steps (saved)                             1419                                      1419                                      0.0e+00             OK
ODE steps (total)                             1414                                      1414                                      0.0e+00             OK
q0                                            1.204212e+00                              1.204212e+00                              0.0e+00             OK
q95                                           4.781723e+00                              4.781723e+00                              0.0e+00             OK
beta_t                                        1.327024e-02                              1.327024e-02                              0.0e+00             OK
beta_n                                        1.372510e+00                              1.372510e+00                              0.0e+00             OK
internal inductance li1                       8.842319e-01                              8.842319e-01                              0.0e+00             OK
internal inductance li2                       7.080796e-01                              7.080796e-01                              0.0e+00             OK
internal inductance li3                       7.304381e-01                              7.304381e-01                              0.0e+00             OK
poloidal beta betap1                          6.680732e-01                              6.680732e-01                              0.0e+00             OK
poloidal beta betap2                          5.349830e-01                              5.349830e-01                              0.0e+00             OK
poloidal beta betap3                          5.518757e-01                              5.518757e-01                              0.0e+00             OK
# singular surfaces                           5                                         5                                         0.0e+00             OK
singular psi locations                        [5 elem]                                  [5 elem]                                  0.0e+00             OK
singular q values                             [5 elem]                                  [5 elem]                                  0.0e+00             OK
current beta betaj                            4.236475e-01                              4.236475e-01                              0.0e+00             OK
plasma volume                                 1.829472e+01                              1.829472e+01                              0.0e+00             OK
plasma current                                1.152131e+00                              1.152131e+00                              0.0e+00             OK
mpert                                         35                                        35                                        0.0e+00             OK
npert                                         1                                         1                                         0.0e+00             OK
toroidal field bt0                            2.006573e+00                              2.006573e+00                              0.0e+00             OK
wall field bwall                              3.880147e-01                              3.880147e-01                              0.0e+00             OK
aspect ratio                                  2.845746e+00                              2.845746e+00                              0.0e+00             OK
elongation kappa                              1.708321e+00                              1.708321e+00                              0.0e+00             OK
q profile (checksum)                          d63983ef55be...                           d63983ef55be...                           identical           OK
pressure profile (checksum)                   a3828095e6f7...                           a3828095e6f7...                           identical           OK
Mercier D_I profile (checksum)                a41aa63daffe...                           a41aa63daffe...                           identical           OK
resistive interchange D_R profile (checksum)  a4a7ad9a6df2...                           a4a7ad9a6df2...                           identical           OK
ballooning Delta' profile (checksum)          5e898ed036e6...                           5e898ed036e6...                           identical           OK
island half-widths                            [5 elem]                                  [5 elem]                                  2.249e-04 (0.73%)   ** CHANGED **
Chirikov parameter                            [5 elem]                                  [5 elem]                                  9.156e-03 (1.14%)   ** CHANGED **
||resonant area-weighted field||              5.196865e-04                              5.285073e-04                              8.821e-06 (1.70%)   ** CHANGED **
dominant-coupling singular values             [3 elem]                                  [3 elem]                                  1.513e-02 (0.68%)   ** CHANGED **
|forcing overlap with dominant mode|          1.418553e-04                              1.411683e-04                              6.870e-07 (0.48%)   ** CHANGED **
|delta_nominal| of coil set 1                 7.069534e-05                              7.035295e-05                              3.424e-07 (0.48%)   ** CHANGED **
||ddelta/d(shift)|| over coil sets            1.246546e-04                              1.245510e-04                              1.036e-07 (0.08%)   ** CHANGED **
||ddelta/d(tilt)|| over coil sets             4.181056e-07                              4.176789e-07                              4.267e-10 (0.10%)   ** CHANGED **
PE plasma energy                              3.420559e+00                              3.320325e+00                              1.002e-01 (2.93%)   ** CHANGED **
PE vacuum energy                              3.174510e+00                              3.174510e+00                              2.2e-15             OK
PE surface energy                             5.828377e+00                              5.504720e+00                              3.237e-01 (5.55%)   ** CHANGED **
PE toroidal torque                            1.156214e-04                              1.119206e-04                              3.701e-06 (3.20%)   ** CHANGED **
NTV torque FGAR [N·m]                         5.314082e-01                              5.490534e-01                              1.765e-02 (3.32%)   ** CHANGED **
NTV kinetic energy dW FGAR [J]                7.955379e-02                              8.216282e-02                              2.609e-03 (3.28%)   ** CHANGED **
Runtime (s)                                   474.1s                                    475.9s                                                        --
||forcing b~|| (root-area-weighted)           4.683328e-04                              4.683328e-04                              0.0e+00             OK
resonant area-weighted field b^r              [5 elem]                                  [5 elem]                                  1.103e-05 (2.72%)   ** CHANGED **
===================================================================================================================================================================
Summary: 21 changed, 32 unchanged

Regression Report: diiid_n1_riccati
===================================================================================================================================================
Ref 1: 6fc89d021a18f7a57aa711fdfb9a6ce0364aefd9  @ 6fc89d021 (2026-10-09)
       env: julia 1.12.7, x86_64-linux-gnu, manifest aa94b997 (pinned), 4 threads/4 BLAS, jit build
Ref 2: 94cdf5f397c350c4ccc66d11f495f5b1ffd0b40e  @ 94cdf5f39 (2026-10-09)
       env: julia 1.12.7, x86_64-linux-gnu, manifest aa94b997 (pinned), 4 threads/4 BLAS, jit build
---------------------------------------------------------------------------------------------------------------------------------------------------
Quantity                       6fc89d021a18f7a57aa711fdfb9a6ce0364aefd9  94cdf5f397c350c4ccc66d11f495f5b1ffd0b40e  Diff               Status
---------------------------------------------------------------------------------------------------------------------------------------------------
delta prime (BVP diagonal)     [5 elem]                                  [5 elem]                                  3.934e+00 (0.17%)  ** CHANGED **
delta prime (raw side-major)   [10 elem]                                 [10 elem]                                 7.348e+01 (0.90%)  ** CHANGED **
edge coil response delta_coil  [10 elem]                                 [10 elem]                                 0.0e+00            OK
total energy Re(et[1])         8.038162e-01                              8.040669e-01                              2.507e-04 (0.03%)  ** CHANGED **
plasma energy Re(ep[1])        -1.344521e+00                             -1.367139e+00                             2.262e-02 (1.68%)  ** CHANGED **
vacuum energy Re(ev[1])        2.148337e+00                              2.171205e+00                              2.287e-02 (1.06%)  ** CHANGED **
total energy (all)             [35 elem]                                 [35 elem]                                 7.887e+02 (5.86%)  ** CHANGED **
# singular surfaces            5                                         5                                         0.0e+00            OK
singular psi locations         [5 elem]                                  [5 elem]                                  0.0e+00            OK
singular q values              [5 elem]                                  [5 elem]                                  0.0e+00            OK
ODE steps (saved)              98                                        98                                        0.0e+00            OK
ODE steps (total)              4020                                      4020                                      0.0e+00            OK
mpert                          35                                        35                                        0.0e+00            OK
npert                          1                                         1                                         0.0e+00            OK
q0                             1.204212e+00                              1.204212e+00                              0.0e+00            OK
q95                            4.781723e+00                              4.781723e+00                              0.0e+00            OK
beta_n                         1.372510e+00                              1.372510e+00                              0.0e+00            OK
Runtime (s)                    359.4s                                    354.1s                                                       --
===================================================================================================================================================
Summary: 6 changed, 11 unchanged

Regression Report: diiid_slayer_n1
========================================================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
--------------------------------------------------------------------------------------------------------------------------------------------------------
Quantity                            0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff               Status
--------------------------------------------------------------------------------------------------------------------------------------------------------
SLAYER surface indices              [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER poloidal m                   [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER toroidal n                   [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER minor radius rs              [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER r-based shear                [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER Lundquist S                  [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER D_norm                       [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER P_perp                       [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER tauk                         [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER iota_e                       [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER Q_e                          [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER Q_i                          [6 elem]                                  [6 elem]                                  0.0e+00            OK
SLAYER Q_root [2/1,3/1,4/1]         [3 elem]                                  [3 elem]                                  1.911e-04 (0.03%)  ** CHANGED **
SLAYER ω_Hz [2/1,3/1,4/1]           [3 elem]                                  [3 elem]                                  3.6e-01            OK
SLAYER γ_Hz [2/1,3/1,4/1]           [3 elem]                                  [3 elem]                                  7.128e+00 (0.70%)  ** CHANGED **
SLAYER no_root flags [2/1,3/1,4/1]  [3 elem]                                  [3 elem]                                  0.0e+00            OK
SLAYER enabled flag                 1                                         1                                         0.0e+00            OK
Runtime (s)                         346.1s                                    345.5s                                                       --
========================================================================================================================================================
Summary: 2 changed, 15 unchanged

Regression Report: efit_fixedbdy_separatrix
===============================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
-------------------------------------------------------------------------------------------------------------------------------
Quantity                    0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff     Status
-------------------------------------------------------------------------------------------------------------------------------
psio (total poloidal flux)  3.344390e-01                              3.344390e-01                              0.0e+00  OK
q0                          1.155201e+00                              1.155201e+00                              0.0e+00  OK
q95                         5.741022e+00                              5.741022e+00                              0.0e+00  OK
beta_t                      3.945163e-05                              3.945163e-05                              0.0e+00  OK
beta_n                      1.009502e-01                              1.009502e-01                              0.0e+00  OK
Runtime (s)                 55.8s                                     55.3s                                              --
===============================================================================================================================
Summary: 5 unchanged

Regression Report: gal_resistive_diiid
============================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
----------------------------------------------------------------------------------------------------------------------------
Quantity                 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff     Status
----------------------------------------------------------------------------------------------------------------------------
gal # singular surfaces  4                                         4                                         0.0e+00  OK
gal singular q values    [4 elem]                                  [4 elem]                                  0.0e+00  OK
gal PEST3 Δ diagonal     [4 elem]                                  [4 elem]                                  0.0e+00  OK
||gal Δ′ matrix||        1.243925e+04                              1.243925e+04                              0.0e+00  OK
||gal Δ_coil block||     2.502408e+02                              2.502408e+02                              0.0e+00  OK
gal D_I per surface      [4 elem]                                  [4 elem]                                  0.0e+00  OK
gal α per surface        [4 elem]                                  [4 elem]                                  0.0e+00  OK
||gal inner-layer Δ||    1.474563e+06                              1.474563e+06                              0.0e+00  OK
||gal match cout||       3.082280e-02                              3.082280e-02                              0.0e+00  OK
gal match residual       1.626206e-16                              1.626206e-16                              0.0e+00  OK
Runtime (s)              276.1s                                    275.3s                                             --
============================================================================================================================
Summary: 10 unchanged

Regression Report: gal_resistive_pe
========================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
------------------------------------------------------------------------------------------------------------------------
Quantity                0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff  Status
------------------------------------------------------------------------------------------------------------------------
rational q values       N/A                                       N/A                                       N/A   N/A
island half-widths      N/A                                       N/A                                       N/A   N/A
Chirikov parameter      N/A                                       N/A                                       N/A   N/A
||resonant b field||    N/A                                       N/A                                       N/A   N/A
resonant b field (all)  N/A                                       N/A                                       N/A   N/A
penetrated b field      N/A                                       N/A                                       N/A   N/A
PE Δ' per surface       N/A                                       N/A                                       N/A   N/A
||C resonant b field||  N/A                                       N/A                                       N/A   N/A
Runtime (s)             287.9s                                    305.4s                                          --
========================================================================================================================
Summary: 8 missing/N/A

Regression Report: ggj_ray_q500i
================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
----------------------------------------------------------------------------------------------------------------
Quantity     0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff     Status
----------------------------------------------------------------------------------------------------------------
Re(Δ_odd)    2.472008e+00                              2.472008e+00                              0.0e+00  OK
Im(Δ_odd)    1.335402e+01                              1.335402e+01                              0.0e+00  OK
Re(Δ_even)   1.374966e-01                              1.374966e-01                              0.0e+00  OK
Im(Δ_even)   7.427542e-01                              7.427542e-01                              0.0e+00  OK
Runtime (s)  23.9s                                     25.1s                                              --
================================================================================================================
Summary: 4 unchanged

Regression Report: ggj_reference
================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
----------------------------------------------------------------------------------------------------------------
Quantity     0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff     Status
----------------------------------------------------------------------------------------------------------------
Re(Δ_odd)    -1.901546e-01                             -1.901546e-01                             0.0e+00  OK
Im(Δ_odd)    -4.159703e-01                             -4.159703e-01                             0.0e+00  OK
Re(Δ_even)   -3.892005e-01                             -3.892005e-01                             0.0e+00  OK
Im(Δ_even)   -3.606754e-01                             -3.606754e-01                             0.0e+00  OK
Runtime (s)  12.0s                                     11.7s                                              --
================================================================================================================
Summary: 4 unchanged

Regression Report: solovev_kinetic_calculated
==============================================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
----------------------------------------------------------------------------------------------------------------------------------------------
Quantity                  0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff               Status
----------------------------------------------------------------------------------------------------------------------------------------------
vacuum energy Re(ev[1])   1.042094e+01                              1.042019e+01                              7.547e-04 (0.01%)  ** CHANGED **
q0                        1.900003e+00                              1.900003e+00                              0.0e+00            OK
||xi_clebsch_alpha||      4.994799e-04                              4.982106e-04                              1.269e-06 (0.25%)  ** CHANGED **
total energy Re(et[1])    1.891118e+00                              1.891079e+00                              3.870e-05 (0.00%)  ** CHANGED **
total energy Im(et[1])    -1.449537e+00                             -1.449604e+00                             6.729e-05 (0.00%)  ** CHANGED **
plasma energy Re(ep[1])   -8.529822e+00                             -8.529106e+00                             7.160e-04 (0.01%)  ** CHANGED **
ODE steps (saved)         583                                       583                                       0.0e+00            OK
# singular surfaces       2                                         2                                         0.0e+00            OK
singular psi locations    [2 elem]                                  [2 elem]                                  0.0e+00            OK
total energy (all)        [32 elem]                                 [32 elem]                                 1.117e-01 (0.00%)  ** CHANGED **
ODE steps (total)         583                                       583                                       0.0e+00            OK
mpert                     32                                        32                                        0.0e+00            OK
q95                       3.147422e+00                              3.147422e+00                              0.0e+00            OK
||Jb_theta_reg||          2.242698e-04                              2.236613e-04                              6.085e-07 (0.27%)  ** CHANGED **
Runtime (s)               363.3s                                    376.6s                                                       --
||dxi_clebsch_psi/dpsi||  3.201272e-03                              3.193184e-03                              8.089e-06 (0.25%)  ** CHANGED **
singular q values         [2 elem]                                  [2 elem]                                  0.0e+00            OK
npert                     1                                         1                                         0.0e+00            OK
==============================================================================================================================================
Summary: 8 changed, 9 unchanged

Regression Report: solovev_kinetic_multiion
=================================================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
-------------------------------------------------------------------------------------------------------------------------------------------------
Quantity                     0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff               Status
-------------------------------------------------------------------------------------------------------------------------------------------------
NTV total (D+T+imp+e) [N·m]  1.573575e-04                              1.585505e-04                              1.193e-06 (0.76%)  ** CHANGED **
NTV Deuterium [N·m]          9.514767e-05                              9.585817e-05                              7.105e-07 (0.75%)  ** CHANGED **
NTV Tritium [N·m]            9.919140e-05                              9.993322e-05                              7.418e-07 (0.75%)  ** CHANGED **
NTV electron [N·m]           -3.698157e-05                             -3.724088e-05                             2.593e-07 (0.70%)  ** CHANGED **
total energy Re(et[1])       5.959994e-01                              5.939380e-01                              2.061e-03 (0.35%)  ** CHANGED **
# singular surfaces          2                                         2                                         0.0e+00            OK
Runtime (s)                  477.9s                                    480.0s                                                       --
=================================================================================================================================================
Summary: 5 changed, 1 unchanged

Regression Report: solovev_kinetic_ntv
===============================================================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Quantity                                   0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff               Status
---------------------------------------------------------------------------------------------------------------------------------------------------------------
NTV torque fgar [Re, Im]                   [1 elem]                                  [1 elem]                                  1.421e-06 (0.75%)  ** CHANGED **
NTV ψ quadrature evaluations               750                                       750                                       0.0e+00            OK
root-area-weighted total energy Re(et[1])  5.959994e-01                              5.939380e-01                              2.061e-03 (0.35%)  ** CHANGED **
# singular surfaces                        2                                         2                                         0.0e+00            OK
singular psi locations                     [2 elem]                                  [2 elem]                                  0.0e+00            OK
q0                                         1.900006e+00                              1.900006e+00                              0.0e+00            OK
Runtime (s)                                388.9s                                    386.8s                                                       --
===============================================================================================================================================================
Summary: 2 changed, 4 unchanged

Regression Report: solovev_kinetic_nuzero
=============================================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
---------------------------------------------------------------------------------------------------------------------------------------------
Quantity                 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff               Status
---------------------------------------------------------------------------------------------------------------------------------------------
vacuum energy Re(ev[1])  1.071506e+01                              1.071418e+01                              8.868e-04 (0.01%)  ** CHANGED **
q0                       1.900003e+00                              1.900003e+00                              0.0e+00            OK
total energy Re(et[1])   2.180964e+00                              2.180865e+00                              9.939e-05 (0.00%)  ** CHANGED **
total energy Im(et[1])   -2.207298e+00                             -2.207603e+00                             3.055e-04 (0.01%)  ** CHANGED **
plasma energy Re(ep[1])  -8.534099e+00                             -8.533312e+00                             7.874e-04 (0.01%)  ** CHANGED **
ODE steps (saved)        593                                       593                                       0.0e+00            OK
# singular surfaces      2                                         2                                         0.0e+00            OK
singular psi locations   [2 elem]                                  [2 elem]                                  0.0e+00            OK
total energy (all)       [32 elem]                                 [32 elem]                                 1.075e-01 (0.00%)  ** CHANGED **
ODE steps (total)        593                                       593                                       0.0e+00            OK
mpert                    32                                        32                                        0.0e+00            OK
q95                      3.147422e+00                              3.147422e+00                              0.0e+00            OK
Runtime (s)              464.8s                                    453.3s                                                       --
singular q values        [2 elem]                                  [2 elem]                                  0.0e+00            OK
npert                    1                                         1                                         0.0e+00            OK
=============================================================================================================================================
Summary: 5 changed, 9 unchanged

Regression Report: solovev_multi_n
==================================================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 2 threads/2 BLAS
--------------------------------------------------------------------------------------------------------------------------------------------------
Quantity                      0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff               Status
--------------------------------------------------------------------------------------------------------------------------------------------------
total energy Re(et[1])        -1.889133e+00                             -1.890112e+00                             9.784e-04 (0.05%)  ** CHANGED **
total energy Im(et[1])        -3.367005e-05                             -3.377571e-05                             1.057e-07 (0.31%)  ** CHANGED **
vacuum matrix min eigenvalue  1.731130e+00                              1.731130e+00                              2.900e-10 (0.00%)  ** CHANGED **
plasma energy (all)           [70 elem]                                 [70 elem]                                 1.870e+01 (0.30%)  ** CHANGED **
vacuum energy (all)           [70 elem]                                 [70 elem]                                 1.344e+01 (0.10%)  ** CHANGED **
total energy (all)            [70 elem]                                 [70 elem]                                 7.601e+00 (0.04%)  ** CHANGED **
ODE steps (saved)             99                                        99                                        0.0e+00            OK
ODE steps (total)             1293                                      1293                                      0.0e+00            OK
q0                            1.900006e+00                              1.900006e+00                              0.0e+00            OK
q95                           3.147422e+00                              3.147422e+00                              0.0e+00            OK
# singular surfaces           3                                         3                                         0.0e+00            OK
singular psi locations        [3 elem]                                  [3 elem]                                  0.0e+00            OK
mpert                         35                                        35                                        0.0e+00            OK
npert                         2                                         2                                         0.0e+00            OK
q profile (checksum)          af93c6269245...                           af93c6269245...                           identical          OK
Runtime (s)                   291.0s                                    287.3s                                                       --
==================================================================================================================================================
Summary: 6 changed, 9 unchanged

Regression Report: solovev_n1
==================================================================================================================================================
Ref 1: 6fc89d021a18f7a57aa711fdfb9a6ce0364aefd9  @ 6fc89d021 (2026-10-09)
       env: julia 1.12.7, x86_64-linux-gnu, manifest aa94b997 (pinned), 4 threads/4 BLAS, jit build
Ref 2: 94cdf5f397c350c4ccc66d11f495f5b1ffd0b40e  @ 94cdf5f39 (2026-10-09)
       env: julia 1.12.7, x86_64-linux-gnu, manifest aa94b997 (pinned), 4 threads/4 BLAS, jit build
--------------------------------------------------------------------------------------------------------------------------------------------------
Quantity                      6fc89d021a18f7a57aa711fdfb9a6ce0364aefd9  94cdf5f397c350c4ccc66d11f495f5b1ffd0b40e  Diff               Status
--------------------------------------------------------------------------------------------------------------------------------------------------
total energy Re(et[1])        5.133650e-01                              5.118373e-01                              1.528e-03 (0.30%)  ** CHANGED **
total energy Im(et[1])        -2.227759e-05                             -2.243850e-05                             1.609e-07 (0.72%)  ** CHANGED **
plasma energy Re(ep[1])       -9.892282e+00                             -9.893366e+00                             1.085e-03 (0.01%)  ** CHANGED **
vacuum energy Re(ev[1])       1.040565e+01                              1.040520e+01                              4.428e-04 (0.00%)  ** CHANGED **
vacuum matrix min eigenvalue  2.171454e+00                              2.171454e+00                              9.364e-10 (0.00%)  ** CHANGED **
plasma energy (all)           [32 elem]                                 [32 elem]                                 8.703e+00 (0.17%)  ** CHANGED **
vacuum energy (all)           [32 elem]                                 [32 elem]                                 7.507e+00 (0.07%)  ** CHANGED **
total energy (all)            [32 elem]                                 [32 elem]                                 3.859e+00 (0.02%)  ** CHANGED **
ODE steps (saved)             408                                       408                                       0.0e+00            OK
ODE steps (total)             406                                       406                                       0.0e+00            OK
q0                            1.900006e+00                              1.900006e+00                              0.0e+00            OK
q95                           3.147422e+00                              3.147422e+00                              0.0e+00            OK
beta_t                        4.620755e-02                              4.620755e-02                              0.0e+00            OK
beta_n                        3.215680e+00                              3.215680e+00                              0.0e+00            OK
# singular surfaces           2                                         2                                         0.0e+00            OK
singular psi locations        [2 elem]                                  [2 elem]                                  0.0e+00            OK
singular q values             [2 elem]                                  [2 elem]                                  0.0e+00            OK
mpert                         32                                        32                                        0.0e+00            OK
npert                         1                                         1                                         0.0e+00            OK
q profile (checksum)          69f933d7833d...                           69f933d7833d...                           identical          OK
pressure profile (checksum)   90041e1392b3...                           90041e1392b3...                           identical          OK
ca_left (checksum)            fbfab2579e06...                           fbfab2579e06...                           identical          OK
Runtime (s)                   355.4s                                    351.8s                                                       --
==================================================================================================================================================
Summary: 8 changed, 14 unchanged

Regression Report: diiid_error_field
=====================================================================================================================================================================
Ref 1: 0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  @ 0e68a0553 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 8 threads/8 BLAS
Ref 2: 60af2dda5b9d599b33ab5c1237ac392c65d24053  @ 60af2dda5 (2026-10-05)
       env: julia 1.12.7, x86_64-linux-gnu, manifest 354f28f6 (pinned), 8 threads/8 BLAS
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Quantity                                         0e68a0553d61b4bc9bc81cdaf24a8cee41dd3621  60af2dda5b9d599b33ab5c1237ac392c65d24053  Diff               Status
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
EFC overlap per kAt                              [1 elem]                                  [1 elem]                                  9.178e-08 (0.52%)  ** CHANGED **
EFC whole-field NTV torque per kAt² [N·m]        [1 elem]                                  [1 elem]                                  1.100e-03 (3.32%)  ** CHANGED **
EFC residual-field NTV torque per kAt² [N·m]     [1 elem]                                  [1 elem]                                  2.178e-04 (8.73%)  ** CHANGED **
EFC reference rotation ω_ref [rad/s]             [1 elem]                                  [1 elem]                                  0.0e+00            OK
EFC rotation-scan shifts [rad/s]                 [9 elem]                                  [9 elem]                                  0.0e+00            OK
EFC residual torque against rotation [N·m/kAt²]  [9 elem]                                  [9 elem]                                  6.920e-04 (9.72%)  ** CHANGED **
dominant-coupling singular values                [3 elem]                                  [3 elem]                                  1.526e-02 (0.69%)  ** CHANGED **
|delta_nominal| of coil set 1                    1.411016e-06                              1.403674e-06                              7.343e-09 (0.52%)  ** CHANGED **
Runtime (s)                                      866.8s                                    857.0s                                                       --
=====================================================================================================================================================================
Summary: 6 changed, 2 unchanged

Notes for reviewers

Review page (figures, evidence, derivations): https://claude.ai/artifact/QArXT5chN3CVwujaUUQrbW

The bug. The Vacuum (VAC) module reversed the plasma contour into VACUUM's clockwise θ. Reversing θ (with ζ) complex-conjugates every harmonic, so the vacuum operators came back in the conjugate frame. Only I_v was conjugated back; wv was not. Separately, the ForceFreeStates (FFS) norm N copied Fortran's jmat(jpert−ipert), which is the transpose of ∮J|ξ|² and puts N in the same wrong frame relative to L. Under a θ-origin shift by a, wp, L and I_v transform as D·A·D† while wv and N transformed as D†·A·D (D = diag(e^{ima})), so wp + wv was not a congruence of itself and the eigenvalues moved.

How we know it is a bug. On an up-down asymmetric case δW is 0.1995 / 0.2176 / 0.3593 at origins 0, 1/16, 1/4 turn (JPEC and Fortran DCON alike); an up-down symmetric D shape rolled by a quarter turn gives 0.4291 instead of 0.2613. Moving θ = 0 is a relabeling, so neither may happen.

The fix. VAC now runs in GPEC's counter-clockwise θ with no reversal and no frame conversion:

  • the 2D Fourier basis takes each point's ζ; the 2D contour sits on ϕ = 0 where ζ = −ν (GPEC: ϕ = 2πζ + ν, rzphi_nu); revolved 3D points sit at ϕ = ζ + ν
  • the kernel's normal flip moves from plasma to wall sources (the normal comes from the direction of travel); analytic and conformal walls follow the new direction
  • conj!(I_v) is removed (2D), and the 3D partner conjugation keeps only the pairing part
  • clockwise plasma contours (2D, and the ζ = 0 slice of 3D) throw; clockwise wall files are reversed with a warning
  • FFS: N[m, m′] = J_{m−m′}, the ∮J|ξ|² form (Fortran free.f has the transpose too)

How we know it works. δW = 0.1986531 at every origin (PEST), 0.1986784 (Hamada); the rolled symmetric case returns 0.2613307; all nine matrices fit D·A·D† after the fix. The Fortran counterpart is PrincetonUniversity/GPEC#295: it keeps VACUUM's reversed θ and conjugates wv afterwards, and transposes the norm. It is origin-independent too and agrees with this PR to the codes' existing 0.4 % offset. New tests pin the frame (θ-origin shift), the ν sign (2D vs 3D with ν ≠ 0), clockwise inputs, and N as the ∮J|ξ|² quadratic form; each fails on the old code. Fourier 35/35, vacuum 393/393, coordinate-invariance 27/27.

Not covered. n < 0, the edge-scan path, and the frame of the coil forcing Φx that multiplies P. Nothing pins the conformal wall staying outside the plasma.

Before this leaves draft. Name an assignee and reviewers.

…n the plasma's Fourier frame

The Vacuum module reversed the plasma contour into VACUUM's clockwise θ, which puts every harmonic in the
complex-conjugate frame. Only I_v was conjugated back, so wv (and the ForceFreeStates norm matrix N) sat in
the opposite frame to wp and L, and δW, Λ and P depended on the θ origin of up-down asymmetric equilibria.

- Vacuum: run natively in GPEC's counter-clockwise θ; the 2D basis takes each point's ζ (= -ν on ϕ = 0);
  revolved 3D points sit at ϕ = ζ + ν; kernel normal flip moves to wall sources; analytic and conformal
  walls follow the new direction; clockwise plasma contours (2D or 3D) are rejected and clockwise wall
  files reversed with a warning; the I_v conjugation is removed.
- ForceFreeStates: N[m, m'] = J_{m-m'} as in Fortran free.f (was its transpose).
- Tests: θ-origin shift, clockwise inputs, 2D/3D agreement for nonzero ν, N as the ∮J|ξ|² quadratic form.
@github-actions github-actions Bot added bugfix Something was wrong and now is not changed-results Results move or an interface breaks - read before upgrading labels Oct 5, 2026
@jhalpern30 jhalpern30 self-assigned this Oct 5, 2026
@jhalpern30

Copy link
Copy Markdown
Collaborator Author

Up-down symmetric control: the fix leaves it unchanged

examples/LAR_ideal_match_test (TJ-analytic large-aspect-ratio equilibrium, Hamada) is up-down symmetric about θ = 0 to solver tolerance: on the boundary, max |R(θ) − R(−θ)| = 1.3e‑10 m, |Z(θ) + Z(−θ)| = 1.5e‑10 m, |ν(θ) + ν(−θ)| = 1.1e‑8 (minor radius 0.4 m). For such a boundary every vacuum harmonic is real, so the conjugate frame on develop is invisible and the fix should change nothing.

Run on Feynman with the forward integrator (the deck's Galerkin integrator skips the free-boundary stage), n = 1, develop 0e68a0553 vs this PR 60af2dda5:

least-stable δW, develop this PR relative change
no wall 1.1669506859 1.1669497386 8e‑7
conformal wall, a = 0.3 1.4379816439 1.4379803766 9e‑7
  • W_plasma is bit-identical. W_freeboundary differs by 2e‑14 (no wall) and 7e‑13 (wall).
  • develop's W_vacuum equals conj(W_vacuum) from this PR to 3e‑11 (no wall) and 1.6e‑10 relative (wall). That is the predicted relation between the two frames; the PR's W_vacuum has a residual imaginary part of 1e‑9 relative, from the 1e‑10 residual asymmetry, so the conjugation moves it by 2e‑9 and δW by ~1e‑6 absolute (‖ΔW_v‖₂ = 2.4e‑6).
  • The edge Jacobian is constant to 4e‑16 (Hamada), so N is diagonal and the N transpose changes nothing here.
  • Every other dataset in gpec.h5 agrees to ≤ 2e‑5 (eigenvector components), except SurfaceGeometries/*/z, which is now stored in counter-clockwise order (z(−θ) = −z(θ), same points).

For contrast, the Solov'ev harness cases moved up to 0.35 % because that example's traced boundary is up-down asymmetric by 2.6 mm at its etol = 1e-7.

Reproduce: examples/LAR_ideal_match_test with ForceFreeStates.integrator = "forward" (and Wall.shape = "nowall" or Wall.a = 0.3) on each ref; Feynman runs 2026-10-05_pr503_larfb_{develop,pr}.

@jhalpern30
jhalpern30 marked this pull request as ready for review October 5, 2026 19:34
@jhalpern30
jhalpern30 requested a review from logan-nc October 5, 2026 19:35
@jhalpern30

Copy link
Copy Markdown
Collaborator Author

@logan-nc this is the Fortran + Julia bugfix I mentioned. I wanted your review on this because I see the best way forward to avoid confusion in the future to be finally making VACUUM use the same CCW theta convention as DCON/GPEC, which is what this PR does (I plan to do something that's a bit easier in the Fortran). I remember, however, that when I mentioned this at one point, you flagged that it might mess with something upstream - potentially how DCON chooses the helicity to make the resonant mode positive (I might be remembering completely incorrectly)?

But I haven't been able to reproduce any issue and every test I can throw at it seems numerically sound. Let me know if anything comes to mind that I haven't thought of

@matt-pharr

Copy link
Copy Markdown
Collaborator

@jhalpern30 just a shot in the dark but have you tried running with non-hamada coordinate systems and seeing if that affects anything?

@jhalpern30

Copy link
Copy Markdown
Collaborator Author

@jhalpern30 just a shot in the dark but have you tried running with non-hamada coordinate systems and seeing if that affects anything?

Yep, this fix is for a general coordinate system

image

@logan-nc

logan-nc commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

@claude review this pr

@claude

claude Bot commented Oct 9, 2026

Copy link
Copy Markdown

Review

MERGE GATE: THIS PR MUST NOT BE MERGED WITHOUT APPROVAL FROM A HUMAN REVIEWER. THIS IS REQUIRED AND NON-NEGOTIABLE.

A reviewer (logan-nc) and an assignee are set, which is good. This change moves δW, Λ, P, Δ′ and NTV, so it needs a physics reviewer. A review by a bot does not satisfy this requirement.

Removing the VACUUM clockwise-θ frame makes the vacuum and plasma matrices share one Fourier frame. The removed pieces are the input reverse, the conj! of I_v, and the sign flips in the kernel normal and wall shapes. The power_norm_matrix! fix gives N[m,m'] = J_{m-m'}, and the new quadratic-form test checks it directly. The regression table and release-note block are present, with a commit hash.

Code quality / possible issues

  • assert_counterclockwise uses signed_area(...) > 0. A zero-area or degenerate contour would report "runs clockwise", which is misleading. Give it a separate message, or test < 0 for the clockwise case.
  • The 3D check in PlasmaGeometry3D tests only the ζ = 0 column, as the migration note says. Add a one-line comment that other cross-sections are unchecked.
  • FourierTransform(...; ν=) becomes ζ= with no deprecation. Old callers get a MethodError, which is safe. I found no other callers in the develop checkout. Check examples/, benchmarks/ and notebooks on the PR branch.
  • The DataTypes.jl docstring has one line of about 170 characters, while the rest of the block wraps near 120. Re-wrap it.
  • conventions.md now has ζ = (φ − ν)/(2π) (turns) next to Vacuum's ζ in radians. Say explicitly where each unit applies.

Tests

  • Coverage is good: the θ-origin-shift test, the nonzero-ν 2D/3D agreement, clockwise rejection, the clockwise wall file, and the power_norm_matrix! test.
  • There is no test for 3D clockwise rejection (nzeta_in > 1). Add a small @test_throws.
  • There is no end-to-end test that δW is invariant under a θ-origin shift of an up-down asymmetric equilibrium. This is the user-visible bug, and only the vacuum-level operators are tested. Add one at the ForceFreeStates level, or as a harness case.
  • The conjugate-frame margin > 5e-2 is looser than the others. Confirm it is not marginal for I_v.

Regression harness

  • Results are reported at 60af2dda5. Rerun if more commits land, and confirm the report matches the final head.
  • gal_resistive_pe extracts nothing on either ref, so this PR leaves it unvalidated. Consider a follow-up to fix that case.
  • Some moves are 5–10 % (EFC residual torque, PE energies). A reviewer should check them against the frame fix. Fortran DCON has the same defect, so results will no longer match Fortran for asymmetric equilibria. Document that explicitly.

🤖 Generated with Claude Code

@logan-nc logan-nc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jhalpern30. I definitely agree with the strategy of removing this tripwire to make the src self consistent throughout.

Should we take it all the way and use turns instead of radians?

Comment thread docs/src/conventions.md Outdated
Comment thread src/Utilities/FourierTransforms.jl
@logan-nc

logan-nc commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

@jhalpern30 none of the claude points look particularly good/important to me. I will approve after you confirm/deny my suggestions above.

Co-authored-by: Nikolas Logan <nikolas.logan@columbia.edu>
@jhalpern30

Copy link
Copy Markdown
Collaborator Author

Should we take it all the way and use turns instead of radians?

Oooooh this could be a very satisfying fix so I am tempted. I will sketch out what it would look like today, but I don't think it would be too difficult. Could be nice to make everything officially use the same angle convention for the first time ever and remove some of the difficult unit-tracking that has taken me months to pin down

@jhalpern30

Copy link
Copy Markdown
Collaborator Author

From Claude: TL;DR - going to wait on the radians to turns convention change

What it would involve.

Vacuum isn't the only place using radians. The FourierTransform / compute_fourier_coefficients utilities also use a radian θ grid and radian ζ. So does the Fourfit metric (metric.ys .= rzphi_ys .* 2π, plus the 2π endpoint check in FourierCoefficients). And rzphi_nu is in radians while rzphi_offset is in turns. Making the repo consistent has three levels:

  • Vacuum, the Fourier utilities and Fourfit/FourierCoefficients move to turns. This means rewriting the Vacuum grids and splines (dθ, periodic splines), the 3D field-period and dθdζ handling, and the 4π²/(2π)² prefactors in wv, I_v and L = μ₀(2π)² I_v⁻¹.
  • rzphi_nu and Vacuum's ν move to turns. This touches about a dozen files across Equilibrium, FFS, Ballooning, ForcingTerms and Analysis, and changes Equilibrium/Geometry/nu in gpec.h5.
  • Radians everywhere. I don't think we should do this. It would strip the 2π out of Fourfit and the ODE coefficients and break Fortran traceability.

Why not in this PR.

This PR is a BUGFIX! that moves results (δW, Λ, P, Δ′, NTV by 0.5–6 %). The unit change should move nothing, and it's much easier to review as "regression harness shows 0 changed vs the merged head". Mixed into this PR, that check is lost.

To get the goal of "standardized use of angle convention repo-wide" would be much wider than just a vacuum change, so not worth it for this PR.

…a-frame

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	test/runtests_vacuum.jl
@jhalpern30

Copy link
Copy Markdown
Collaborator Author

@logan-nc this is all set for your final approval

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Something was wrong and now is not changed-results Results move or an interface breaks - read before upgrading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants