Correct normal-mode Green transformation - #93
Merged
Conversation
kpentland
approved these changes
Aug 11, 2026
kpentland
left a comment
Collaborator
There was a problem hiding this comment.
This all looks good - nice spot that P_inverse and P_transpose are not the same here - I recall this popping up before in our growth rate analysis
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.
Summary
Correct the transformation used to construct Green-function maps for active-coil and passive-structure normal modes.
The physical metal currents and normal-mode currents are related by
[
\vec{I}_m = P\vec{I}_d,
]
with the inverse transformation
[
\vec{I}_d = P^{-1}\vec{I}_m.
]
P^{-1}is therefore the correct transformation when recovering modal currents from physical currents.The poloidal flux produced by physical metal currents is
[
\psi = \vec{I}_m^T G_m,
]
where (G_m) contains the Green maps for the physical metal elements. Substituting (\vec{I}_m=P\vec{I}_d) gives
[
\psi
= (P\vec{I}_d)^T G_m
= \vec{I}_d^T P^T G_m.
]
Consequently, the Green maps per unit normal-mode current must be
[
G_d = P^T G_m,
]
rather than (P^{-1}G_m).
This distinction matters because the passive-mode eigenvectors are independent but not generally orthogonal, so (P^T \neq P^{-1}).
Changes
Pmatrix_inverseinnormal_modes_greens()withPmatrix.T.normal_modes_greens().Example corrections
Example 10 previously contained two separate plotting problems:
The corrected example now illustrates both valid routes:
[
\psi = \vec{I}_d^T G_d
]
using modal currents and modal Green maps, and
[
\psi = \vec{I}_m^T G_m
]
after reconstructing the physical currents.
Behavioural impact
The circuit-current transformations in
circuit_eq_metal.pywere already correct and are unchanged.The corrected Green maps are used when preparing initial finite-difference perturbations for passive-mode coupling calculations. Therefore, the correction can change which passive modes are selected for a fixed reduced-mode count. The corresponding dynamics regression reference has been updated while retaining its existing relative tolerance.
Active-coil Green maps are unaffected because the active-coil block of (P) is the identity.
Validation
Focused normal-mode and dynamics tests: 5 passed.
The remaining repository tests passed during the full-suite run, with 4 existing skips.
A MAST-U nonlinear-solver smoke test compared:
Relative discrepancy:
[
5.4\times10^{-16}.
]
This is consistent with floating-point round-off.