calculate_vacuum_field

Function calculate_vacuum_field 

Source
pub fn calculate_vacuum_field(
    grid: &Grid2D,
    coils: &[CoilConfig],
    mu0: f64,
) -> FusionResult<Array2<f64>>
Expand description

Calculate vacuum magnetic flux from coils using the toroidal Green’s function.

For each coil at (Rc, Zc) with current I, the flux contribution is:

Ψ = (μ₀ I / 2π) · √((R + Rc)² + (Z - Zc)²) · ((2 - k²)K(k²) - 2E(k²)) / k²

where k² = 4 R Rc / ((R + Rc)² + (Z - Zc)²), clipped to [1e-9, 0.999999].

Returns Ψ_vacuum [nz, nr].