Repository navigation
Equilibrium - BUGFIX - Support original and rho grids for inverse equilibria - #521
Closed
StuartBenjamin wants to merge 3 commits into
Closed
StuartBenjamin wants to merge 3 commits into
StuartBenjamin wants to merge 3 commits into
Conversation
…se equilibria grid_type = "original" set mpsi but never the grid, so it errored. It now uses the input's own psi nodes (Fortran inverse.f), axis included and unfloored; the axis node's 0/0 SFL and GSE terms are extrapolated from the innermost surfaces. Add pow2 (Fortran powspace, upper) and rho grids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ow to psihigh Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StuartBenjamin
marked this pull request as draft
October 13, 2026 09:39
Collaborator
Author
|
Superseded by #523 (same grids, without the axis-extrapolation code). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release note
grid_type = "original"and"rho"errored before for inverse equilibria. An inverse run withpsilow = 0on ldp, pow1, uniform or rho, which gave NaN at the axis, now gets an extrapolated axis row (harness @ f0497d3)Inverse equilibria now accept
grid_type = "original"(the input file's own ψ nodes) and"rho"(uniform in √ψ).Regression report
Problem
For inverse equilibria (CHEASE, LAR),
grid_type = "original"setmpsibut never built the ψ grid, so the run stopped with an undefined-variable error. Fortraninverse.falso offersrho, which Julia GPEC rejected as "Unsupported grid_type".Fix
originaluses the input file's own ψ nodes, as Fortran does, and ignores psilow and mpsi (psihigh still sets the integration limit, as in Fortran); no minimum node spacing is applied. (Fortran takes the 1D input's nodes; they differ from the 2D ones only for efit_by_inversion.)rhois uniform in √ψ from psilow to psihigh: ψᵢ = (√psilow + (√psihigh − √psilow)·i/mpsi)², i = 0…mpsi. Fortran'srhoignores psilow (it runs from psihigh/(mpsi+1)² to psihigh); here it honours psilow like the other grids.detaalready was: θ-dependent fields in √ψ (∝ r) by a new helperextrap_axis_row!(also used inequilibrium_gse!), dV/dψ in ψ.grid_typedocstring lists the new options.Tests
New testset "Inverse grid types (original, rho)" in
test/runtests_equil.jl, on the CHEASE test fileINP1_binary(which starts at the axis): the original grid equals the file's nodes, all splines are finite and the extrapolated axis |B| is within 1 % of F/R₀ for every θ; the rho grid runs from psilow to psihigh and its splines are finite.test/runtests_equil.jl: 301/301 pass; the full suite was not run. Harness:solovev_n1only, 22 unchanged (no harness case uses an inverse equilibrium on these grids;diiid_n1was not run).Notes for reviewers
#511 (field-line q for i-file inverse equilibria) edits the same
sq_fslines inequilibrium_solver; whichever lands second needs a small rebase.🤖 Generated with Claude Code