Model B: REGCOIL-like current potential

This model is the closest conceptual match to REGCOIL:

Instead of driving currents by injecting charge at points (electrodes), we represent the surface current as a divergence-free field generated by a current potential \(\Phi\) on the surface.

Divergence-free surface currents

On a smooth surface, a divergence-free surface current density can be written as:

\[ \mathbf K = \hat{\mathbf n} \times \nabla_s \Phi, \]

where \(\Phi(\theta,\phi)\) has units of Amperes. This representation automatically enforces:

\[ \nabla_s\cdot \mathbf K = 0. \]

This is the “current potential” framework used by REGCOIL and related coil-design formulations.

Net poloidal / toroidal currents and multi-valued \(\Phi\)

The current potential can contain secular (multi-valued) terms that correspond to net currents linking the torus:

\[ \Phi(\theta,\phi) = \Phi_{\mathrm{sv}}(\theta,\phi) + \frac{I_{\mathrm{tor}}}{2\pi}\,\theta + \frac{I_{\mathrm{pol}}}{2\pi}\,\phi, \]

where:

  • \(I_{\mathrm{pol}}\) is the net poloidal current [A] (sets a dominant toroidal \(1/R\) field scale via Ampère’s law)

  • \(I_{\mathrm{tor}}\) is the net toroidal current [A] (sets a dominant poloidal field component)

The derivatives are:

\[ \Phi_\theta = \partial_\theta \Phi_{\mathrm{sv}} + \frac{I_{\mathrm{tor}}}{2\pi},\qquad \Phi_\phi = \partial_\phi \Phi_{\mathrm{sv}} + \frac{I_{\mathrm{pol}}}{2\pi}. \]

Important

The secular terms \(\theta\) and \(\phi\) are discontinuous when wrapped to \([0,2\pi)\) (a sawtooth). Do not differentiate them with FFTs.

In torus-solver, the secular contributions are handled analytically by adding the constant derivatives shown above.

Implementation on the circular torus

For the circular torus, one convenient formula is:

\[ \mathbf K = \frac{\Phi_\theta\, \mathbf r_\phi - \Phi_\phi\, \mathbf r_\theta}{\sqrt{g}}, \]

which is equivalent to \(\hat{\mathbf n}\times \nabla_s \Phi\).

In the code:

  • src/torus_solver/current_potential.py

    • surface_current_from_current_potential(...) (single-valued \(\Phi\) only)

    • surface_current_from_current_potential_with_net_currents(...) (recommended)

Relation to REGCOIL

REGCOIL solves a regularized least-squares problem for \(\Phi\) on a coil surface, typically minimizing some norm of \(B_n\) on a plasma boundary (plus regularization in \(|K|^2\) or related measures). In this repository:

  • examples/inverse_design/optimize_vmec_surface_Bn.py implements an analogous idea on a circular torus coil surface using:

    • Fourier coefficients for \(\Phi_{\mathrm{sv}}\)

    • an objective based on normalized \(B_n/|B|\)

    • L-BFGS (from jaxopt) and JAX autodiff

This makes it easy to experiment with differentiable extensions (new objectives, constraints, and parameterizations) while remaining close to the REGCOIL viewpoint.