update_plasma_source_nonlinear

Function update_plasma_source_nonlinear 

Source
pub fn update_plasma_source_nonlinear(
    psi: &Array2<f64>,
    grid: &Grid2D,
    psi_axis: f64,
    psi_boundary: f64,
    mu0: f64,
    i_target: f64,
) -> FusionResult<Array2<f64>>
Expand description

Update the toroidal current density J_phi using the full Grad-Shafranov source term.

Algorithm:

  1. Normalize flux: ψ_norm = (Ψ - Ψ_axis) / (Ψ_boundary - Ψ_axis)
  2. Define profile shape: f(ψ_norm) = (1 - ψ_norm) inside plasma (0 ≤ ψ_norm < 1)
  3. Pressure term: J_p = R · f(ψ_norm)
  4. Current term: J_f = (1/(μ₀R)) · f(ψ_norm)
  5. Mix: J_raw = β_mix · J_p + (1 - β_mix) · J_f
  6. Renormalize: scale J_raw so that ∫J_phi dR dZ = I_target

Returns the updated J_phi [nz, nr].