InnerLayer.SLAYER - BUGFIX - Use the shear magnitude in the layer timescales and widths - #431
Conversation
…escales and widths slayer_parameters took sval_r with its sign in five places that are magnitudes: the parallel diffusivity chi_par_lmfp (twice), the island width Wd, the :lar critical-Delta, and the Alfven time tau_h. On a reverse-shear surface tau_h came out negative, hence a negative Lundquist number, and tauk = lu^(1/3)*tau_h threw a DomainError before any layer quantity was produced. The two sqrt() sites would have thrown on the same surface. Found while scanning DIII-D reconstructions: shot 153072_3415 has q dipping to 1.855 off-axis, giving two q = 2 surfaces, and the inner one is on the negative-shear branch. Rational-surface finding is already reverse-shear-safe, so the layer build is handed exactly those surfaces. The layer timescales and widths depend on |dq/dr|, not its sign -- the module's own diffusive-resistive width derivation states the convention as (n|s|). abs(s) == s wherever the shear is positive, so no currently-working surface changes value; this only turns a crash into a result. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
This pull request is missing a reviewer. If you are not ready to name them, mark this pull request as a draft. |
1 similar comment
|
This pull request is missing a reviewer. If you are not ready to name them, mark this pull request as a draft. |
|
@logan-nc @jhalpern30 small pre-existing bug, split out of #298 so it stands on its own.
The question worth a physics opinion: I applied Draft for now; happy to mark ready once someone confirms the sign argument. |
Release note
abs(s) == swherever the shear is positive, so every surface that produced a value before produces the same value; this only turns a crash into a result on reverse-shear surfaces. (harness @ 66cc5ed)slayer_parametersused the signed r-based shearsval_rin five expressions that are magnitudes. On a reverse-shear surface this made the Alfvén time negative, hence a negative Lundquist number, andtauk = lu^(1/3)*tau_hthrew aDomainErrorbefore any layer quantity was produced.The five sites
| line | expression | why it needs
|s|||---|---|---|
|
chi_par_lmfp(×2) |(2 R0 vte)/(√π n s Wd)| a parallel diffusivity; must not change sign with shear direction ||
Wd|1/√((rs/R0) s n)| an island width;sqrtof a negative argument throws ||
:larcritical-Δ |√((n s)/(R0 rs))| same ||
tau_h|R0 √(μ₀ρ)/(n s bt)| a timescale; negativetau_h⇒ negativelu⇒lu^(1/3)throws |The layer timescales and widths depend on
|dq/dr|, not its sign. The module's own diffusive-resistive width derivation already states the convention as(n|s|).How it was found
Scanning DIII-D reconstructions for a separate piece of work. Shot 153072_3415 has
qdipping to 1.855 off-axis (q0 = 2.364), which puts two q = 2 surfaces in the plasma with the inner one on the negative-shear branch._find_rational_surfacesis deliberately reverse-shear-safe — it segments between q-extrema — so it finds both and hands them straight to the layer build, which then throws. Every SLAYER path is affected, not just the caller that surfaced it.No shipped deck or harness case has reverse shear, which is why this has gone unnoticed.
Validation
runtests_slayer_params49/49,runtests_slayer_riccati29/29,runtests_innerlayer57/57 on this branchdiiid_slayer_n1, developd7e6e6fevs this head66cc5ed08, both sides--force:The γ line is solver noise, not this change, and the report itself proves it: every layer input is bit-identical at
0.0e+00— includingsval_r,Sandtauk, which are exactly the quantitiesabs()would have moved had it done anything on this deck. With identical inputs, a 0.13 Hz shift in the extracted root can only come from the root search. That magnitude sits inside the measured same-source reproducibility of the threaded search (0.076 / 0.122 / 0.145 Hz per surface, #418), which is above the case's current 1e-1 threshold — the subject of a separate threshold PR.No shipped deck has a negative-shear rational surface, so zero change is the expected result and this is it.
Note
Opened as a draft. Reviewer suggestions: @logan-nc or @jhalpern30 — the substantive question is whether the shear sign is load-bearing anywhere else in the layer physics (the ω_* orientation being the obvious candidate), which I have not audited.