Skip to content

ForceFreeStates - BUGFIX - Pair psihigh with its own q when q peaks inside the domain - #691

Draft
krystophny wants to merge 1 commit into
developfrom
fix/qlim-at-edge-20261127
Draft

krystophny wants to merge 1 commit into
developfrom
fix/qlim-at-edge-20261127

Conversation

@krystophny

Copy link
Copy Markdown
Collaborator

sing_lim! starts from qlim = min(qmax, qhigh) and psilim = psihigh_resolved. When qlim is not below qmax, the Newton step is skipped and qlim keeps qmax. qmax is the largest q over the profile, so when q peaks inside the domain the pair (psilim, qlim) does not lie on the q profile:

intr.qlim = min(equil.params.qmax, ctrl.qhigh)
intr.psilim = equil.params.psihigh_resolved
...
if intr.qlim < equil.params.qmax
    # Newton for psilim
end

The edge branch now sets intr.qlim = profiles.q_spline(intr.psilim), so the singular factor $m - n,q_\mathrm{lim}$ of the free-boundary energy and the vacuum matching use q at the boundary. Fortran GPEC has the same defect, PrincetonUniversity/GPEC#372.

New case in test/runtests_sing.jl: $q = 2 + 3\psi - 2\psi^2$ peaks at $q = 3.125$ inside the domain and reaches 3.0005 at psihigh. With qhigh = 10 the old code returns qlim = 3.125, the fix returns 3.0005, equal to $q(\psi_\mathrm{lim})$; all 97 tests of runtests_sing.jl pass. Monotonic q profiles are unchanged.

Chris&AI

@github-actions github-actions Bot added the bugfix Something was wrong and now is not label Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request is missing an assignee and a reviewer.

If you are not ready to name them, mark this pull request as a draft.
docs/development/contributors.md suggests lead developers to ask.
Merging is not blocked here, but no pull request may be merged without human review.

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

bugfix Something was wrong and now is not

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant