Process reference: coils_non_axisymmetric
Generated from the docstrings of vaft.process.coils_non_axisymmetric:
3 public functions. Each entry is what
vaft.process.describe("coils_non_axisymmetric.<name>") prints.
All process categories
Overview
The two operations every 3-D coil workflow repeats, on plain arrays, with the
sign conventions stated once. Geometry objects live in
vaft.machine_mapping.coils_non_axisymmetric_geometry; the IMAS mapper in
vaft.machine_mapping.coils_non_axisymmetric; the GPEC coil.in
serialization in vaft.code.gpec. Nothing here reads an ODS or knows
which machine the coils belong to.
toroidal_mode_decomposition– complex Fourier coefficient of a per-sector quantity (typically coil currents) for each toroidal mode number,C_n = <v_k exp(-i n phi_k)>.phased_sector_currents– the inverse: the per-sector currents of a single toroidal harmonic,I_k = A cos(n phi_k + delta).biot_savart_filaments– vacuum magnetic field of closed polyline filaments carrying given currents, at arbitrary probe points.
Functions
biot_savart_filaments | Vacuum magnetic field of closed polyline filaments at probe points. Convention |
phased_sector_currents | Per-sector currents of one toroidal harmonic. Convention |
toroidal_mode_decomposition | Complex toroidal Fourier coefficient of a per-sector quantity. Convention |
No function matches.
biot_savart_filaments
Machine-independentConvention-sensitive
source
biot_savart_filaments(points_xyz, currents_a, probes_xyz)
Vacuum magnetic field of closed polyline filaments at probe points.
| Name | Type | Unit | Description |
|---|---|---|---|
points_xyz | array_like | m | Filament vertices, shape |
currents_a | array_like | A | Current in each filament, positive along the vertex order, shape |
probes_xyz | array_like | m | Observation points, shape |
| Returns | |||
| — | np.ndarray | T | Cartesian field |
Convention
Right-handed Cartesian axes. Each straight segment contributes
mu0/(4 pi) I (dl x r) / |r|^3 with dl along the vertex order and
r from the segment midpoint to the probe (midpoint rule), so the
field is the one the right-hand rule assigns to a current flowing in the
vertex order. A coil traversed the other way, or a negative current,
flips the sign.
Raises
ValueErrorA filament is not closed, the number of currents differs from the number of filaments, or a probe coincides with a segment midpoint (the field is singular on the conductor).
Assumptions · Applicability · Limitations · Provenance
Assumptions
Filaments are thin (no conductor cross-section); the midpoint rule is second-order accurate in segment length.
Applicability
Machine-independent. Any set of polyline coils: RMP, error-field correction, PF coils sampled as polygons.
Limitations
Transient memory is O(S N) per filament (S segments, N
probes; two (N, S, 3) float arrays), whichever input form is used;
call in probe blocks when S * N reaches ~1e7.
Provenance
- J. D. Jackson, Classical Electrodynamics, 3rd ed., Sec. 5.2: the Biot-Savart law for a line current.
- The legacy implementation carried three copies of this midpoint-rule kernel, in
gpec_input_processor.pyandmast_u_input_convertor.py; this is the single replacement.
phased_sector_currents
Machine-independentConvention-sensitive
source
phased_sector_currents(phi_rad, n, phase_rad, amplitude_a)
Show source vaft/process/coils_non_axisymmetric.py, lines 101–146
def phased_sector_currents(phi_rad, n: int, phase_rad: float, amplitude_a: float) -> np.ndarray:
"""Per-sector currents of one toroidal harmonic.
Parameters
----------
phi_rad : array_like
Toroidal angle of each sector, IMAS ``phi``, shape ``(K,)`` [rad].
n : int
Toroidal mode number [-].
phase_rad : float
Phase ``delta`` of the pattern at ``phi = 0`` [rad].
amplitude_a : float
Peak sector current ``A`` [A].
Returns
-------
np.ndarray
``I_k`` for each sector, shape ``(K,)`` [A].
Raises
------
ValueError
``phi_rad`` is not one-dimensional or is empty.
Convention
----------
``I_k = A cos(n phi_k + delta)``: the pattern whose
:func:`toroidal_mode_decomposition` coefficient is
``C_n = (A/2) exp(+i delta)`` when the sectors resolve ``n``, so the two
functions are inverse to each other. Positive current flows along the
filament vertex order, as :func:`biot_savart_filaments` takes it.
Assumptions
-----------
A single harmonic with no ``n = 0`` offset; the sectors are driven in
phase with each other up to the stated pattern.
Applicability
-------------
Machine-independent. Any toroidal row of discrete coils phased as one
harmonic: RMP and error-field correction coils.
"""
phi = np.asarray(phi_rad, dtype=float)
if phi.ndim != 1 or phi.size == 0:
raise ValueError(f"phi_rad must be a non-empty one-dimensional array, got shape {phi.shape}")
return float(amplitude_a) * np.cos(int(n) * phi + float(phase_rad))Per-sector currents of one toroidal harmonic.
| Name | Type | Unit | Description |
|---|---|---|---|
phi_rad | array_like | rad | Toroidal angle of each sector, IMAS |
n | int | - | Toroidal mode number. |
phase_rad | float | rad | Phase |
amplitude_a | float | A | Peak sector current |
| Returns | |||
| — | np.ndarray | A |
|
Convention
I_k = A cos(n phi_k + delta): the pattern whose
toroidal_mode_decomposition coefficient is
C_n = (A/2) exp(+i delta) when the sectors resolve n, so the two
functions are inverse to each other. Positive current flows along the
filament vertex order, as biot_savart_filaments takes it.
Raises
ValueErrorphi_radis not one-dimensional or is empty.
Assumptions · Applicability
Assumptions
A single harmonic with no n = 0 offset; the sectors are driven in
phase with each other up to the stated pattern.
Applicability
Machine-independent. Any toroidal row of discrete coils phased as one harmonic: RMP and error-field correction coils.
toroidal_mode_decomposition
Machine-independentConvention-sensitive
source
toroidal_mode_decomposition(phi_rad, values, modes)
Show source vaft/process/coils_non_axisymmetric.py, lines 36–98
def toroidal_mode_decomposition(
phi_rad, values, modes: Iterable[int]
) -> Mapping[int, complex]:
"""Complex toroidal Fourier coefficient of a per-sector quantity.
Parameters
----------
phi_rad : array_like
Toroidal angle of each sector sample, any order, shape ``(K,)`` [rad].
values : array_like
The quantity at each sector, real or complex, shape ``(K,)``; coil
currents are the usual case [any].
modes : iterable of int
Toroidal mode numbers ``n`` to evaluate [-].
Returns
-------
dict[int, complex]
``C_n`` for each requested ``n``, in the units of ``values`` [any].
Raises
------
ValueError
``phi_rad`` and ``values`` differ in length, are not one-dimensional,
or are empty.
Convention
----------
``C_n = (1/K) sum_k v_k exp(-i n phi_k)``, the plain sample mean, so a
pattern ``v_k = A cos(n phi_k + delta)`` returns ``C_n = (A/2) exp(+i delta)``
when the sectors resolve ``n`` without aliasing: the peak amplitude is
``2 |C_n|`` and the phase of ``C_n`` is the pattern's phase ``delta`` at
``phi = 0``. The ``exp(-i n phi)`` kernel is the one GPEC's ``coil.in``
documentation and the legacy ``fourier_mode_coefficient`` use; a ``exp(+i n phi)`` convention conjugates every coefficient. No
normalisation by ``2/K`` is applied, so ``C_0`` is the mean.
Assumptions
-----------
Uniform weighting of the sectors. With ``K`` equally spaced sectors the
coefficients are exact for ``|n| < K/2``; with fewer or unevenly spaced
sectors they are the least-squares-free sample projection and alias.
Applicability
-------------
Machine-independent. Any toroidal array of discrete elements: RMP coil
rows, error-field correction coils, saddle loops.
Provenance
----------
.. [GPEC] GPEC ``coil.in`` documentation: per-coil currents are
combined per toroidal harmonic with ``exp(-i n phi)``.
.. [legacy] The legacy implementation's ``gpec_input_processor.py``
``fourier_mode_coefficient`` (same kernel), ported unchanged.
"""
phi = np.asarray(phi_rad, dtype=float)
v = np.asarray(values)
if phi.ndim != 1 or v.ndim != 1 or phi.shape != v.shape:
raise ValueError(
f"phi_rad and values must be one-dimensional and equal in length, got {phi.shape} and {v.shape}"
)
if phi.size == 0:
raise ValueError("at least one sector sample is required")
return {int(n): complex(np.mean(v * np.exp(-1j * int(n) * phi))) for n in modes}Complex toroidal Fourier coefficient of a per-sector quantity.
| Name | Type | Unit | Description |
|---|---|---|---|
phi_rad | array_like | rad | Toroidal angle of each sector sample, any order, shape |
values | array_like | any | The quantity at each sector, real or complex, shape |
modes | iterable of int | - | Toroidal mode numbers |
| Returns | |||
| — | dict[int, complex] | any |
|
Convention
C_n = (1/K) sum_k v_k exp(-i n phi_k), the plain sample mean, so a
pattern v_k = A cos(n phi_k + delta) returns C_n = (A/2) exp(+i delta)
when the sectors resolve n without aliasing: the peak amplitude is
2 |C_n| and the phase of C_n is the pattern’s phase delta at
phi = 0. The exp(-i n phi) kernel is the one GPEC’s coil.in
documentation and the legacy fourier_mode_coefficient use; a exp(+i n phi) convention conjugates every coefficient. No
normalisation by 2/K is applied, so C_0 is the mean.
Raises
ValueErrorphi_radandvaluesdiffer in length, are not one-dimensional, or are empty.
Assumptions · Applicability · Provenance
Assumptions
Uniform weighting of the sectors. With K equally spaced sectors the
coefficients are exact for |n| < K/2; with fewer or unevenly spaced
sectors they are the least-squares-free sample projection and alias.
Applicability
Machine-independent. Any toroidal array of discrete elements: RMP coil rows, error-field correction coils, saddle loops.
Provenance
- GPEC
coil.indocumentation: per-coil currents are combined per toroidal harmonic withexp(-i n phi). - The legacy implementation’s
gpec_input_processor.pyfourier_mode_coefficient(same kernel), ported unchanged.