Commit 8dab0ed
COILS - BUGFIX - Use psilim on the external-forcing path too, not just the coil path
The coil branch of PerturbedEquilibrium already passed psi=ffs_intr.psilim
(PerturbedEquilibrium.jl:98), but the other branch — external forcing data read
from file — called convert_forcing_normalization! with no psi, so it fell back
to the default surface. That path therefore normalized on the wrong surface
silently, with no error, whenever dmlim/qhigh/psiedge moved psilim inward of
psihigh (e.g. 0.998902 vs 0.9995 on a DIII-D case: a 6e-4 gap, same order as the
psi_N=1 extrapolation this PR already fixed).
Both production paths now use psilim, matching Fortran (gpec/gpec.f:431
field_bs_psi(psilim,...)). psilim is the ODE's last grid point to within eps=1e-10
(the final chunk ends at psilim*(1-eps), EulerLagrange.jl:504) and is snapped to
psi_store[end] exactly in the dW-peak truncation path (Riccati.jl:1375,1870,
EulerLagrange.jl:230).
The psihigh default on the three signatures is retained and re-documented as the
bare-PlasmaEquilibrium fallback — reachable only by direct callers with no
ForceFreeStates solve, for whom psilim does not exist yet — not as the intended
control surface.
Full test suite passes locally.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent b2ec04c commit 8dab0ed
2 files changed
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
110 | 114 | | |
111 | | - | |
| 115 | + | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
| |||
0 commit comments