Skip to content

Analysis - BUGFIX - Read Jb_theta and Jb_zeta and smoke-test the gpec.h5 plots - #573

Merged
matt-pharr merged 1 commit into
developfrom
bugfix/analysis-h5-readers
Oct 26, 2026
Merged

matt-pharr merged 1 commit into
developfrom
bugfix/analysis-h5-readers

Conversation

@matt-pharr

@matt-pharr matt-pharr commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Release note

  • Audience: users
  • Numerical impact: none (harness @ ecd0160)
  • Migration: the plot_mode_spectrogram components :b_theta and :b_zeta are now :Jb_theta and :Jb_zeta, named after the Jb_theta/Jb_zeta datasets they plot; the old names raise the invalid-component error.

The mode spectrogram now draws the Jacobian-weighted poloidal and toroidal field components instead of always showing "No response data", and plot_cond_fbar no longer throws a KeyError on every run. Both read dataset names the writers had stopped producing. A new smoke test draws every gpec.h5 plot from real writer output, so a renamed dataset now fails the tests.

Regression report

================================================================
Case: diiid_n1 — DIII-D-like equilibrium, n=1, ideal + perturbed equilibrium
================================================================

Regression Report: diiid_n1
============================================================================================================================
Ref 1: feature/local-stability-problem  @ 59b4b4de9 (2026-10-23)
       env: julia 1.12.6, x86_64-linux-gnu, manifest aa94b997 (pinned), 2 threads/1 BLAS, jit build
Ref 2: bugfix/analysis-h5-readers  @ bc9e1341d (2026-10-23)
       env: julia 1.12.6, x86_64-linux-gnu, manifest aa94b997 (pinned), 2 threads/1 BLAS, jit build
----------------------------------------------------------------------------------------------------------------------------
Quantity                                      feature/local-stability-problem  bugfix/analysis-h5-readers  Diff       Status
----------------------------------------------------------------------------------------------------------------------------
total energy Re(et[1])                        8.006123e-01                     8.006123e-01                0.0e+00    OK    
total energy Im(et[1])                        7.924925e-05                     7.924925e-05                0.0e+00    OK    
plasma energy Re(ep[1])                       -1.372261e+00                    -1.372261e+00               0.0e+00    OK    
vacuum energy Re(ev[1])                       2.172874e+00                     2.172874e+00                0.0e+00    OK    
vacuum matrix min eigenvalue                  1.873975e-01                     1.873975e-01                0.0e+00    OK    
plasma energy (all)                           [35 elem]                        [35 elem]                   0.0e+00    OK    
vacuum energy (all)                           [35 elem]                        [35 elem]                   0.0e+00    OK    
total energy (all)                            [35 elem]                        [35 elem]                   0.0e+00    OK    
ODE steps (saved)                             800                              800                         0.0e+00    OK    
ODE steps (total)                             795                              795                         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.372511e+00                     1.372511e+00                0.0e+00    OK    
internal inductance li1                       8.842269e-01                     8.842269e-01                0.0e+00    OK    
internal inductance li2                       7.080757e-01                     7.080757e-01                0.0e+00    OK    
internal inductance li3                       7.304340e-01                     7.304340e-01                0.0e+00    OK    
poloidal beta betap1                          6.680739e-01                     6.680739e-01                0.0e+00    OK    
poloidal beta betap2                          5.349836e-01                     5.349836e-01                0.0e+00    OK    
poloidal beta betap3                          5.518764e-01                     5.518764e-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.236480e-01                     4.236480e-01                0.0e+00    OK    
plasma volume                                 1.829472e+01                     1.829472e+01                0.0e+00    OK    
plasma current                                1.152130e+00                     1.152130e+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.880145e-01                     3.880145e-01                0.0e+00    OK    
aspect ratio                                  2.845746e+00                     2.845746e+00                0.0e+00    OK    
elongation kappa                              1.708322e+00                     1.708322e+00                0.0e+00    OK    
q profile (checksum)                          ea980cf7e8cf...                  ea980cf7e8cf...             identical  OK    
pressure profile (checksum)                   75be5949b7c1...                  75be5949b7c1...             identical  OK    
Mercier D_I profile (checksum)                cafa40526b39...                  cafa40526b39...             identical  OK    
resistive interchange D_R profile (checksum)  c70e46071c9d...                  c70e46071c9d...             identical  OK    
ballooning Delta' profile (checksum)          029149d57e8c...                  029149d57e8c...             identical  OK    
island half-widths                            [5 elem]                         [5 elem]                    0.0e+00    OK    
Chirikov parameter                            [5 elem]                         [5 elem]                    0.0e+00    OK    
||resonant area-weighted field||              5.288864e-04                     5.288864e-04                0.0e+00    OK    
dominant-coupling singular values             [3 elem]                         [3 elem]                    0.0e+00    OK    
|forcing overlap with dominant mode|          1.411634e-04                     1.411634e-04                0.0e+00    OK    
|delta_nominal| of coil set 1                 7.035049e-05                     7.035049e-05                0.0e+00    OK    
||ddelta/d(shift)|| over coil sets            1.245519e-04                     1.245519e-04                0.0e+00    OK    
||ddelta/d(tilt)|| over coil sets             4.176407e-07                     4.176407e-07                0.0e+00    OK    
PE plasma energy                              3.320677e+00                     3.320677e+00                0.0e+00    OK    
PE vacuum energy                              3.174510e+00                     3.174510e+00                0.0e+00    OK    
PE surface energy                             5.509017e+00                     5.509017e+00                0.0e+00    OK    
PE toroidal torque                            1.119454e-04                     1.119454e-04                0.0e+00    OK    
NTV torque FGAR [N·m]                         5.483495e-01                     5.483495e-01                0.0e+00    OK    
NTV kinetic energy dW FGAR [J]                8.163740e-02                     8.163740e-02                0.0e+00    OK    
Runtime (s)                                   359.9s                           361.0s                                 --    
||forcing b~|| (root-area-weighted)           4.683330e-04                     4.683330e-04                0.0e+00    OK    
resonant area-weighted field b^r              [5 elem]                         [5 elem]                    0.0e+00    OK    
============================================================================================================================
Summary: 53 unchanged


================================================================
Case: solovev_n1 — Solovev analytical equilibrium, n=1, ideal stability
================================================================

Regression Report: solovev_n1
============================================================================================================
Ref 1: feature/local-stability-problem  @ 59b4b4de9 (2026-10-23)
       env: julia 1.12.6, x86_64-linux-gnu, manifest aa94b997 (pinned), 2 threads/1 BLAS, jit build
Ref 2: bugfix/analysis-h5-readers  @ bc9e1341d (2026-10-23)
       env: julia 1.12.6, x86_64-linux-gnu, manifest aa94b997 (pinned), 2 threads/1 BLAS, jit build
------------------------------------------------------------------------------------------------------------
Quantity                      feature/local-stability-problem  bugfix/analysis-h5-readers  Diff       Status
------------------------------------------------------------------------------------------------------------
total energy Re(et[1])        1.090560e-02                     1.090560e-02                0.0e+00    OK    
total energy Im(et[1])        2.141340e-10                     2.141340e-10                0.0e+00    OK    
plasma energy Re(ep[1])       -1.041640e+01                    -1.041640e+01               0.0e+00    OK    
vacuum energy Re(ev[1])       1.042730e+01                     1.042730e+01                0.0e+00    OK    
vacuum matrix min eigenvalue  2.170703e+00                     2.170703e+00                0.0e+00    OK    
plasma energy (all)           [32 elem]                        [32 elem]                   0.0e+00    OK    
vacuum energy (all)           [32 elem]                        [32 elem]                   0.0e+00    OK    
total energy (all)            [32 elem]                        [32 elem]                   0.0e+00    OK    
ODE steps (saved)             287                              287                         0.0e+00    OK    
ODE steps (total)             285                              285                         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.621027e-02                     4.621027e-02                0.0e+00    OK    
beta_n                        3.217775e+00                     3.217775e+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)          af93c6269245...                  af93c6269245...             identical  OK    
pressure profile (checksum)   e252b3b40ede...                  e252b3b40ede...             identical  OK    
ca_left (checksum)            06afdeb86cdc...                  06afdeb86cdc...             identical  OK    
Runtime (s)                   242.0s                           244.4s                                 --    
============================================================================================================
Summary: 22 unchanged


================================================================
Case: solovev_kinetic_calculated — Solovev, n=1, kinetic_source=calculated, kinetic_factor=1.0, 50/50 D-T multi-ion kinetic matrices, mode-converged band (delta_m=8, mpert=32); pressure-consistent kinetic.dat (n·T tied to the Solovev P₀≈4.27e4 Pa).
================================================================

Regression Report: solovev_kinetic_calculated
======================================================================================================
Ref 1: feature/local-stability-problem  @ 59b4b4de9 (2026-10-23)
       env: julia 1.12.6, x86_64-linux-gnu, manifest aa94b997 (pinned), 2 threads/1 BLAS, jit build
Ref 2: bugfix/analysis-h5-readers  @ bc9e1341d (2026-10-23)
       env: julia 1.12.6, x86_64-linux-gnu, manifest aa94b997 (pinned), 2 threads/1 BLAS, jit build
------------------------------------------------------------------------------------------------------
Quantity                  feature/local-stability-problem  bugfix/analysis-h5-readers  Diff     Status
------------------------------------------------------------------------------------------------------
vacuum energy Re(ev[1])   1.054785e+01                     1.054785e+01                0.0e+00  OK    
q0                        1.900003e+00                     1.900003e+00                0.0e+00  OK    
||xi_clebsch_alpha||      7.717981e-03                     7.717981e-03                0.0e+00  OK    
total energy Re(et[1])    1.827879e+00                     1.827879e+00                0.0e+00  OK    
total energy Im(et[1])    -1.326825e+00                    -1.326825e+00               0.0e+00  OK    
plasma energy Re(ep[1])   -8.719975e+00                    -8.719975e+00               0.0e+00  OK    
ODE steps (saved)         608                              608                         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]                   0.0e+00  OK    
ODE steps (total)         607                              607                         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||          8.170337e-05                     8.170337e-05                0.0e+00  OK    
Runtime (s)               290.1s                           292.9s                               --    
||dxi_clebsch_psi/dpsi||  4.843513e-02                     4.843513e-02                0.0e+00  OK    
singular q values         [2 elem]                         [2 elem]                    0.0e+00  OK    
npert                     1                                1                           0.0e+00  OK    
======================================================================================================
Summary: 17 unchanged

Notes for reviewers

  • Stacked on LocalStability - API! - Solve a LocalStabilityProblem from its own deck section #568 (feature/local-stability-problem); the base and the regression baseline are that branch. It retargets to develop when LocalStability - API! - Solve a LocalStabilityProblem from its own deck section #568 merges.
  • How the drift was found. I ran a coarse Solovev case with coil forcing and the perturbed-equilibrium response and called every gpec.h5 plot on its output. All 54 literal dataset paths in the Equilibrium, ForceFreeStates and PerturbedEquilibrium plot files exist in that file; the two breaks were in names the readers spell differently from the writers:
    • plot_mode_spectrogram read Response/b_theta and b_zeta, which the writer emits as Jb_theta and Jb_zeta. Its ψ axis now comes from PerturbedEquilibrium/Response/psi, the response's own grid, instead of ForceFreeStates/Solutions/ForwardIntegration/psi (identical on a forward run).
    • plot_cond_fbar read SingularSurfaces/Kinetic/psi, which the writer emits as rational_psi. On an ideal run the Kinetic group exists with empty datasets, so the KeyError fired before the documented return nothing.
  • Tests. test/runtests_analysis_plots.jl runs two coarse fixtures (about 25 s): regression_solovev_ideal_example with one PF hoop and the PE response, where every Equilibrium, ForceFreeStates and PE plot and summary must draw without a "No ..." placeholder, all four spectrogram components draw, and the optional kinetic and GSE plots return nothing; and regression_solovev_kinetic_example, where plot_cond_fbar draws the scan. With the two fixes reverted the file fails five checks.
  • Out of scope:
    • The GSE plots look for gse.h5/gsei.h5 beside gpec.h5, but the Equilibrium writer puts them beside eq_filename (the working directory for analytic equilibria, where eq_filename is empty). Equilibrium - BUGFIX - Write gse.h5 and gsei.h5 when diagnose_src is set #522 is changing that writer, so the fix belongs there or in a follow-up.
    • Missing data is still handled four ways across the plots (throw, nothing, placeholder plot, empty result).
    • Analysis.ErrorFields._load_h5 duplicates the ErrorFields readers (CoilSensitivities(h5path), MonteCarloResult(h5path)).

🤖 Generated with Claude Code

@matt-pharr matt-pharr self-assigned this Oct 23, 2026
@matt-pharr
matt-pharr requested a review from logan-nc October 23, 2026 19:00
@github-actions github-actions Bot added the bugfix Something was wrong and now is not label Oct 23, 2026

@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.

Read in full. Ready to approve from my read once #568 lands and this retargets; nothing to add. Both renames match the writers, the ψ axis change is the response's own grid, and the smoke test is the right shape (real writer output, placeholder detection, the old component names asserted to throw).

@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.

Approving at bc9e134 on the comment review above. Stacked on #568, so it lands after that one.

@matt-pharr
matt-pharr added this pull request to stack #592 October 26, 2026 09:41
@matt-pharr
matt-pharr force-pushed the bugfix/analysis-h5-readers branch from bc9e134 to ecd0160 Compare October 26, 2026 10:08

@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.

Re-approving at ecd0160: the rebase onto the new #568 head changes nothing in the PR's own diff, and the latest CI run is green on both Julia versions. The red runtests ${{ matrix.version }} entry on the checks tab is the cancelled run 40305099724, superseded; nothing to chase.

@matt-pharr
matt-pharr force-pushed the bugfix/analysis-h5-readers branch from ecd0160 to cd0adf6 Compare October 26, 2026 21:00
Base automatically changed from feature/local-stability-problem to develop October 26, 2026 21:01
@matt-pharr
matt-pharr merged commit db4fa1b into develop Oct 26, 2026
4 of 6 checks passed
@matt-pharr
matt-pharr deleted the bugfix/analysis-h5-readers branch October 26, 2026 21:01
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants