Skip to content

ForceFreeStates - BUGFIX! - Snap the periodic theta endpoint before integrating GGJ geometry - #439

Merged
logan-nc merged 3 commits into
developfrom
fix/resist-geometry-periodic-endpoint
Sep 29, 2026
Merged

logan-nc merged 3 commits into
developfrom
fix/resist-geometry-periodic-endpoint

Conversation

@adrianaghiozzi

Copy link
Copy Markdown
Collaborator

Release note

  • Audience: developers
  • Numerical impact: none (harness @ 987e63f, diiid_n1: 47/47 quantities bit-identical, develop vs. local)
  • Migration: none

resist_geometry (ResistEval.jl) and resist_eval (Resist.jl) build the GGJ
theta-integrand independently at each theta node, including both periodic
endpoints, then integrate with cubic_interp(...; bc=PeriodicBC()). The two
endpoint evaluations can differ by machine epsilon, which a stricter
PeriodicBC(endpoint=:inclusive) validator now rejects outright, aborting
force-free-state prep on some equilibria (mine hit it via a DIII-D case
driven from TokToxStability).

What

Snap ff[end, :] .= ff[1, :] right before each cubic_interp call, in both
ForceFreeStates/Surfaces/ResistEval.jl and the sibling
ForceFreeStates/Surfaces/Resist.jl (same GGJ-integrand pattern, same latent
bug -- not yet observed in the wild but a spot check shows it will trip the
same way on the right input).

This mirrors the fix already in Equilibrium.jl's GS-residual integrator:

# Snap the repeated endpoint exactly equal to the start
fs_matrix[end, :] .= fs_matrix[1, :]
itp = cubic_interp(equil.rzphi_ys, Series(fs_matrix); bc=PeriodicBC())

Context

Regression report

regress --cases diiid_n1 --refs develop,local

Regression Report: diiid_n1
=================================================================================================
Ref 1: develop  @ 987e63f3b (2026-08-28)
Ref 2: local    @ local     (2026-09-01)
-------------------------------------------------------------------------------------------------
Summary: 47 unchanged

Also ran the existing test/runtests_resist_eval.jl suite: 63/63 passed.

Notes for reviewers

No behavior change expected or observed -- this only prevents a false-positive
validator abort on machine-epsilon endpoint drift, matching the fix pattern
already established for #240.

@github-actions github-actions Bot added bugfix Something was wrong and now is not changed-results Results move or an interface breaks - read before upgrading labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is missing an assignee.

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.

@matt-pharr matt-pharr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrianaghiozzi Looks reasonable, but the comments are not really necessary, are they? The git blame will still point to this pr with reasoning. At most if you really think this needs comments, one curt line suffices

@adrianaghiozzi

Copy link
Copy Markdown
Collaborator Author

@matt-pharr Verbose Claude comments strike again lol I just shortened them in cefa010

@adrianaghiozzi

Copy link
Copy Markdown
Collaborator Author

Gonna just ping @logan-nc as I'm sure Matt has been busy getting settled in in France! This is a simple bug fix that Matt already reviewed and should be ready to merge. It's a bug that impacts a few of the workflows I use frequently for Next Step Fusion so it would be great to get it merged whenever someone has a chance :)

@logan-nc
logan-nc self-requested a review September 29, 2026 22:16
@logan-nc
logan-nc dismissed matt-pharr’s stale review September 29, 2026 22:16

review was addresses

@logan-nc

Copy link
Copy Markdown
Collaborator

looks good. I approve

@logan-nc
logan-nc enabled auto-merge September 29, 2026 22:18
@logan-nc
logan-nc merged commit 003e939 into develop Sep 29, 2026
8 of 9 checks passed
@logan-nc
logan-nc deleted the fix/resist-geometry-periodic-endpoint branch September 29, 2026 22:43
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 changed-results Results move or an interface breaks - read before upgrading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants