Repository navigation
EQUIL - BUGFIX - Sample every direct-equilibrium surface at the common straight-fieldline angles - #329
Merged
Conversation
…n straight-fieldline angles direct_run splined each traced surface on its own lsode steps and resampled it onto the theta grid, so the resample error was uncorrelated between surfaces and the psi derivatives amplified it. A second pass of the same trace now finds each target angle on lsode's interpolant (dintdy) and samples the solution there, as OpenFUSIONToolkit/GPEC#398 does in Julia GPEC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fl_sample Same results bit for bit; direct_fl_int keeps only the call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StuartBenjamin
added a commit
to StuartBenjamin/GPEC-1
that referenced
this pull request
Oct 18, 2026
…on straight-fieldline angles) into PSFC_dev
StuartBenjamin
marked this pull request as ready for review
October 23, 2026 02:14
matt-pharr
approved these changes
Oct 23, 2026
matt-pharr
left a comment
Collaborator
There was a problem hiding this comment.
I ran this myself, improvements check out. Thanks Stuart
StuartBenjamin
pushed a commit
to StuartBenjamin/GPEC-1
that referenced
this pull request
Oct 23, 2026
PrincetonUniversity#327 PrincetonUniversity#328 PrincetonUniversity#329 PrincetonUniversity#335 merged upstream; + 63328e4 STRIDE naive packing within nIntervalsTot, 0d6b30f docs) into PSFC_dev
This was referenced Oct 23, 2026
This was referenced Oct 24, 2026
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.
direct_runtraces each flux surface with lsode, splines the surface on that trace's own steps, and resamples the spline onto the common θ grid. The resample error is therefore different on each surface, and the ψ derivatives in the stability coefficients amplify it. This PR runs the same trace a second time and samples it exactly at the common straight-fieldline angles: each target angle is found by Newton iteration on lsode's own interpolant (dintdy), and the solution is taken there. The Julia version made the same change in OpenFUSIONToolkit/GPEC#398.solovev_ideal_example(DCON, mpsi 128), least stable total energy against the equilibrium toleranceetol:Develop only reaches the converged value as
etoltightens; with this PR it no longer depends onetol.Other examples (this PR against develop):
DIIID_ideal_example: least stable energy 0.77366 → 0.77364 (DCON); STRIDE Re Δ′ moves ≤ 0.9 % (q = 4: −17.38 → −17.23).DIIID_resistive_example(RDCON): Δ′ unchanged to 4 digits.solovev_resistive_example(RDCON): Δ′ 4.763e9 → 4.761e9.At a tight tolerance (
etol1e-10, on DIII-D g-files at mpsi 256–2048) RDCON's Δ′ moves ≤ 2e-7 and STRIDE's ≤ 0.02 %. The cost is a second trace per surface, which is small next to the stability solve.🤖 Generated with Claude Code