Closed andrewgiuliani closed 2 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 91.60%. Comparing base (
d830719
) to head (6841058
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Here is a small generalization you could consider: in the transformation from
\hat{x},\hat{y}
tox,y
, the angle in the rotation matrix could be multiplied by some integer. This would allow for curves for which you need to go around multiple times toroidally before they close. Not critical, just an idea.
sounds like a good idea, I'll add this to the PR in the coming days.
I've introduced support for curves to wrap toroidally ntor
times before biting its tail. This allows us to represent some more interesting curves with nfp
-fold discrete rotational symmetry that pass ntor
times toroidally before biting their tail. In addition to helical coils, we can now represent knots such as a trefoil:
This trefoil has nfp=3
and ntor=2
. I've added a unit test to verify this in geo.test_curve.Testing.test_trefoil_stellsym
and geo.test_curve.Testing.test_trefoil_nonstellsym
.
A few things to note:
Since this is a much larger class of curves, i.e., not just helical curves, I've renamed the class to be CurveXYZFourierSymmetries
, reflecting that the class has symmetries baked in (rotational and stellarator symmetries), that CurveXYZFourier
does not.
Note that ntor
and nfp
must be coprime, or else the actual nfp
of the curve is nfp//gcd(nfp,ntor)
and the actual ntor
of the curve is ntor//gcd(nfp, ntor)
. To avoid confusion, we assert that gcd(nfp, ntor)=1
at instantiation of the class.
When ntor=1
the usual relation showing rotational symmetry holds, i.e. gamma(theta + 1/nfp) = R(1/nfp) * gamma(theta)
, where R(alpha)
is a rotation matrix. When ntor>1
, a more general relation holds gamma(theta + 1/nfp) = R(ntor/nfp) * gamma(theta)
. This still results in a curve with nfp
-fold discrete rotational symmetry.
This pull request introduces a new helical curve representation called
CurveXYZHelical
. This curve is different fromCurveXYZFourier
because it can have discrete rotational symmetry. It can also be stellarator symmetric, or not.We currently support a helical curve representation
CurveHelical
, but this curve is restricted to lie on a torus. The newCurveXYZHelical
is not restricted to lie on a torus, and can represent curves like the one below. Viewing from above, theCurveXYZHelical
appears to lie on a torusbut profile view reveals that it clearly does not:
When
CurveXYZHelical
is stellarator symmetric, then necessarily the curve must pass through the point(x0, 0, 0)
. If you do not want this, then the user can apply stellarator symmetry to a non-stellarator symmetricCurveXYZHelical
curve and obtain a stellsym magnetic field from those two curves.