Skip to content

Guess the axis when the initial Jacobian changes sign - #31

Merged
krystophny merged 1 commit into
developfrom
fix/guess-axis-on-bad-jacobian
Nov 7, 2026
Merged

krystophny merged 1 commit into
developfrom
fix/guess-axis-on-bad-jacobian

Conversation

@krystophny

Copy link
Copy Markdown
Member

pygvec run stops with JACOBIAN WITH SIGN CHANGE FOUND AFTER INITIALIZATION when the given or averaged axis makes the initial interpolation fold over. This happens on many bean-shaped stellarators (NCSX, W7-X, CHS, the Landreman-Paul QA/QH configurations). VMEC handles the same situation with guess_axis and continues.

The fixed-boundary runner now retries once, with the axis from the new gvec.util.guess_axis, and logs a warning. In each toroidal plane the Jacobian of the initial interpolation (axis blended into the m = 0 modes like 1 - rho^2, other modes like rho^m) is linear in the axis position. So the axis that maximises its smallest value solves a small linear program, where VMEC uses a grid search. The planes are then fitted with the axis Fourier modes. Runs that restart from a state are not retried.

  • On the benchmark decks that still failed after Read the legacy RAXIS and ZAXIS and scalar axis entries of VMEC inputs #30, 31 of 36 runs now initialise and iterate. The other 5 (belt14, belt20, m45.OHseries, n5qh.fx3.a55z, nfp4_QI_finite_beta) have no axis with a positive initial Jacobian under the rho^m interpolation.
  • New test test_run_guesses_axis_after_bad_jacobian: a circular torus with its axis near the outer edge, for which guess_axis returns the centre and the run continues. It fails on develop.

Chris&AI

pygvec run stopped with 'JACOBIAN WITH SIGN CHANGE FOUND AFTER INITIALIZATION' when the given or averaged axis made the initial interpolation fold over, as on many bean-shaped stellarators. Like VMEC's guess_axis, retry once with the axis that maximises the smallest Jacobian of the initial interpolation in each toroidal plane, which is a linear program because that Jacobian is linear in the axis position.
@krystophny
krystophny added this pull request to the merge queue Nov 7, 2026
Merged via the queue into develop with commit a8dbf1c Nov 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant