desc.integrals.Bounce1D.integrate

Bounce1D.integrate(integrand, pitch_inv, data=None, names=None, points=None, *, num_well=None, method='cubic', quad=None, check=False, plot=False, **kwargs)Source

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

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

Warning

Make sure to replace √(1−λB) with √|1−λB| or clip the radicand to some value near machine precision when defining 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 ρ, 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 ρ, num α, num ζ). Real scalar-valued functions evaluated on the grid supplied to construct this object. Use the method Bounce1D.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 ρ, num α, 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.

  • method (str) – Method of interpolation. See https://interpax.readthedocs.io/en/latest/_api/interpax.interp1d.html. Default is cubic C1 local spline.

  • 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 ρ, num α, num pitch, num well). Last axis enumerates the bounce integrals for a given field line and pitch value.