freegsnke.normal_modes module
Calculates matrix data needed for normal mode decomposition of the vessel.
Copyright 2025 UKAEA, UKRI-STFC, and The Authors, as per the COPYRIGHT and README files.
This file is part of FreeGSNKE.
FreeGSNKE is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
FreeGSNKE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with FreeGSNKE. If not, see <http://www.gnu.org/licenses/>.
- class freegsnke.normal_modes.mode_decomposition(coil_resist: ndarray, coil_self_ind: ndarray, n_coils: int, n_active_coils: int, passive_reflection_operator: ndarray | None = None, symmetry_tolerance: float = 1e-08)[source]
Bases:
objectSet up the vessel mode decomposition used by the dynamic solvers.
When a symmetric reflection operator is supplied, the passive dynamics are decomposed into orthogonal even and odd subspaces before their normal modes are calculated. This prevents degenerate eigenvalues from producing modes with arbitrary mixed parity.
- __init__(coil_resist: ndarray, coil_self_ind: ndarray, n_coils: int, n_active_coils: int, passive_reflection_operator: ndarray | None = None, symmetry_tolerance: float = 1e-08) None[source]
Instantiates the class. Matrix data calculated here is used to reformulate the system of circuit eqs, primarily in circuit_eq_metal.py
- Parameters:
coil_resist (np.ndarray) – 1d array of resistance values for all machine conducting elements, including both active coils and passive structures.
coil_self_ind (np.array) – 2d matrix of mutual inductances between all pairs of machine conducting elements, including both active coils and passive structures
n_coils (int) – Total number of active and passive conducting elements.
n_active_coils (int) – Number of active circuits at the start of the current vector.
passive_reflection_operator (np.array, optional) – Matrix mapping passive currents to their up-down reflected counterparts. When supplied, passive modes are classified as even or odd in Z.
symmetry_tolerance (float, optional) – Maximum relative commutator error permitted between passive dynamics and the supplied reflection operator.
- normal_modes_greens(eq_vgreen: ndarray, mode_matrix: ndarray | None = None) ndarray[source]
Calculate the Green functions of the vessel normal modes.
If
I_mcontains the physical metal currents andI_dcontains the normal-mode currents, the current transformation isI_m = Pmatrix @ I_d.Since the physical-coil Green functions satisfy
psi = I_m.T @ G_m, substitution givespsi = I_d.T @ Pmatrix.T @ G_m.The modal Green functions are therefore
Pmatrix.T @ G_m. The inverse transformation is instead used to recover modal currents from physical currents and must not be applied to the Green functions.- Parameters:
eq_vgreen (np.ndarray) – The vectorised Green functions of each coil, found at
eq._vgreen, with shape (n_coils, nx, ny).mode_matrix (np.ndarray or None, optional) – Transformation from retained mode currents to physical currents. Defaults to the full mode matrix.
- Returns:
Green functions of the retained modes, shape (n_modes, nx, ny).
- Return type:
np.ndarray