Skip to content

Enforce up-down symmetry throughout inverse solves - #101

Merged
nicamo merged 4 commits into
mainfrom
fix-inverse-up-down-symmetry
Aug 11, 2026
Merged

Enforce up-down symmetry throughout inverse solves#101
nicamo merged 4 commits into
mainfrom
fix-inverse-up-down-symmetry

Conversation

@nicamo

@nicamo nicamo commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Project the initial plasma flux onto its up-down-even component before the first inverse residual and current update when force_up_down_symmetric=True.
  • Propagate symmetry forcing into the full plasma-response Jacobian builder.
  • Apply it to both the baseline equilibrium and every finite-difference coil perturbation solve.
  • Preserve the existing default behaviour and positional compatibility of optimize_currents().
  • Clarify the symmetry contract in Example 07a and report the resulting plasma-flux parity error.

Motivation

Previously, symmetry forcing was passed only to the main forward corrections performed by the inverse loop. The initial inverse update could therefore react to an odd component in the supplied plasma flux, while the baseline and perturbed forward solves used to construct the full Jacobian silently ran without symmetry forcing. This meant the inverse solve did not consistently remain in the requested even-plasma subspace.

The flag constrains the plasma response; exactly symmetric currents in independent upper/lower coils still require those currents to be linked or constrained by the machine/control model.

Validation

  • Added coverage proving an explicitly asymmetric initial plasma_psi is projected before inverse iteration.
  • Added coverage proving the full-Jacobian baseline and every perturbed solve receive the symmetry flag.
  • Existing diverted inverse regression remains unchanged.
  • test_inverse_static_solver.py and test_static_solver.py: 4 passed.
  • Example 07a runs end-to-end.
  • Its first symmetric Anamak inverse case converges in 9 iterations, exercises the full-Jacobian path, reaches 4.39e-6, and reports a relative plasma-flux parity error of 0.000e+00.

Scope

The runtime implementation adds only the initial projection and missing argument propagation. Behaviour is unchanged when force_up_down_symmetric=False. The example amendment adds one explanation and one parity diagnostic.

@nicamo nicamo added the enhancement New feature or request label Aug 4, 2026
@nicamo
nicamo changed the base branch from streamlining to main August 4, 2026 11:46

@kpentland kpentland 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.

Sensible fix!

@nicamo nicamo added the ready-for-final-tests Pull request is ready to run final pre-merge tests label Aug 11, 2026
@nicamo
nicamo merged commit 6076b23 into main Aug 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ready-for-final-tests Pull request is ready to run final pre-merge tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants