|
15 | 15 |
|
16 | 16 | from desc.backend import jax, jit, jnp |
17 | 17 | from desc.basis import DoubleFourierSeries |
| 18 | +from desc.coils import CoilSet, FourierPlanarCoil |
18 | 19 | from desc.compute.utils import get_params, get_transforms |
19 | 20 | from desc.examples import get |
20 | 21 | from desc.geometry import FourierRZToroidalSurface, FourierXYZCurve |
@@ -1212,6 +1213,31 @@ def test_field_line_integrate(self): |
1212 | 1213 | np.testing.assert_allclose(r[-1], 10, rtol=1e-6, atol=1e-6) |
1213 | 1214 | np.testing.assert_allclose(z[-1], 0.001, rtol=1e-6, atol=1e-6) |
1214 | 1215 |
|
| 1216 | + @pytest.mark.unit |
| 1217 | + def test_field_line_integrate_coil_bs_chunk(self): |
| 1218 | + """Test field line integration for coils with bs_chunk_size.""" |
| 1219 | + # Related to issue #2214 |
| 1220 | + # simple toroidal field |
| 1221 | + B0 = 1 |
| 1222 | + R0 = 4 |
| 1223 | + I = 2 * np.pi * B0 * R0 / mu_0 |
| 1224 | + field = CoilSet( |
| 1225 | + FourierPlanarCoil( |
| 1226 | + current=I, |
| 1227 | + center=[R0, 0, 0], |
| 1228 | + normal=[0, 1, 0], |
| 1229 | + r_n=R0 / 4, |
| 1230 | + ), |
| 1231 | + NFP=40, |
| 1232 | + check_intersection=False, |
| 1233 | + ) |
| 1234 | + r0 = [10.0] |
| 1235 | + z0 = [0.0] |
| 1236 | + phis = [0, np.pi] |
| 1237 | + r, z = field_line_integrate(r0, z0, phis, field, bs_chunk_size=1000) |
| 1238 | + np.testing.assert_allclose(r[-1], r0[0], rtol=1e-6, atol=1e-6) |
| 1239 | + np.testing.assert_allclose(z[-1], z0[0], rtol=1e-6, atol=1e-6) |
| 1240 | + |
1215 | 1241 | @pytest.mark.unit |
1216 | 1242 | def test_field_line_integrate_jax_transforms(self, capsys): |
1217 | 1243 | """Test field line integration is JAX transformable.""" |
|
0 commit comments