Commit 288fe03
EQUIL - BUGFIX - Detect field-line ODE failure; add psiedge floor and guard the trial loop
Section 0 of the plan first: triple-checked the metres->flux conversion before
building on it. All three checks pass on the DIII-D-like deck.
- d_i = 0.0509 m vs the NRL c/omega_pi form 0.0510 m (0.2%)
- |dels_db| = 0.67..1.45, i.e. genuinely O(1); delta_s = 1.8..4.4 mm;
delta_s/r_s = 0.3..1.1%
- da/dpsi agrees to <=3.6% across surface_da_dpsi, a different-h difference,
and the secant between adjacent surfaces
- the set of overlapping pairs is IDENTICAL computed all-in-flux and
all-in-metres, so the conversion cannot invent an overlap
Decisive on its own, needing no conversion: q=6 and q=7 sit 1.821 mm apart with
half-widths summing to 2.338 mm. Every other adjacent pair is 8.7 mm or more
apart. The truncation removes 3.59 mm, 0.66% of the minor radius -- far out, as
expected; the psi number reads deep only because psi is compressed at the edge.
The original mixed-units comparison finds NO overlap at all on the in-grid
surfaces, so it would not have truncated.
DirectEquilibrium.jl: check sol.retcode and the eta=2*pi endpoint after the
field-line solve. A failed integration does not throw -- it returns a solution
truncated wherever it gave up, and the caller read the last point as if the
surface closed. That was a silently wrong equilibrium; it is now a named error
that says which psifac failed.
Lower gate: the resolved psihigh may not fall below the top of the rational-q
window psiedge sits in -- the first rational surface OUTBOARD of psiedge --
because the dW edge scan runs over [psiedge, psilim] and needs room for its
maximum. psiedge >= psihigh (the documented scan-disabled sentinel) means no
floor, else decks that switch the scan off could never truncate. Independently,
refuse to truncate if fewer than two rational surfaces would survive.
On the SLAYER deck the floor binds: the criterion asks 0.98919, psiedge=0.99
sits in the q=6 window, so the domain is held at 0.99328 and the warning says
the retained surfaces are set by psiedge rather than by physics.
Trial loop: catch any exception from setup_equilibrium (axis finder, separatrix
finder, field-line ODE, Roots convergence) as a failed trial and back off, and
restore eq_config.psihigh, which was mutated before the attempt. Also thread
DirectRunInput.psi_in through so the round-trip tracing residual runs on plain
efit decks, not only efit_by_inversion -- the capability existed, it was unwired.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSrf6JCViFfVzqzkQ66o6b1 parent 9e026a5 commit 288fe03
3 files changed
Lines changed: 121 additions & 6 deletions
File tree
- src
- Equilibrium
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
296 | 316 | | |
297 | 317 | | |
298 | 318 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
123 | 136 | | |
124 | 137 | | |
125 | 138 | | |
126 | 139 | | |
127 | 140 | | |
128 | | - | |
| 141 | + | |
129 | 142 | | |
130 | 143 | | |
131 | 144 | | |
| |||
153 | 166 | | |
154 | 167 | | |
155 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
156 | 192 | | |
157 | 193 | | |
158 | 194 | | |
159 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
160 | 200 | | |
161 | 201 | | |
162 | 202 | | |
163 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
164 | 208 | | |
165 | 209 | | |
166 | 210 | | |
167 | 211 | | |
168 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
169 | 227 | | |
170 | | - | |
| 228 | + | |
171 | 229 | | |
172 | 230 | | |
173 | 231 | | |
| |||
392 | 450 | | |
393 | 451 | | |
394 | 452 | | |
395 | | - | |
| 453 | + | |
396 | 454 | | |
397 | 455 | | |
398 | 456 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
121 | 158 | | |
122 | 159 | | |
123 | 160 | | |
| |||
0 commit comments