pyna.toroidal.coils.coil_system#
External coil systems for stellarator island control.
Provides: - CoilSet: a collection of current-carrying coils - StellaratorControlCoils: standard external island control coil geometry - Biot_Savart_field: numerical Biot-Savart computation on a cylindrical grid
The Biot-Savart integration is parallelized over coils and grid points.
Attributes#
Classes#
Collection of coils with individual currents. |
|
Standard external island control coil array for a stellarator. |
|
Vacuum field from a numerically-defined coil via Biot-Savart law. |
Functions#
|
Compute magnetic field from a current-carrying coil via Biot-Savart. |
Module Contents#
- pyna.toroidal.coils.coil_system.Biot_Savart_field(coil_pts, coil_current, R_grid, Z_grid, Phi_grid=None)[source]#
Compute magnetic field from a current-carrying coil via Biot-Savart.
- Parameters:
coil_pts (ndarray, shape (N, 3)) – XYZ coordinates of coil points (meters).
coil_current (float) – Current in amperes (positive = right-hand rule along coil_pts direction).
R_grid (ndarray, shape (nR, nZ) or 1D) – Cylindrical coordinate grid.
Z_grid (ndarray, shape (nR, nZ) or 1D) – Cylindrical coordinate grid.
Phi_grid (ndarray or None) – If None, compute on the (R, Z) plane at phi=0. If provided, compute on the full 3D (R, Z, Phi) grid.
- Returns:
BR, BZ, BPhi (ndarray) – Field components on the grid (Tesla).
- class pyna.toroidal.coils.coil_system.CoilSet[source]#
Collection of coils with individual currents.
Each coil is defined by a list of 3D points (forming a closed loop).
- field_on_grid(R_1d, Z_1d, phi_1d=None, n_workers=None)[source]#
Compute total field from all coils on a cylindrical grid.
If phi_1d is None: compute on (R,Z) at phi=0. If phi_1d provided: full 3D computation (R, Z, Phi grid).
- Returns:
BR, BZ, BPhi (ndarray) – Shape (nR, nZ) if phi_1d is None, else (nR, nZ, nPhi).
- class pyna.toroidal.coils.coil_system.StellaratorControlCoils(R0, r_coil, N_coils, m_target, n_target, I0=1.0)[source]#
Bases:
CoilSetStandard external island control coil array for a stellarator.
Creates a set of saddle coils around the torus designed to produce a resonant (m_target, n_target) perturbation.
The coils are phased as I_k = I0 * cos(n_target * phi_k) to produce a dominant (m=0, n=n_target) or combined (m_target, n_target) response.
- Parameters:
R0 (float) – Major radius and coil minor radius (slightly outside plasma, m).
r_coil (float) – Major radius and coil minor radius (slightly outside plasma, m).
N_coils (int) – Total number of saddle coils around the torus.
m_target (int) – Target resonant mode to control.
n_target (int) – Target resonant mode to control.
I0 (float) – Reference current (A).
- class pyna.toroidal.coils.coil_system.CoilFieldBiotSavart(coil_pts: numpy.ndarray, current: float = 1.0)[source]#
Bases:
pyna.toroidal.coils.base.CoilFieldVacuumVacuum field from a numerically-defined coil via Biot-Savart law.
- Parameters:
- B_at(R, Z, phi)[source]#
Evaluate (B_R, B_Z, B_phi) at given coordinates.
- Parameters:
R (scalar or array-like, broadcast-compatible)
Z (scalar or array-like, broadcast-compatible)
phi (scalar or array-like, broadcast-compatible)
- Returns:
(BR, BZ, Bphi) (tuple of ndarray, same shape as broadcast(R, Z, phi))