Skip to content

Commit

Permalink
Fixing comment sign
Browse files Browse the repository at this point in the history
  • Loading branch information
unalmis committed Nov 13, 2024
1 parent ff15c0e commit e12bc2c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions desc/integrals/singularities.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def _kernel_biot_savart_A(eval_data, source_data, diag=False):


def _kernel_Bn_over_r(eval_data, source_data, diag=False):
# Bn / |r|
# B dot n' / |r|
source_x = jnp.atleast_2d(
rpz2xyz(jnp.array([source_data["R"], source_data["phi"], source_data["Z"]]).T)
)
Expand All @@ -727,7 +727,7 @@ def _kernel_Bn_over_r(eval_data, source_data, diag=False):


def _kernel_Phi_dG_dn(eval_data, source_data, diag=False):
# Phi * dG(x,x')/dn' = -Phi * n dot r / r^3 where Phi has units tesla-meters.
# Phi * dG(x,x')/dn' = -Phi * n' dot r / r^3 where Phi has units tesla-meters.
source_x = jnp.atleast_2d(
rpz2xyz(jnp.array([source_data["R"], source_data["phi"], source_data["Z"]]).T)
)
Expand All @@ -740,7 +740,7 @@ def _kernel_Phi_dG_dn(eval_data, source_data, diag=False):
dx = eval_x[:, None] - source_x[None]
n = rpz2xyz_vec(source_data["n_rho"], phi=source_data["phi"])
return safediv(
source_data["Phi"] * dot(n, dx, axis=-1),
-source_data["Phi"] * dot(n, dx, axis=-1),
safenorm(dx, axis=-1) ** 3,
)

Expand Down Expand Up @@ -960,7 +960,9 @@ def compute_B_laplace(eq, eval_grid, source_grid=None, B0=None, G=1, R0=1, sym="
source_data = eq.compute(data_keys, grid=source_grid)
if B0 is None:
B0 = ToroidalMagneticField(B0=G, R0=R0)
source_data["Bn"], _ = B0.compute_Bnormal(eq.surface, eval_grid=eval_grid)
source_data["Bn"], _ = B0.compute_Bnormal(
eq.surface, eval_grid=source_grid, source_grid=source_grid
)

basis = DoubleFourierSeries(M=eq.M, N=eq.N, NFP=eq.NFP, sym=sym)
trans_evl = Transform(eval_grid, basis)
Expand Down Expand Up @@ -1002,15 +1004,16 @@ def LHS(Phi_mn):
RHS = -singular_integral(
eval_data,
source_data,
_kernel_Bn_over_r,
_kernel_Bn_over_r, # flux surface assumption 𝐁₀ = βˆ’βˆ‡Ο•
interpolator,
loop=True,
).squeeze() / (2 * jnp.pi)
# Fourier coefficients of Ξ¦ on boundary
Phi_mn, _, _, _ = jnp.linalg.lstsq(A, RHS)

# 𝐁 - 𝐁₀ = βˆ‡Ξ¦ = 𝐁_vacuum in the interior. Note that Merkel eq. 3.5 has a different
# sign on the first integral compared to eq. 1.4... Rederive see which is correct.
# 𝐁 - 𝐁₀ = βˆ‡Ξ¦ = 𝐁_vacuum in the interior.
# Merkel eq. 1.4 is the Green's function solution to βˆ‡Β²Ξ¦ = 0 in the interior.
# Note that 𝐁₀′ in eq. 3.5 has the wrong sign.
grad_Phi = FourierCurrentPotentialField.from_surface(
eq.surface, Phi_mn / mu_0, basis.modes[:, 1:]
)
Expand Down

0 comments on commit e12bc2c

Please sign in to comment.