desc.coils.SplineXYZCoil.compute_magnetic_field

SplineXYZCoil.compute_magnetic_field(coords, params=None, basis='rpz', grid=None)Source

Compute magnetic field at a set of points.

The coil current may be overridden by including current in the params dictionary.

Parameters:
  • coords (array-like shape(n,3) or Grid) – coordinates to evaluate field at [R,phi,Z] or [x,y,z]

  • params (dict, optional) – parameters to pass to curve

  • basis ({"rpz", "xyz"}) – basis for input coordinates and returned magnetic field

  • grid (Grid, int or None) – Grid used to discretize coil. If an integer, uses that many equally spaced points. Should NOT include endpoint at 2pi.

Returns:

field (ndarray, shape(n,3)) – magnetic field at specified points, in either rpz or xyz coordinates

Notes

Discretizes the coil into straight segments between grid points, and uses the Hanson-Hirshman expression for exact field from a straight segment. Convergence is approximately quadratic in the number of coil points.