Skip to content

Commit

Permalink
Fix math comment
Browse files Browse the repository at this point in the history
  • Loading branch information
unalmis committed Dec 19, 2024
1 parent 274352c commit 4097aa8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion desc/compute/_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _epsilon_32_1D(params, transforms, profiles, data, **kwargs):
)

def eps_32(data):

Check warning on line 123 in desc/compute/_deprecated.py

View check run for this annotation

Codecov / codecov/patch

desc/compute/_deprecated.py#L123

Added line #L123 was not covered by tests
"""(∂ψ/∂ρ)⁻² B₀⁻² ∫ dλ λ⁻² ∑ⱼ Hⱼ²/Iⱼ."""
"""(∂ψ/∂ρ)⁻² B₀⁻³ ∫ dλ λ⁻² ∑ⱼ Hⱼ²/Iⱼ."""
# B₀ has units of λ⁻¹.
# Nemov's ∑ⱼ Hⱼ²/Iⱼ = (∂ψ/∂ρ)² (λB₀)³ ``(H**2 / I).sum(axis=-1)``.
# (λB₀)³ d(λB₀)⁻¹ = B₀² λ³ d(λ⁻¹) = -B₀² λ dλ.
Expand Down
6 changes: 3 additions & 3 deletions desc/compute/_neoclassical.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from desc.backend import imap, jit, jnp

from ..batching import _chunk_vmapped_function
from ..batching import _eval_fun_in_chunks
from ..integrals.bounce_integral import Bounce2D
from ..integrals.quad_utils import chebgauss2
from ..utils import safediv
Expand Down Expand Up @@ -121,7 +121,7 @@ def _foreach_pitch(fun, pitch_inv, batch_size):
fun(pitch_inv)
if (batch_size is None or batch_size >= (pitch_inv.size - 1))
# else imap(fun, pitch_inv, batch_size=batch_size).squeeze(axis=-1) # noqa: E800
else _chunk_vmapped_function(fun, chunk_size=batch_size)(pitch_inv)
else _eval_fun_in_chunks(fun, batch_size, (0,), pitch_inv)
)


Expand Down Expand Up @@ -199,7 +199,7 @@ def _epsilon_32(params, transforms, profiles, data, **kwargs):
)

def eps_32(data):
"""(∂ψ/∂ρ)⁻² B₀⁻² ∫ dλ λ⁻² ∑ⱼ Hⱼ²/Iⱼ."""
"""(∂ψ/∂ρ)⁻² B₀⁻³ ∫ dλ λ⁻² ∑ⱼ Hⱼ²/Iⱼ."""
# B₀ has units of λ⁻¹.
# Nemov's ∑ⱼ Hⱼ²/Iⱼ = (∂ψ/∂ρ)² (λB₀)³ ``(H**2 / I).sum(axis=-1)``.
# (λB₀)³ d(λB₀)⁻¹ = B₀² λ³ d(λ⁻¹) = -B₀² λ dλ.
Expand Down
12 changes: 3 additions & 9 deletions desc/integrals/bounce_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,9 +1045,10 @@ def __init__(
# Compute local splines.
# Note it is simple to do FFT across field line axis, and spline
# Fourier coefficients across ζ to obtain Fourier-CubicSpline of functions.
# The point of Bounce2D is to do such a 2D interpolation but also do so
# without rebuilding DESC transforms each time an objective is computed.
# The point of Bounce2D is to do such a 2D interpolation without
# rebuilding DESC transforms each time an objective is computed.
self._zeta = grid.compress(grid.nodes[:, 2], surface_label="zeta")
# Shape is (num alpha, num rho, N - 1, -1).
self._B = jnp.moveaxis(
CubicHermiteSpline(
x=self._zeta,
Expand All @@ -1059,13 +1060,6 @@ def __init__(
source=(0, 1),
destination=(-1, -2),
)
# Shape (num alpha, num rho, N - 1, -1).
# Polynomial coefficients of the spline of |B| in local power basis.
# Last axis enumerates the coefficients of power series. For a polynomial
# given by ∑ᵢⁿ cᵢ xⁱ, coefficient cᵢ is stored at ``B[...,n-i]``.
# Third axis enumerates the polynomials that compose a particular spline.
# Second axis enumerates flux surfaces.
# First axis enumerates field lines of a particular flux surface.
self._dB_dz = polyder_vec(self._B)

@staticmethod
Expand Down

0 comments on commit 4097aa8

Please sign in to comment.