torus_solver.sources

torus_solver.sources.deposit_current_sources(surface, *, theta_src, phi_src, currents, sigma_theta, sigma_phi)[source]

Deposit smooth current source/sink density s(θ,φ) (A/m^2) onto the surface grid.

Each source i injects a total current currents[i] distributed by a periodic Gaussian kernel in (θ, φ), normalized so that ∫ s dA = Σ currents.

For magnetostatics, net injected current must be zero. This routine enforces a zero area-mean source density numerically.

Return type:

Array

Parameters:
  • surface (TorusSurface)

  • theta_src (Array)

  • phi_src (Array)

  • currents (Array)

  • sigma_theta (float)

  • sigma_phi (float)

torus_solver.sources.wrap_angle(x)[source]

Wrap angles to (-π, π] in a JAX-differentiable way.

Return type:

Array

Parameters:

x (Array)