Skip to content

PerturbedEquilibrium - BUGFIX! - Refuse Galerkin and matched results until they publish wp - #556

Merged
matt-pharr merged 5 commits into
developfrom
bugfix/pe-refuse-unpublished-wp
Oct 26, 2026
Merged

matt-pharr merged 5 commits into
developfrom
bugfix/pe-refuse-unpublished-wp

Conversation

@matt-pharr

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

Copy link
Copy Markdown
Collaborator

Release note

  • Audience: users
  • Numerical impact: none (harness @ 13d7738)
  • Migration: a run that asks for the perturbed-equilibrium response or singular coupling on a Galerkin result, or on a result passed through MatchProblem, now stops with an error. Set compute_response = false and compute_singular_coupling = false for such a run, or use a forward solve.

The plasma response and singular coupling need the free-boundary δW. Galerkin and inner-layer-matched results don't carry it yet, so on those results PerturbedEquilibrium used to log a warning and return an output holding only the forcing modes. It now raises an error that says why. The error lifts once those results publish the plasma edge response wp.

Regression report

SDCC fan-out, regress --cases gal_resistive_pe,diiid_n1 --refs develop,bugfix/pe-refuse-unpublished-wp (develop @ 1cb9bf0, now that #549 has merged; branch @ 13d7738 after merging develop in; Julia 1.12.6 with the CI manifest pin). Nothing moves. gal_resistive_pe reads all N/A on both refs, as it did before this change, because PE skipped these steps; both runs complete. diiid_n1 is the forward-solve control.

Full report
Regression Report: gal_resistive_pe
================================================================================
Ref 1: 1cb9bf099  @ 1cb9bf099 (2026-10-25)
       env: julia 1.12.6, x86_64-linux-gnu, manifest 4c9d54fa (pinned), 2 threads/1 BLAS, jit build
Ref 2: bugfix/pe-refuse-unpublished-wp  @ 13d773818 (2026-10-24)
       env: julia 1.12.6, x86_64-linux-gnu, manifest 4c9d54fa (pinned), 2 threads/1 BLAS, jit build
--------------------------------------------------------------------------------
Quantity                1cb9bf099  bugfix/pe-refuse-unpublished-wp  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)             243.8s     243.3s                                 --
================================================================================
Summary: 8 missing/N/A


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

Regression Report: diiid_n1
=================================================================================================================
Ref 1: 1cb9bf099  @ 1cb9bf099 (2026-10-25)
       env: julia 1.12.6, x86_64-linux-gnu, manifest 4c9d54fa (pinned), 2 threads/1 BLAS, jit build
Ref 2: bugfix/pe-refuse-unpublished-wp  @ 13d773818 (2026-10-24)
       env: julia 1.12.6, x86_64-linux-gnu, manifest 4c9d54fa (pinned), 2 threads/1 BLAS, jit build
-----------------------------------------------------------------------------------------------------------------
Quantity                                      1cb9bf099        bugfix/pe-refuse-unpublished-wp  Diff       Status
-----------------------------------------------------------------------------------------------------------------
total energy Re(et[1])                        8.006122e-01     8.006122e-01                     0.0e+00    OK
total energy Im(et[1])                        7.924888e-05     7.924888e-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)                             792              792                              0.0e+00    OK
ODE steps (total)                             787              787                              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.842268e-01     8.842268e-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)                          6da947d0754e...  6da947d0754e...                  identical  OK
pressure profile (checksum)                   c9c6ca4072ca...  c9c6ca4072ca...                  identical  OK
Mercier D_I profile (checksum)                26babbe22505...  26babbe22505...                  identical  OK
resistive interchange D_R profile (checksum)  c46830151a0b...  c46830151a0b...                  identical  OK
ballooning Delta' profile (checksum)          c27c6779804a...  c27c6779804a...                  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.288737e-04     5.288737e-04                     0.0e+00    OK
dominant-coupling singular values             [3 elem]         [3 elem]                         0.0e+00    OK
|forcing overlap with dominant mode|          1.411620e-04     1.411620e-04                     0.0e+00    OK
|delta_nominal| of coil set 1                 7.034983e-05     7.034983e-05                     0.0e+00    OK
||ddelta/d(shift)|| over coil sets            1.245516e-04     1.245516e-04                     0.0e+00    OK
||ddelta/d(tilt)|| over coil sets             4.176401e-07     4.176401e-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.509016e+00     5.509016e+00                     0.0e+00    OK
PE toroidal torque                            1.119447e-04     1.119447e-04                     0.0e+00    OK
NTV torque FGAR [N·m]                         5.483433e-01     5.483433e-01                     0.0e+00    OK
NTV kinetic energy dW FGAR [J]                8.163732e-02     8.163732e-02                     0.0e+00    OK
Runtime (s)                                   353.6s           353.4s                                      --
||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

Notes for reviewers

The refusal. compute_perturbed_equilibrium errors when all three hold:

  • compute_response or compute_singular_coupling is requested;
  • the result is Galerkin-integrated or has :matched closure;
  • the result has no free_boundary.

It checks free_boundary itself, so the refusal lifts on its own when a later change publishes wp from closed Galerkin and matched results. It sits in the one function the deck, the scripting API and efc_couplings all share. A matched Riccati result is caught by the closure check. With both steps off, PE still materializes the forcing, so a staged deck runs.

Unchanged on purpose. A Riccati result, which has no ξ solution, and a forward run with vac_flag = false, which has no free-boundary energies, still warn and skip. They are outside this change.

gal_resistive_pe. The harness has no "expected N/A" flag, and an error would have made the case show FAILED and broken the example for anyone running it. So the example keeps its coil forcing and [PerturbedEquilibrium] section, ready for when wp lands, with the two steps switched off. Its harness case header says the PE quantities are expected N/A; all eight tracked datasets are under PerturbedEquilibrium/SingularCoupling/. require loses its :matched message branch, since PE was its only :free_boundary caller.

Tests. runtests_solve_api.jl now checks:

  • PE refuses the existing Galerkin result;
  • PE refuses the existing Riccati-matched result;
  • the matched result with both steps off still returns a state.

These reuse solves the file already runs, so they add no extra solves.

🤖 Generated with Claude Code

@matt-pharr matt-pharr self-assigned this Oct 22, 2026
@matt-pharr
matt-pharr requested a review from logan-nc October 22, 2026 11:05
@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 22, 2026
@matt-pharr
matt-pharr added this pull request to stack #557 October 22, 2026 12:39

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

The refusal is in the one shared function, keys on free_boundary so it lifts itself, and the harness shows the eight gal_resistive_pe rows N/A on both refs as the body says. One consistency note for later, not for this PR: #574 removes the "set both flags false" escape hatch this Migration line recommends (Galerkin/matched results then error at plasma_response unconditionally and the example moves to force_termination), so the two migration notes will disagree once both land. #574's should mention that it supersedes this one.

@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 13d7738 on the comment review above. Note #574 later removes the both-flags-off path this adds; that is #574's question, not this PR's.

@matt-pharr
matt-pharr merged commit 10459f3 into develop Oct 26, 2026
5 of 6 checks passed
@matt-pharr
matt-pharr deleted the bugfix/pe-refuse-unpublished-wp branch October 26, 2026 08:27
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.

2 participants