desc.magnetic_fields.SourceFreeField.compute

SourceFreeField.compute(names, grid, params=None, transforms=None, data=None, RpZ_data=None, RpZ_grid=None, override_grid=True, **kwargs)Source

Compute the quantity given by name on grid.

Parameters:
  • names (str or array-like of str) – Name(s) of the quantity(s) to compute.

  • grid (Grid) – Grid of coordinates on which to perform computation.

  • params (dict[str, jnp.ndarray]) – Parameters from the equilibrium, such as R_lmn, Z_lmn, i_l, p_l, etc Defaults to attributes of self.

  • transforms (dict of Transform) – Transforms for R, Z, lambda, etc. Default is to build from grid.

  • data (dict[str, jnp.ndarray]) – Data computed so far, generally output from other compute functions. Any vector v = v¹ R̂ + v² ϕ̂ + v³ Ẑ should be given in components v = [v¹, v², v³] where R̂, ϕ̂, Ẑ are the normalized basis vectors of the cylindrical coordinates R, ϕ, Z.

  • RpZ_data (dict[str, jnp.ndarray]) – Data evaluated so far on the (R, ϕ, Z) coordinates in this dictionary. Should store the three entries "R", "phi", and "Z" if the intention is to compute something at these coordinates. If not given, then computes from RpZ_grid.

  • RpZ_grid (Grid) – Grid of coordinates on which to evaluate quantities that support evaluation off of grid. If not given, then default is grid.

  • override_grid (bool) – If True, override grid if necessary and use a full resolution grid to compute quantities and then downsample to grid. If False, uses only grid, which may lead to inaccurate values for surface or volume averages.

Returns:

  • data (dict[str, jnp.ndarray]) – Quantities and intermediate variables computed on grid.

  • RpZ_data (dict[str, jnp.ndarray]) – Quantities and intermediate variables computed on the (R, ϕ, Z) coordinates in RpZ_data.