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 the 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.
compute_magnetic_vector_potential(coords[, ...])Compute magnetic vector potential at a set of points.
copy([deepcopy])Return a (deep)copy of this object.
equiv(other)Compare equivalence between DESC objects.
flip([normal])Flip the curve about the plane with specified normal in X,Y,Z coordinates.
from_input_file(path, **kwargs)Create a axis curve from Fourier coefficients in a DESC or VMEC input file.
from_values(current, coords[, N, NFP, ...])Fit coordinates to FourierRZCoil representation.
get_coeffs(n)Get Fourier coefficients for given mode number(s).
load(load_from[, file_format])Initialize from file.
pack_params(p)Convert a dictionary of parameters into a single array.
rotate([axis, angle])Rotate the curve by a fixed angle about axis in X,Y,Z 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.
save_mgrid(path, Rmin, Rmax, Zmin, Zmax[, ...])Save the magnetic field to an mgrid NetCDF file in "raw" format.
set_coeffs(n[, R, Z])Set specific Fourier coefficients.
to_FourierPlanar([N, grid, basis, name])Convert Coil to FourierPlanarCoil representation.
to_FourierRZ([N, grid, NFP, sym, name])Convert Coil to FourierRZCoil representation.
to_FourierXY([N, grid, s, basis, name])Convert Coil to FourierXYCoil representation.
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 coordinates.
Convert a single array of concatenated parameters into a dictionary.
Attributes
Maximum mode number.
Number of field periods.
Spectral basis for R_Fourier series.
Spectral coefficients for R.
Spectral basis for Z_Fourier series.
Spectral coefficients for Z.
Current passing through the coil, in Amperes.
total number of optimizable parameters.
dictionary of integers of sizes of each optimizable parameter.
Name of the curve.
Number of coils.
string names of parameters that have been declared optimizable.
dictionary of arrays of optimizable parameters.
Rotation matrix of curve in X, Y, Z.
Displacement of curve in X, Y, Z.
Whether or not the curve is stellarator symmetric.
arrays of indices for each parameter in concatenated array.