desc.integrals.Bounce2D.integrate

Bounce2D.integrate(integrand, pitch_inv, data=None, names=None, points=None, *, num_well=None, nufft_eps=1e-06, is_fourier=False, quad=None, check=False, plot=False)Source

Bounce integrate ∫ f(ρ,α,λ,ℓ) dℓ.

Computes the bounce integral ∫ f(ρ,α,λ,ℓ) dℓ for every field line and pitch.

Notes

Make sure to replace √(1−λB) with √|1−λB| in integrand to account for imperfect computation of bounce points.

Parameters:
  • integrand (callable or list[callable]) – The composition operator on the set of functions in data that determines f in ∫ f(ρ,α,λ,ℓ) dℓ. It should accept a dictionary which stores the interpolated data and the arguments B and pitch.

  • pitch_inv (jnp.ndarray) – Shape (num rho, num pitch). 1/λ values to compute the bounce integrals. 1/λ(ρ) is specified by pitch_inv[ρ] where in the latter the labels are interpreted as the indices that correspond to that field line.

  • data (dict[str, jnp.ndarray]) – Shape (num rho, num zeta, num theta). Real scalar-valued periodic functions in (θ, ζ) ∈ [0, 2π) × [0, 2π/NFP) evaluated on the grid supplied to construct this object. Use the method Bounce2D.reshape to reshape the data into the expected shape.

  • names (str or list[str]) – Names in data to interpolate. Default is all keys in data.

  • points (tuple[jnp.ndarray]) – Shape (num rho, num alpha, num pitch, num well). Optional, output of method self.points. Tuple of length two (z1, z2) that stores ζ coordinates of bounce points. The points are ordered and grouped such that the straight line path between z1 and z2 resides in the epigraph of B.

  • num_well (int or None) – See self.points for the description of this parameter.

  • nufft_eps (float) – Precision requested for interpolation with non-uniform fast Fourier transform (NUFFT). If less than 1e-14 then NUFFT will not be used.

  • is_fourier (bool) – If true, then it is assumed that data holds Fourier transforms as returned by Bounce2D.fourier. Default is false.

  • quad (tuple[jnp.ndarray]) – Optional quadrature points and weights. If given this overrides the quadrature chosen when this object was made.

  • check (bool) – Flag for debugging. Must be false for JAX transformations.

  • plot (bool) – Whether to plot the quantities in the integrand interpolated to the quadrature points of each integral. Ignored if check is false.

Returns:

result (jnp.ndarray or list[jnp.ndarray]) – Shape (num rho, num alpha, num pitch, num well). Last axis enumerates the bounce integrals for a given field line and pitch value.