Skip to content

Commit

Permalink
added a couple more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgiuliani committed Apr 18, 2024
1 parent cdebaf3 commit fddc130
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/geo/test_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,28 @@ def test_xyzhelical_symmetries(self):
print(R@out[0], out[1])
assert np.linalg.norm(out[1]-R@out[0])<1e-15

# does the stellarator symmetric curve indeed pass through (x0, 0, 0)?
curve = self.get_curvexyzhelical(stellsym=True, nfp=nfp, x = np.array([0]))
out = curve.gamma()
assert out[0, 0] !=0
assert out[0, 1] == 0
assert out[0, 2] == 0


# does the non-stellarator symmetric curve not pass through (x0, 0, 0)?
curve = self.get_curvexyzhelical(stellsym=False, nfp=nfp, x = np.array([0]))
out = curve.gamma()
assert out[0, 0] !=0
assert out[0, 1] != 0
assert out[0, 2] != 0

# is the stellarator symmetric curve actually stellarator symmetric?
curve = self.get_curvexyzhelical(stellsym=True, nfp=nfp, x = np.array([0.123, -0.123]))
pts = curve.gamma()
assert np.abs(pts[0, 0]-pts[1, 0]) <1e-15
assert np.abs(pts[0, 1]+pts[1, 1]) <1e-15
assert np.abs(pts[0, 2]+pts[1, 2]) <1e-15


# is the field from the stellarator symmetric curve actually stellarator symmetric?
from simsopt.field import BiotSavart, Current, Coil
curve = self.get_curvexyzhelical(stellsym=True, nfp=nfp, x=np.linspace(0, 1, 200, endpoint=False))
Expand Down

0 comments on commit fddc130

Please sign in to comment.