Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
unalmis committed Nov 25, 2024
1 parent 1151007 commit 9d69d47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 5 additions & 2 deletions desc/integrals/singularities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,7 @@ def LHS(Phi_mn):
return B

Check warning on line 1069 in desc/integrals/singularities.py

View check run for this annotation

Codecov / codecov/patch

desc/integrals/singularities.py#L1066-L1069

Added lines #L1066 - L1069 were not covered by tests


# FIXME: Need to interpolate Phi_mn to Phi_lmn to compute.
def compute_dPhi_dn(eq, Phi_mn, Phi_trans):
"""Computes ∇Φ ⋅ n on ∂D.
Expand All @@ -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"],
)
Expand Down
5 changes: 1 addition & 4 deletions tests/test_integrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9d69d47

Please sign in to comment.