This project implements the winding surface method of [1] for computing a sheet current that minimizes the squared flux on some surface,
min int_S (B * n)^2 dA.
The problem is posed as a linear least squares problem,
min_w |Hw - y|^2 + lambda * |w|^2,
which can be solved rapidly. The magnetic field generated by the (optimized) sheet current satisfies
curl(B) = 0 inside S,
div(B) = 0 inside S,
B * n ~ 0 on S.
The combination of the speed and robustness makes this an ideal method for finding vacuum magnetic fields tangent to a boundary.
[1]: Landreman, Matt. "An improved current potential method for fast computation of stellarator coil shapes." Nuclear Fusion 57.4 (2017): 046003.