pyna.toroidal.control.island_control#

Magnetic island chain control via external coil perturbations.

Algorithms: 1. island_suppression_current: find coil currents that cancel ψ_mn at target surface 2. phase_control_current: find currents to rotate island phase by desired angle 3. multi_mode_control: optimize currents to suppress target while monitoring side effects

The “press-down-gourd” (按下葫芦起了瓢) problem: When suppressing mode (m1,n1), mode (m2,n2) may be amplified. Multi-mode control handles this by solving a constrained optimization.

Physics background#

The external coil system produces an additional perturbation δb_mn. The total resonant driving term at the q=m/n surface becomes:

b_mn_total = b_mn_natural + δb_mn(I_coil)

Suppression: find I_coil such that |b_mn_total| → 0. Phase control: find I_coil such that arg(b_mn_total) = desired_phase.

Functions#

compute_resonant_amplitude(→ complex)

Compute the (m,n) Fourier component of a perturbation field at a resonant surface.

island_suppression_current(→ Tuple[numpy.ndarray, dict])

Find external coil currents to suppress the (target_m, target_n) island.

phase_control_current(→ numpy.ndarray)

Find currents to shift the island chain phase by desired_phase_shift.

multi_mode_control(→ Tuple[numpy.ndarray, dict])

Optimize currents to suppress multiple modes simultaneously.

Module Contents#

pyna.toroidal.control.island_control.compute_resonant_amplitude(field_func_perturbation, S_res: float, m: int, n: int, equilibrium, n_theta: int = 64, n_phi: int = 64) complex[source]#

Compute the (m,n) Fourier component of a perturbation field at a resonant surface.

Integrates the normal (radial) component of the perturbation field along the q=m/n flux surface and extracts the (m,n) Fourier coefficient.

The resonant amplitude is:

b̃_mn = (1 / (2π)²) ∫₀²π ∫₀²π B_r(θ,φ) exp(-i(mθ - nφ)) dθ dφ

evaluated on the flux surface at r = r_res = sqrt(S_res) * r0.

Parameters:
  • field_func_perturbation (callable) – Function f(R, Z, phi) → (BR_pert, BZ_pert, BPhi_pert) giving the perturbation field at a point. For a CoilSet, use a wrapper that calls Biot_Savart_field.

  • S_res (float) – Normalised flux coordinate of the resonant surface (ψ_norm ∈ [0,1]).

  • m (int) – Poloidal and toroidal mode numbers.

  • n (int) – Poloidal and toroidal mode numbers.

  • equilibrium (SimpleStellarator) – The equilibrium object (provides R0, r0).

  • n_theta (int) – Number of integration points in each angle.

  • n_phi (int) – Number of integration points in each angle.

Returns:

complex – The complex amplitude b̃_mn = |b̃_mn| · exp(i·phase_mn).

pyna.toroidal.control.island_control.island_suppression_current(stellarator, control_coils, target_m: int, target_n: int, monitor_modes: List[Tuple[int, int]] | None = None, I_max: float = 10000.0, n_theta: int = 32, n_phi: int = 32) Tuple[numpy.ndarray, dict][source]#

Find external coil currents to suppress the (target_m, target_n) island.

pyna.toroidal.control.island_control.phase_control_current(stellarator, control_coils, target_m: int, target_n: int, desired_phase_shift: float, I_max: float = 10000.0, n_theta: int = 32, n_phi: int = 32) numpy.ndarray[source]#

Find currents to shift the island chain phase by desired_phase_shift.

pyna.toroidal.control.island_control.multi_mode_control(stellarator, control_coils, target_modes: List[Tuple[int, int]], weights: List[float] | None = None, I_max: float = 10000.0, n_theta: int = 32, n_phi: int = 32) Tuple[numpy.ndarray, dict][source]#

Optimize currents to suppress multiple modes simultaneously.