desc.magnetic_fields.FourierCurrentPotentialField
- class desc.magnetic_fields.FourierCurrentPotentialField(Phi_mn=array([0.]), modes_Phi=array([[0, 0]]), I=0, G=0, sym_Phi=False, M_Phi=None, N_Phi=None, R_lmn=None, Z_lmn=None, modes_R=None, modes_Z=None, NFP=1, sym='auto', M=None, N=None, name='', check_orientation=True)Source
Magnetic field due to a surface current potential on a toroidal surface.
Surface current K is assumed given by
K = n x ∇ Φ
Φ(θ,ζ) = Φₛᵥ(θ,ζ) + Gζ/2π + Iθ/2π
where:
n is the winding surface unit normal.
Phi is the current potential function, which is a function of theta and zeta, and is given as a secular linear term in theta/zeta and a double Fourier series in theta/zeta.
This function then uses biot-savart to find the B field from this current density K on the surface.
- Parameters:
Phi_mn (ndarray) – Fourier coefficients of the double FourierSeries part of the current potential.
modes_Phi (array-like, shape(k,2)) – Poloidal and Toroidal mode numbers corresponding to passed-in Phi_mn coefficients.
I (float) – Net current linking the plasma and the surface toroidally Denoted I in the algorithm
G (float) – Net current linking the plasma and the surface poloidally Denoted G in the algorithm NOTE: a negative G will tend to produce a positive toroidal magnetic field B in DESC, as in DESC the poloidal angle is taken to be positive and increasing when going in the clockwise direction, which with the convention n x grad(phi) will result in a toroidal field in the negative toroidal direction.
sym_Phi ({False,"cos","sin"}) – whether to enforce a given symmetry for the DoubleFourierSeries part of the current potential.
M_Phi (int or None) – Maximum poloidal and toroidal mode numbers for the single valued part of the current potential.
N_Phi (int or None) – Maximum poloidal and toroidal mode numbers for the single valued part of the current potential.
R_lmn (array-like, shape(k,)) – Fourier coefficients for winding surface R and Z in cylindrical coordinates
Z_lmn (array-like, shape(k,)) – Fourier coefficients for winding surface R and Z in cylindrical coordinates
modes_R (array-like, shape(k,2)) – poloidal and toroidal mode numbers [m,n] for R_lmn.
modes_Z (array-like, shape(k,2)) – mode numbers associated with Z_lmn, defaults to modes_R
NFP (int) – number of field periods
sym (bool) – whether to enforce stellarator symmetry for the surface geometry. Default is “auto” which enforces if modes are symmetric. If True, non-symmetric modes will be truncated.
M (int or None) – Maximum poloidal and toroidal mode numbers. Defaults to maximum from modes_R and modes_Z.
N (int or None) – Maximum poloidal and toroidal mode numbers. Defaults to maximum from modes_R and modes_Z.
name (str) – name for this field
check_orientation (bool) – ensure that this surface has a right handed orientation. Do not set to False unless you are sure the parameterization you have given is right handed (ie, e_theta x e_zeta points outward from the surface).
Methods
change_Phi_resolution
([M, N, NFP, sym_Phi])Change the maximum poloidal and toroidal resolution for Phi.
change_resolution
(*args, **kwargs)Change the maximum poloidal and 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.
constant_offset_surface
(offset[, grid, M, ...])Create a FourierRZSurface with constant offset from the base surface (self).
copy
([deepcopy])Return a (deep)copy of this object.
equiv
(other)Compare equivalence between DESC objects.
from_input_file
(path)Create a surface from Fourier coefficients in a DESC or VMEC input file.
from_qp_model
([major_radius, aspect_ratio, ...])Create a surface from a near-axis model for quasi-poloidal symmetry.
from_surface
(surface[, Phi_mn, modes_Phi, ...])Create FourierCurrentPotentialField using geometry of given surface.
from_values
(coords, theta[, zeta, M, N, ...])Create a surface from given R,Z coordinates in real space.
get_coeffs
(m[, 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.
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
(m[, n, R, Z])Set specific Fourier coefficients.
Convert a single array of concatenated parameters into a dictionary.
Attributes
Net current linking the plasma and the surface poloidally.
Net current linking the plasma and the surface toroidally.
Maximum radial mode number.
Maximum poloidal mode number.
Poloidal resolution of periodic part of Phi.
Maximum toroidal mode number.
Number of (toroidal) field periods.
Toroidal resolution of periodic part of Phi.
Spectral basis for Phi.
Fourier coefficients describing single-valued part of potential.
Spectral basis for R.
Spectral coefficients for R.
Spectral basis for Z.
Spectral coefficients for Z.
total number of optimizable parameters.
dictionary of integers of sizes of each optimizable parameter.
Name of the surface.
string names of parameters that have been declared optimizable.
dictionary of arrays of optimizable parameters.
Flux surface label.
Whether or not the surface is stellarator symmetric.
Type of symmetry of periodic part of Phi (no symmetry if False).
arrays of indices for each parameter in concatenated array.