diff --git a/desc/integrals/singularities.py b/desc/integrals/singularities.py index 6e01dca1e..dca3e6184 100644 --- a/desc/integrals/singularities.py +++ b/desc/integrals/singularities.py @@ -1069,6 +1069,7 @@ def LHS(Phi_mn): return B +# FIXME: Need to interpolate Phi_mn to Phi_lmn to compute. def compute_dPhi_dn(eq, Phi_mn, Phi_trans): """Computes ∇Φ ⋅ n on ∂D. @@ -1090,11 +1091,13 @@ def compute_dPhi_dn(eq, Phi_mn, Phi_trans): """ Phi_trans.change_derivatives(1) + Phi_r = jnp.zeros(Phi_trans.grid.num_nodes) Phi_t = Phi_trans.transform(Phi_mn, dt=1) Phi_z = Phi_trans.transform(Phi_mn, dz=1) - data = eq.compute(["e^theta", "e^zeta", "n_rho"], grid=Phi_trans.grid) + data = eq.compute(["e^rho", "e^theta", "e^zeta", "n_rho"], grid=Phi_trans.grid) dPhi_dn = dot( - Phi_t[:, jnp.newaxis] * data["e^theta"] + Phi_r[:, jnp.newaxis] * data["e^rho"] + + Phi_t[:, jnp.newaxis] * data["e^theta"] + Phi_z[:, jnp.newaxis] * data["e^zeta"], data["n_rho"], ) diff --git a/tests/test_integrals.py b/tests/test_integrals.py index 154403e04..56d6d9a23 100644 --- a/tests/test_integrals.py +++ b/tests/test_integrals.py @@ -759,10 +759,7 @@ def test(G): contour = ax.contourf(theta, zeta, Bn) ax.set_title(r"$(\nabla \Phi + B_0) \cdot n$ on $\partial D$") fig.colorbar(contour, ax=ax) - # FIXME: Doesn't pass unless G = 0 for stellarators, indicating some bug - # in the computation of Phi_mn and hence the surface integrals. grad Phi - # is a periodic function, and Phi should be as well so Phi_mn should - # capture Phi. + # FIXME: Doesn't pass unless G = 0 for stellarators. try: np.testing.assert_allclose(B0n + dPhi_dn, 0, err_msg=f"G = {G}") except AssertionError as e: