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, low_ram=False, quad=None, check=False, plot=False)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
integrandto account for imperfect computation of bounce points.- Parameters:
integrand (callable or list[callable]) – The composition operator on the set of functions in
datathat determinesfin ∫ f(ρ,α,λ,ℓ) dℓ. It should accept a dictionary which stores the interpolated data and the argumentsBandpitch.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 periodic functions in (θ, ζ) ∈ [0, 2π) × [0, 2π/NFP) evaluated on the
gridsupplied to construct this object. Use the methodBounce2D.reshapeto reshape the data into the expected shape.names (str or list[str]) – Names in
datato interpolate. Default is all keys indata.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 betweenz1andz2resides in the epigraph of B.num_well (int) – See
self.pointsfor the description of this parameter.nufft_eps (float) – Precision requested for interpolation with non-uniform fast Fourier transform (NUFFT). If less than
1e-14then NUFFT will not be used.is_fourier (bool) – If true, then it is assumed that
dataholds Fourier transforms as returned byBounce2D.fourier. Default is false.low_ram (bool) – Whether to use a more memory efficient algorithm. However, this is slower to differentiate with JAX. For best performance, one should only use this option if batching is already being done via
Bounce2D.batchwithsurf_batch_size=1.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
checkis 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.