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_filamentsVacuum magnetic field of closed polyline filaments at probe points. Convention
phased_sector_currentsPer-sector currents of one toroidal harmonic. Convention
toroidal_mode_decompositionComplex toroidal Fourier coefficient of a per-sector quantity. Convention

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.

NameTypeUnitDescription
points_xyzarray_likem

Filament vertices, shape (F, P, 3) or a sequence of F arrays (P_f, 3); each filament is traversed in vertex order and must be closed (first vertex equals last).

currents_aarray_likeA

Current in each filament, positive along the vertex order, shape (F,); multiply by the winding turns first when a filament stands for a multi-turn coil.

probes_xyzarray_likem

Observation points, shape (N, 3).

Returns
—np.ndarrayT

Cartesian field (B_x, B_y, B_z) at each probe, shape (N, 3).

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

  • ValueError A 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

  1. J. D. Jackson, Classical Electrodynamics, 3rd ed., Sec. 5.2: the Biot-Savart law for a line current.
  2. The legacy implementation carried three copies of this midpoint-rule kernel, in gpec_input_processor.py and mast_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.

NameTypeUnitDescription
phi_radarray_likerad

Toroidal angle of each sector, IMAS phi, shape (K,).

nint-

Toroidal mode number.

phase_radfloatrad

Phase delta of the pattern at phi = 0.

amplitude_afloatA

Peak sector current A.

Returns
—np.ndarrayA

I_k for each sector, shape (K,).

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

  • ValueError phi_rad is 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.

NameTypeUnitDescription
phi_radarray_likerad

Toroidal angle of each sector sample, any order, shape (K,).

valuesarray_likeany

The quantity at each sector, real or complex, shape (K,); coil currents are the usual case.

modesiterable of int-

Toroidal mode numbers n to evaluate.

Returns
—dict[int, complex]any

C_n for each requested n, in the units of values.

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

  • ValueError phi_rad and values differ 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

  1. GPEC coil.in documentation: per-coil currents are combined per toroidal harmonic with exp(-i n phi).
  2. The legacy implementation’s gpec_input_processor.py fourier_mode_coefficient (same kernel), ported unchanged.

results matching ""

    No results matching ""