desc.magnetic_fields.SplineMagneticField

class desc.magnetic_fields.SplineMagneticField(R, phi, Z, BR, Bphi, BZ, method='cubic', extrap=False, period=0)Source

Magnetic field from precomputed values on a grid.

Parameters:
  • R (array-like, size(NR)) – R coordinates where field is specified

  • phi (array-like, size(Nphi)) – phi coordinates where field is specified

  • Z (array-like, size(NZ)) – Z coordinates where field is specified

  • BR (array-like, shape(NR,Nphi,NZ)) – radial magnetic field on grid

  • Bphi (array-like, shape(NR,Nphi,NZ)) – toroidal magnetic field on grid

  • BZ (array-like, shape(NR,Nphi,NZ)) – vertical magnetic field on grid

  • method (str) – interpolation method

  • extrap (bool) – whether to extrapolate beyond the domain of known field values or return nan

  • period (float) – period in the toroidal direction (usually 2pi/NFP)

Methods

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.

from_field(field, R, phi, Z[, params, ...])

Create a splined magnetic field from another field for faster evaluation.

from_mgrid(mgrid_file[, extcur, method, ...])

Create a SplineMagneticField from an "mgrid" file from MAKEGRID.

load(load_from[, file_format])

Initialize from file.

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.