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:
- Normalize flux: ψ_norm = (Ψ - Ψ_axis) / (Ψ_boundary - Ψ_axis)
- Define profile shape: f(ψ_norm) = (1 - ψ_norm) inside plasma (0 ≤ ψ_norm < 1)
- Pressure term: J_p = R · f(ψ_norm)
- Current term: J_f = (1/(μ₀R)) · f(ψ_norm)
- Mix: J_raw = β_mix · J_p + (1 - β_mix) · J_f
- Renormalize: scale J_raw so that ∫J_phi dR dZ = I_target
Returns the updated J_phi [nz, nr].