Cbs/curvealongz
I wanted to add a toroidal field to a configuration, because I just wanted to jiggle the rotational transform a bit without too much ado. That would be nice with a straight coil along the z-axis, so I coded it up using the JaxCurve.
(Yes upon writing this PR I see that ToroidalBfield exists, but it does not allow one to shift the location of the curve along Z (playing with a 1/1 component), or optimize with it).
Think this might be useful for others, @krystophny has mentioned wanting to do something similar but resorting to using very large radius coils.
Some of the unittests are failing, mostly because the curve is not curved, and the evaluation of Kappa and it's derivatives fail. In that regard, what would be the best fix?
- overload the
kappa,torsionetc functions and their derivatives in theCurveAlongZclass with a default choice. - adapt the base
Curvemethods of evaluation ofkappa,torsionetc and their derivatives to deal with straight sections.
option 1 would work, but lead to code repitition if other curves with straight sections are implemented
option 2 could lead to unneccesary computational overhead if every field evaluation nans need to be replaced
@andrewgiuliani @florianwechsung, any suggestions as to the best approach?
@smiet I opt for option 1. There will be no code duplication if you extract the required functionality into lower level functions that are used by several classes. Performance and simplicity of class hierarchy are higher priority than implementation details in special cases. Can you add that?