desc.coils.FourierRZCoil

class desc.coils.FourierRZCoil(current=1, R_n=10, Z_n=0, modes_R=None, modes_Z=None, NFP=1, sym='auto', name='')Source

Coil parameterized by fourier series for R,Z in terms of toroidal angle phi.

Parameters:
  • current (float) – current through coil, in Amperes

  • R_n (array-like) – fourier coefficients for R, Z

  • Z_n (array-like) – fourier coefficients for R, Z

  • modes_R (array-like) – mode numbers associated with R_n. If not given defaults to [-n:n]

  • modes_Z (array-like) – mode numbers associated with Z_n, defaults to modes_R

  • NFP (int) – number of field periods

  • sym (bool) – whether to enforce stellarator symmetry

  • name (str) – name for this coil

Examples

from desc.coils import FourierRZCoil
from desc.grid import LinearGrid
import numpy as np

I = 10
mu0 = 4 * np.pi * 1e-7
R_coil = 10
# circular coil given by R(phi) = 10
coil = FourierRZCoil(
    current=I, R_n=R_coil, Z_n=0, modes_R=[0]
)
z0 = 10
field_evaluated = coil.compute_magnetic_field(
    np.array([[0, 0, 0], [0, 0, z0]]), basis="rpz"
)
np.testing.assert_allclose(
    field_evaluated[0, :], np.array([0, 0, mu0 * I / 2 / R_coil]), atol=1e-8
)
np.testing.assert_allclose(
    field_evaluated[1, :],
    np.array(
        [0, 0, mu0 * I / 2 * R_coil**2 / (R_coil**2 + z0**2) ** (3 / 2)]
    ),
    atol=1e-8,
)

Methods

change_resolution([N, NFP, sym])

Change the maximum toroidal resolution.

compute(names[, grid, params, transforms, ...])

Compute the quantity given by name on grid.

compute_Bnormal(surface[, eval_grid, ...])

Compute Bnormal from self on the given surface.

compute_magnetic_field(coords[, params, ...])

Compute magnetic field at a set of points.

copy([deepcopy])

Return a (deep)copy of this object.

eq(other)

Compare equivalence between DESC objects.

flip(normal)

Flip the curve about the plane with specified normal.

from_input_file(path)

Create a axis curve from Fourier coefficients in a DESC or VMEC input file.

get_coeffs(n)

Get Fourier coefficients for given mode number(s).

load(load_from[, file_format])

Initialize from file.

rotate([axis, angle])

Rotate the curve by a fixed angle about axis in xyz coordinates.

save(file_name[, file_format, file_mode])

Save the object.

save_BNORM_file(surface, fname[, basis_M, ...])

Create BNORM-style .txt file containing Bnormal Fourier coefficients.

set_coeffs(n[, R, Z])

Set specific Fourier coefficients.

to_FourierXYZ([N, grid, s, name])

Convert coil to FourierXYZCoil representation.

to_SplineXYZ([knots, grid, method, name])

Convert coil to SplineXYZCoil.

translate([displacement])

Translate the curve by a rigid displacement in x, y, z.

Attributes

N

Maximum mode number.

NFP

Number of field periods.

R_basis

Spectral basis for R_Fourier series.

R_n

Spectral coefficients for R.

Z_basis

Spectral basis for Z_Fourier series.

Z_n

Spectral coefficients for Z.

current

Current passing through the coil, in Amperes.

name

Name of the curve.

sym

Whether this curve has stellarator symmetry.