DESC
DESC copied to clipboard
DESC surface from `CoilSet` for plasma to coil surface distance
I'm interested taking in an equilibrium and CoilSet and creating a map in toroidal and poloidal angle of the distance from the last closed magnetic surface to a surface fit to the CoilSet, for purposes of varying blanket/shield thickness in a parametric stellarator model for neutronics. I used PlasmaCoilSetDistanceBound, but this gives a single number for each coil. What might work better is using PlasmaVesselDistance, with the LCMS surface and a surface fit to the CoilSet. Is there an optimal way to create a surface fit to the CoilSet, similar to a winding surface, but from the CoilSet? I realize such a surface would be underconstrained, but some assumptions fitting assumptions could be useful enough.
An actual fit is possible, here is some code for doing it with a helical coilset (that is in the DESC tests/inputs folder) and the precise QA equilibrium. I used a polar theta for the surface poloidal angle, defined w.r.t the eq axis at each phi point I evaluated the coils at. This worked surprisingly (to me) well without any explicit regularization, but this also is a quite "easy:" case in that the coils are pretty obviously obtained from a winding surface originally. This should be a good starting point, maybe you would need to play around with the rcond of the fit for more complex cases to regularize it.
Here's the notebook that makes the below figures, you would just need to change the path to the helical coils to whatever the path is in your system to try it.
min distance from each coil to the fit surface:
Array([0.00088829, 0.00133764, 0.00160907, 0.00094796, 0.00081868,
0.00081858, 0.00120153, 0.00131117, 0.00087958, 0.00163103,
0.00085853, 0.00141516, 0.00077897, 0.0012206 , 0.00108789,
0.00146784], dtype=float64)
Another way (much slower) would be to do a nonlinear optimization of a surface with PlasmaCoilSetMinDistance with target=0, with an additional term in the cost to penalize a super jagged surface (and maybe also one to limit the volume, to avoid it ballooning out in between the coils).
Since the Fourier series describing a surface which goes through all the coils is probably quite high resolution, the best way of obtaining such a surface would be something using B-splines, or maybe an algorithm like described in the quadcoil paper (but modified for given coil curves), but this is not in DESC yet (I think @lankef is implementing this though but unsure if it is in DESC or just is through calls to QUADCOIL).