Module source

Module source 

Source
Expand description

Nonlinear plasma source term for the Grad-Shafranov equation.

Port of fusion_kernel.py update_plasma_source_nonlinear() (lines 118-171). Computes J_phi using: J_phi = R · p’(ψ_norm) + (1/(μ₀R)) · FF’(ψ_norm) where ψ_norm = (Ψ - Ψ_axis) / (Ψ_boundary - Ψ_axis).

Structs§

ProfileParams
mTanh profile parameters used by inverse reconstruction.
SourceProfileContext
Context passed to profile-driven source update.

Functions§

mtanh_profile
mTanh profile: f(psi_n) = 0.5 * h * (1 + tanh(y)) + alpha * core(psi_n) y = (ped_top - psi_n) / ped_width core(psi_n) = max(0, 1 - (psi_n/ped_top)^2)
mtanh_profile_derivatives
Analytical derivatives of mTanh profile with respect to: [ped_height, ped_top, ped_width, core_alpha].
update_plasma_source_nonlinear
Update the toroidal current density J_phi using the full Grad-Shafranov source term.
update_plasma_source_with_profiles
Update toroidal current density using externally provided profile parameters.