Skip to content

InnerLayer.SLAYER - API! - Default the layer radial label to the toroidal-flux label - #599

Draft
logan-nc wants to merge 2 commits into
developfrom
refactor/slayer-flux-radial-label
Draft

logan-nc wants to merge 2 commits into
developfrom
refactor/slayer-flux-radial-label

Conversation

@logan-nc

Copy link
Copy Markdown
Collaborator

Release note

  • Audience: users
  • Numerical impact: every SLAYER layer quantity of a default run moves. On the DIII-D-like layer deck the minor radius rs moves by up to 46 %, the r-based shear by 57 %, the Lundquist number by 10 %, D_norm, tau_k, Q_e, Q_i and the Q roots by 17 to 84 %, the growth rate by up to 66 % and the real frequency by 0.05 %. Ideal DCON and perturbed-equilibrium quantities are untouched (harness @ 88a0f1e)
  • Migration: callers of build_slayer_inputs, radial_label or resistive_layer_overlap that want the old outboard-midplane chord must now pass rs_method=:midplane explicitly. The TOML interface is unchanged because the label was never exposed there.

SLAYER's layer stack (minor radius, r-based shear, Lundquist number, resistive and diffusion times, Delta-prime reference length) is now expressed by default in the toroidal-flux radial label r = sqrt(2 psi_t / B0), the coordinate the Fitzpatrick layer formalism is derived in, instead of the outboard midplane chord.

Regression report

Run from the repo root on feynman, --cases diiid_slayer_n1,diiid_n1 --refs develop,refactor/slayer-flux-radial-label (4 threads). The SLAYER rows are expected to move; a clean report would have meant the flip did nothing.

Regression Report: diiid_slayer_n1
==================================================================================================================
Ref 1: develop  @ db90e824d (2026-10-26)
       env: julia 1.11.7, x86_64-linux-gnu, manifest cb9237e9 (pinned), 4 threads/4 BLAS, jit build
Ref 2: refactor/slayer-flux-radial-label  @ 88a0f1e31 (2026-10-26)
       env: julia 1.11.7, x86_64-linux-gnu, manifest cb9237e9 (pinned), 4 threads/4 BLAS, jit build
------------------------------------------------------------------------------------------------------------------
Quantity                            develop   refactor/slayer-flux-radial-label  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]                           2.486e-01 (45.90%)  ** CHANGED **
SLAYER r-based shear                [6 elem]  [6 elem]                           5.347e+01 (57.27%)  ** CHANGED **
SLAYER Lundquist S                  [6 elem]  [6 elem]                           7.344e+06 (9.85%)   ** CHANGED **
SLAYER D_norm                       [6 elem]  [6 elem]                           3.499e-01 (16.76%)  ** CHANGED **
SLAYER P_perp                       [6 elem]  [6 elem]                           0.0e+00             OK           
SLAYER tauk                         [6 elem]  [6 elem]                           1.756e-05 (29.61%)  ** CHANGED **
SLAYER iota_e                       [6 elem]  [6 elem]                           1.1e-16             OK           
SLAYER Q_e                          [6 elem]  [6 elem]                           1.428e+00 (84.27%)  ** CHANGED **
SLAYER Q_i                          [6 elem]  [6 elem]                           1.009e+00 (84.27%)  ** CHANGED **
SLAYER Q_root [2/1,3/1,4/1]         [3 elem]  [3 elem]                           5.442e-01 (29.59%)  ** CHANGED **
SLAYER ω_Hz [2/1,3/1,4/1]           [3 elem]  [3 elem]                           1.703e+01 (0.05%)   ** CHANGED **
SLAYER γ_Hz [2/1,3/1,4/1]           [3 elem]  [3 elem]                           7.427e+02 (66.11%)  ** 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)                         313.7s    304.9s                                                 --           
==================================================================================================================
Summary: 10 changed, 7 unchanged
Regression Report: diiid_n1
===================================================================================================================
Ref 1: develop  @ db90e824d (2026-10-26)
       env: julia 1.11.7, x86_64-linux-gnu, manifest cb9237e9 (pinned), 4 threads/4 BLAS, jit build
Ref 2: refactor/slayer-flux-radial-label  @ 88a0f1e31 (2026-10-26)
       env: julia 1.11.7, x86_64-linux-gnu, manifest cb9237e9 (pinned), 4 threads/4 BLAS, jit build
-------------------------------------------------------------------------------------------------------------------
Quantity                                      develop          refactor/slayer-flux-radial-label  Diff       Status
-------------------------------------------------------------------------------------------------------------------
total energy Re(et[1])                        8.006121e-01     8.006121e-01                       0.0e+00    OK    
total energy Im(et[1])                        7.924895e-05     7.924895e-05                       0.0e+00    OK    
plasma energy Re(ep[1])                       -1.372262e+00    -1.372262e+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)                             786              786                                0.0e+00    OK    
ODE steps (total)                             781              781                                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)                          b1111f97ec46...  b1111f97ec46...                    identical  OK    
pressure profile (checksum)                   b51fb6595b42...  b51fb6595b42...                    identical  OK    
Mercier D_I profile (checksum)                8b9e13cf4e89...  8b9e13cf4e89...                    identical  OK    
resistive interchange D_R profile (checksum)  46bc100c7b20...  46bc100c7b20...                    identical  OK    
ballooning Delta' profile (checksum)          21835494f41e...  21835494f41e...                    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.288517e-04     5.288517e-04                       0.0e+00    OK    
dominant-coupling singular values             [3 elem]         [3 elem]                           0.0e+00    OK    
|forcing overlap with dominant mode|          1.411539e-04     1.411539e-04                       0.0e+00    OK    
|delta_nominal| of coil set 1                 7.034579e-05     7.034579e-05                       0.0e+00    OK    
||ddelta/d(shift)|| over coil sets            1.245445e-04     1.245445e-04                       0.0e+00    OK    
||ddelta/d(tilt)|| over coil sets             4.177337e-07     4.177337e-07                       0.0e+00    OK    
PE plasma energy                              3.320466e+00     3.320466e+00                       0.0e+00    OK    
PE vacuum energy                              3.174319e+00     3.174319e+00                       0.0e+00    OK    
PE surface energy                             5.508586e+00     5.508586e+00                       0.0e+00    OK    
PE toroidal torque                            1.119360e-04     1.119360e-04                       0.0e+00    OK    
NTV torque FGAR [N·m]                         5.480623e-01     5.480623e-01                       0.0e+00    OK    
NTV kinetic energy dW FGAR [J]                8.163454e-02     8.163454e-02                       0.0e+00    OK    
Runtime (s)                                   306.9s           303.3s                                        --    
||forcing b~|| (root-area-weighted)           4.683171e-04     4.683171e-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

Refs #417. This is the evidence PR the issue asked for: the three defaults flipped in one place, the harness magnitudes attached, and the decision left to the maintainers. It does not close the issue by itself.

  • The change is exactly three rs_method defaults (radial_label, build_slayer_inputs, resistive_layer_overlap) plus their docstrings. No formula changed, so the label comparison testset in runtests_slayer_inputs.jl still covers every label.
  • The layer-overlap driver already passed rs_method=:flux explicitly, so the overlap cut of a default run is unchanged. Only the direct SLAYER stage, which calls build_slayer_inputs with the default, moves.
  • runtests_slayer_inputs.jl previously pinned the per-surface rs to the midplane helper. It now derives the expectation from radial_label(equil) so the test follows the default label instead of hard-coding one.
  • Tests run on the branch: runtests_slayer_inputs.jl, runtests_layer_overlap_fitzpatrick.jl, runtests_innerlayer.jl, runtests_slayer_riccati.jl, all passing.
  • No review package: a three-default change is below the threshold for one.

Suggested reviewer: @d-burg (Tearing and the layer-overlap evidence behind the issue). Opened as a draft so the maintainers can pick the reviewer and decide whether the flip ships for 2.0.


🤖 Generated with Claude Code

https://claude.ai/code/session_0186CLfjeJeSusNTva5RMfGU

logan-nc and others added 2 commits October 26, 2026 21:09
…idal-flux label

The Fitzpatrick layer widths are derived in r = sqrt(2 psi_t / B0), so make
that label the default for rs, the r-based shear, S, tau_R and the Delta-prime
reference length instead of the outboard-midplane chord. The overlap scan
already evaluated its criterion in this label; the layer stack now agrees.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0186CLfjeJeSusNTva5RMfGU
@logan-nc logan-nc added this to the GPEC v2.0.0 milestone Oct 27, 2026
@logan-nc logan-nc self-assigned this Oct 27, 2026
@github-actions github-actions Bot added api Config key, output dataset or exported name changed changed-results Results move or an interface breaks - read before upgrading labels Oct 27, 2026
@d-burg
d-burg self-requested a review October 27, 2026 19:29

@d-burg d-burg 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 @logan-nc. The flip itself looks right to me: the flux label is the coordinate the Fitzpatrick layer formalism is written in, and the change is confined to the three defaults. A few claude things before it can land:

Checked on current develop. I merged develop 0b4b9fbfb into the branch locally (clean) and reran diiid_slayer_n1 on feynman. The shifts are essentially the ones in your report, so #501's P_perp_model=:D_perp default doesn't change the picture. The branch still needs the develop merge and a new stamp for CI.

theta_sample becomes a no-op. TearingProblem passes theta=control.theta_sample to build_slayer_inputs, and :flux ignores θ. Since rs_method isn't in the TOML, no deck can reach a θ-dependent label any more, but the [SLAYER] key is still accepted and its docstring (Tearing/Runner/Control.jl) still says it sets where the minor radius is sampled. So "the TOML interface is unchanged" isn't quite true: either warn when theta_sample is set, or document that it only affects rs_method=:midplane callers of the API.

Stale header. The file comment at the top of LayerInputs.jl still says the minor radius is taken at the outboard midplane from rzphi_rsquared((ψ, 0.0)).

Test. Deriving the expected rs from radial_label(equil) makes the test follow the default, which also means it can't catch the default changing again. Pinning rs_method=:flux explicitly would.

Interaction with #441 and #415. Neither conflicts textually with this branch.

  • #441: its toroidal-D_geo wiring test in runtests_slayer_inputs.jl builds its reference k_ref from surface_minor_radius/surface_da_dpsi, so with this PR merged six assertions fail (dgeo_val, kpar_val, k_ref). The physics is fine: dgeo_val and k_ref move by the same factor (0.811), which is the expected scaling with K. It's a test that hard-codes the midplane label, and I'll make it label-agnostic on #441 so the merge order doesn't matter.
  • #415: its tests pass on the combined tree, but its harness pins move: br_crit 5.8 %, Q_peak 40.8 %, Q0 29.6 % (through tauk). Whichever of the two merges second needs a new stamp.

Overall I'm in favor of shipping this in 2.0 for the improved inner layer model accuracy.

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

api Config key, output dataset or exported name changed 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