Formula reference: equilibrium
This page is generated from the docstrings of
vaft/formula/equilibrium.py:
96 public functions. The category overview and notation come from the module
docstring; every entry below is what vaft.formula.describe("equilibrium.<name>") prints.
Back to the formula reference index.
Overview
This module provides functions for calculating various plasma equilibrium parameters including poloidal flux, toroidal flux, safety factor, current, energy, and geometry.
| Symbol | Meaning | Unit |
|---|---|---|
| ψ | poloidal magnetic flux | [Wb] or [Wb/rad], per COCOS |
| ψ_a | ψ at magnetic axis | (same convention as ψ) |
| ψ_b | ψ at plasma boundary | (same convention as ψ) |
| Φ(ψ) | toroidal flux through surface C(ψ) | Wb |
| Φ_b | Φ(ψ_b) | Wb |
| ρ_N | normalised minor-radius (0 at axis, 1 at edge) | |
| q | safety factor | - |
| j | current density | A/m² |
| I_p | plasma current | A |
| W | stored energy | J |
| V | plasma volume | m³ |
| κ | elongation | - |
| δ | triangularity | - |
Functions
alpha_heating_power_from_n_D_n_T_T_keV_V— D-T alpha heating power with the rough $\langle\sigma v\rangle \propto T^2$ fit.approximated_diamagnetism_from_B_pa_B_tv_R0_delta_phi— Diamagnetic parameter from the vacuum toroidal field and flux change.aspect_ratio_from_a_R— Aspect ratio $A = R/a = 1/\varepsilon$.auxiliary_heating_power— Split auxiliary power into heating and current-drive parts.beta_normal_from_beta_tor— Normalized beta (Troyon) from toroidal beta, minor radius, field and current.beta_poloidal_from_circumference— Poloidal beta in the EFIT/OMFIT convention, normalized by the LCFS circumference.beta_poloidal_from_pressure_integral— Poloidal beta in the IMAS definition, from the pressure volume integral.beta_t_from_n_T_B— Toroidal beta from density, temperature and field.beta_toroidal_from_p_B0— Toroidal beta from the volume-averaged pressure and the vacuum field.bootstrap_current_fraction— Heuristic bootstrap-current fraction $f_{BS}$.bremsstrahlung_power_density_from_T_e_p_Z_eff— Bremsstrahlung power density in the pressure form.bremsstrahlung_power_density_from_Z_eff_n_e_T_e— Maxwellian free-free (bremsstrahlung) power density from first principles.bremsstrahlung_radiation_power_from_z_eff_n_e_t_e— Bremsstrahlung power density, NRL engineering form.calc_inverse_aspect_ratio— Inverse aspect ratio $\varepsilon = a/R_{geo}$ with input validation.check_kadomtsev_constraint— Whether engineering exponents satisfy the Kadomtsev constraint within a tolerance.confinement_factor_ITER89P— Confinement enhancement factor $H_{89}$ relative to ITER89P.confinement_time_from_P_loss_W_th— Energy confinement time as stored energy over loss power.confinement_time_from_engineering_parameters— Thermal energy confinement time from an engineering-parameter scaling law.coulomb_logarithm_from_n_T— Coulomb logarithm $\ln\Lambda$ for electron collisions above 10 eV.current_density_from_B— Toroidal current density from the radial derivative of a poloidal field.current_density_from_psi— Radial-derivative current-density estimate from a poloidal flux cut.current_drive_efficiency— Heuristic lower-hybrid current-drive efficiency $\eta_{CD}$.current_limit_from_beta— Current figure obtained by substituting $\beta_N$ for $q$ in the cylindrical relation.current_limit_from_q— Plasma current at a prescribed edge safety factor, cylindrical approximation.cyclotron_synchrotron_power_density_scaling_from_n_e_B_t_T_e— Classical electron-cyclotron emission power density, no reabsorption.cylindrical_safety_factor_from_R_B_epsilon_I_f_kappa_delta— Cylindrical safety factor with a shape function.dimensionless_scaling_coeffs_from_engineering_scaling_coeffs— Dimensionless scaling indices $(\mu_\rho, \mu_\beta, \mu_\nu)$ from engineering exponents.eK_from_K— Elongation parameter $e_K$ of the virial relations.ec_heating_power_from_I_ec_V_ec— Electron-cyclotron launched power $P_{ec} = I_{ec}V_{ec}$.elongation_from_RZ_boundary— Boundary elongation $\kappa$ from the extremal points of a contour.exact_volume_from_RZ_contour— Plasma volume from a closed $(R, Z)$ contour by Green’s theorem.heating_power_from_p_ohm_p_aux— Total heating power $P_{heat} = P_{ohm} + P_{aux}$.inductive_voltage_from_dW_magdt_I_p— Inductive voltage from the rate of change of magnetic energy.inverse_aspect_ratio_from_a_R— Inverse aspect ratio $\varepsilon = a/R$.kadomtsev_constraint_from_engineering_exponents— Residual of the Kadomtsev high-beta constraint on engineering exponents.kinetic_energy_from_beta_p_B_pa_V_p— Thermal energy from poloidal beta, $W_K = \tfrac{3}{2}\,\beta_p B_{pa}^2 V_p/(2\mu_0)$.kink_safety_factor— Kink safety factor $q_*$ with the Freidberg beta and current limits.li_3_from_Bp2_volume_integral— Internal inductance in the IMASli_3definition, from the poloidal-field energy.line_to_volume_avg_density— Volume-averaged density from a line average with a fixed profile factor.loop_voltage_from_total_flux— Surface loop voltage from the time series of boundary flux.loss_power_from_p_heat_dWdt_p_rad— Loss power $P_{loss} = P_{heat} - dW/dt - P_{rad}$.magnetic_energy_from_li_B_pa_V_p— Poloidal magnetic energy from the internal inductance, $W_M = l_i B_{pa}^2 V_p/(2\mu_0)$.nbi_heating_power_from_I_nbi_V_nbi— Neutral-beam injected power $P_{nbi} = I_{nbi}V_{nbi}$.normalize_psi— Deprecated: usepsi_normalised.normalized_collisionality_from_a_n_q_epsilon_T— Collisionality scaling form $\nu_* \propto a\,n\,q/(\varepsilon^{5/2}T^2)$.normalized_collisionality_from_nu_ii_T_i_M_i_R_a_q— Ion collisionality $\nu_*$ from a collision frequency.normalized_larmor_radius_from_M_T_a_Bt— Normalised ion gyroradius $\rho_* = \rho_i/a$ in SI inputs.normalized_plasma_current— Normalised plasma current $I_N = I_p/(a B_t)$ in MA/(m T).nu_star_from_n_T_B_R_epsilon_kappa_I— Normalised collisionality $\nu_*$ in the Verdoolaege engineering form.ohmic_heating_power_from_I_p_V_res— Ohmic heating power $P_{ohm} = I_pV_{res}$.omega_i_tau_E_from_B_tau_E_M— Ion-cyclotron-normalised confinement time $\Omega_i\tau_E$.peaking_factor— Profile peaking factor, central value over volume average.phi_from_Bphi— Toroidal flux $\Phi$ through a poloidal cross-section.poloidal_field_factor— Sauter Eq. 20 prefactor $k = \sigma_{R\varphi Z}\,\sigma_{B_p}/(2\pi)^{e_{B_p}}$.psi_from_RBtheta— Poloidal flux $\psi$ from a line integral of $R B_\theta$ across flux surfaces.psi_normalised— Normalised poloidal flux $\psi_N$.q_cyl_from_B_R_epsilon_kappa_I— Cylindrical safety factor in the Verdoolaege convention.q_from_phi— Safety factor $q$ as the flux derivative $d\Phi/d\psi$.q_from_rhoN— Safety factor from the toroidal-flux label $\rho_N(\psi_N)$.radial_magnetic_field_from_psi— Radial magnetic field $B_R$ from the poloidal flux map.rhoN_from_phi— Normalised toroidal-flux radius $\rho_N$.rhoN_from_qpsiN— Normalised toroidal-flux radius from the $q$ profile.rho_star_from_M_T_B_R_epsilon— Normalised ion gyroradius $\rho_*$ in the Verdoolaege engineering form.rho_tor_from_phi—Dimensional toroidal-flux radius $\rho_{tor} = \sqrt{ \Phi /(\pi B_0 )}$. shear_from_r_q— Magnetic shear $s$ of the safety-factor profile.spitzer_resistivity_from_T_e_Z_eff_ln_Lambda— Spitzer parallel resistivity $\eta_\parallel$.stored_energy_from_beta_V— Stored energy from toroidal beta, $W = \beta B_0^2 V/(2\mu_0)$.stored_energy_from_p_V— Stored energy as pressure times volume, $W = pV$.surface_poloidal_flux_from_psi_boundary— Total poloidal flux at the plasma surface, $\Phi_{surface} = 2\pi\psi_b$.toroidal_flux_from_q_psi— Cumulative toroidal flux $\Phi(\psi)$ from the $q$ profile on a full-weber grid.triangularity_from_RZ_boundary— Boundary triangularity $\delta$ from the midplane intersection.verify_kadomtsev_constraint— Reconstruct the Kadomtsev constraint value from dimensionless indices.vertical_magnetic_field_from_psi— Vertical magnetic field $B_Z$ from the poloidal flux map.virial_D0_boundary_from_bp_li_eK— Boundary Shafranov shift $D_0(b)$ from $\beta_p$, $l_i$ and elongation.virial_S1_approx— Leading-order value of the first Shafranov integral, $S_1 = 2$.virial_S2_approx_from_D0_a_R0— Analytic approximation of the second Shafranov integral for an elongated boundary.virial_S3_approx_from_eK_d— Analytic approximation of the third Shafranov integral for an elongated boundary.virial_beta_p_from_S_alpha_mu— Poloidal beta from the Shafranov integrals, low-aspect-ratio closure.virial_beta_p_from_S_li— Poloidal beta from $S_1$, $S_2$ and a known internal inductance.virial_beta_p_from_volume— Poloidal beta from a volume integral of pressure.virial_beta_p_lao_from_S_mu_rt— Poloidal beta, Lao large-aspect-ratio virial closure.virial_beta_p_li_from_S_alpha_mu_rt— Lao closure bundle: $\beta_p$, $l_i$ and $\beta_{p,d}$ in one call.virial_beta_pd_from_S_mu_rt— Diamagnetic poloidal beta $\beta_{p,d}$ from $S_1$, $S_2$ and $\mu_i$.virial_bongard_from_S_alpha_mu— Low-aspect-ratio virial closure (Bongard 2016): $\beta_p$ and $l_i$.virial_bp_li_lihat_from_S123— Solve the three virial relations for $\beta_p$, $l_i$ and $\hat l_i$.virial_kinetic_energy— Bulk kinetic energy of a sampled flow, $W_{kin} = \tfrac{1}{2}\sum n m v^2\,V$.virial_lao_from_S_alpha_mu_rt— Large-aspect-ratio virial closure (Lao 1985): $\beta_p$ and $l_i$.virial_li_from_S_alpha_mu— Internal inductance from the Shafranov integrals, low-aspect-ratio closure.virial_li_from_S_alpha_rt— Internal inductance, Lao large-aspect-ratio virial closure.virial_li_from_volume— Internal inductance from a volume integral of $B_p^2$.virial_magnetic_energy— Magnetic energy of a sampled field, $W_{mag} = \sum B^2\,V/(2\mu_0)$.virial_muihat_from_Bt_R0_dphi— Diamagnetic parameter $\hat\mu_i$ from the measured diamagnetic flux.virial_stability_criterion— Virial-ratio margin against the heuristic threshold $r_v = 0.5$.virial_theorem— Total energy and virial ratio of magnetic, kinetic and thermal contributions.virial_thermal_energy— Thermal energy of a sampled plasma, $W_{th} = \tfrac{3}{2}\sum n T\,V$.volume_from_RZ_boundary— Plasma volume from a boundary polygon, mean-radius approximation.
alpha_heating_power_from_n_D_n_T_T_keV_V
alpha_heating_power_from_n_D_n_T_T_keV_V(n_D_1e19, n_T_1e19, T_keV, V_m3) — aliases alpha_heating_power
Empirical fit.
D-T alpha heating power with the rough $\langle\sigma v\rangle \propto T^2$ fit.
\[P_\alpha = n_D\,n_T\,\langle\sigma v\rangle\,E_\alpha\,V, \qquad \langle\sigma v\rangle \approx 1.1\times10^{-24}\,T_{\mathrm{keV}}^2\ \mathrm{m^3/s}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n_D_1e19 | float | 1e19 m^-3 | Deuterium density. |
n_T_1e19 | float | 1e19 m^-3 | Tritium density. |
T_keV | float | keV | Ion temperature. |
V_m3 | float | m^3 | Plasma volume. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W | Alpha heating power. |
Assumptions.
Flat profiles (the product of densities is taken at one temperature over the whole volume); all alpha energy deposited in the plasma.
Validity.
Empirical fit. The quadratic $\langle\sigma v\rangle$ is Wesson’s interpolation of the D-T reactivity, accurate to ~10 % for $10 < T < 20$ keV [1]; outside that window use the Bosch-Hale parametrisation [2].
Limitations.
Irrelevant for a deuterium-only device such as VEST; kept for power-balance completeness. Tracked in #360 (Bosch-Hale replacement).
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 1.3.
- H.-S. Bosch and G. M. Hale, Nucl. Fusion 32 (1992) 611, Table VII.
approximated_diamagnetism_from_B_pa_B_tv_R0_delta_phi
approximated_diamagnetism_from_B_pa_B_tv_R0_delta_phi(B_pa, B_tv, R0, delta_phi, V_p)
Convention-sensitive.
Diamagnetic parameter from the vacuum toroidal field and flux change.
\[\hat\mu_i \approx \frac{1}{B_{pa}^2 V_p}\int_0^{2\pi}d\varphi\,R_0\,(2B_{tv}\Delta\phi) = \frac{4\pi\,B_{tv}\,R_0\,\Delta\phi}{B_{pa}^2\,V_p}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
B_pa | float | T | Boundary-averaged poloidal field. |
B_tv | float | T | Vacuum toroidal field at |
R0 | float | m | Major radius. |
delta_phi | float | Wb | Diamagnetic flux $\Delta\phi$. |
V_p | float | m^3 | Plasma volume. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | $\hat\mu_i$. |
Convention.
Numerically identical to virial_muihat_from_Bt_R0_dphi; kept under
the name used by the VFIT-era analysis. Same sign caveat on delta_phi.
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 2.
aspect_ratio_from_a_R
aspect_ratio_from_a_R(a, R)
Aspect ratio $A = R/a = 1/\varepsilon$.
\[A = \frac{R}{a}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
a | float | m | Minor radius. |
R | float | m | Major radius. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Aspect ratio. |
Notes.
Not to be confused with the elongation $\kappa$.
auxiliary_heating_power
auxiliary_heating_power(P_aux, eta_CD)
Split auxiliary power into heating and current-drive parts.
\[P_{CD} = \frac{P_{aux}}{1 + \eta_{CD}}, \qquad P_{heat} = P_{aux} - P_{CD}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
P_aux | float | W | Total auxiliary power. |
eta_CD | float | - | Current-drive efficiency figure from |
| Returns | Type | Unit | Description |
|---|---|---|---|
P_heat | float | W | Part of the power counted as heating. |
P_CD | float | W | Part of the power counted as current drive. |
Limitations.
A bookkeeping split with the same unsourced normalisation as
eta_CD; the two parts always sum to P_aux.
beta_normal_from_beta_tor
beta_normal_from_beta_tor(beta_tor, a, B0, Ip)
Normalized beta (Troyon) from toroidal beta, minor radius, field and current.
\[\beta_N = 100\,\beta_t \frac{a |B_0|}{|I_p[\mathrm{MA}]|}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
beta_tor | float | - | Toroidal beta. |
a | float | m | Minor radius. |
B0 | float | T | Vacuum toroidal field at |
Ip | float | A | Plasma current; converted to MA internally. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | % m T/MA | Normalized beta. |
References.
- F. Troyon et al., Plasma Phys. Control. Fusion 26 (1984) 209.
- IMAS Data Dictionary,
equilibrium.time_slice[:].global_quantities.beta_normal.
beta_poloidal_from_circumference
beta_poloidal_from_circumference(p_average, Ip, length_pol)
Convention-sensitive.
Poloidal beta in the EFIT/OMFIT convention, normalized by the LCFS circumference.
\[\beta_{p,\mathrm{circ}} = \frac{2\mu_0 \langle p \rangle_V}{B_{pa}^2}, \qquad B_{pa} = \frac{\mu_0 I_p}{L_{pol}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
p_average | float | Pa | Volume-averaged plasma pressure. |
Ip | float | A | Plasma current. |
length_pol | float | m | Poloidal circumference of the last closed flux surface. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Poloidal beta, circumference convention. |
Convention.
Not the IMAS DD’s beta_pol, and not an estimate of it: this
normalizes the volume-averaged pressure by the poloidal field implied by
the LCFS circumference rather than by R_0 mu_0 Ip^2. The two differ
by the geometric factor R_0 L_pol^2 / (2 V) – 26% on the packaged
kineticEfit reference, where this form reproduces the stored value to
0.1% and the DD form does not. It exists so the database summary can keep
reporting what OMFIT reported; global_quantities.beta_pol stays
DD-normative (see beta_poloidal_from_pressure_integral and issue
#318, which owns the sensitivity study of the two).
References.
- L. L. Lao, H. St. John, R. D. Stambaugh, A. G. Kellman and W. Pfeiffer, Nucl. Fusion 25 (1985) 1611 (EFIT definitions).
beta_poloidal_from_pressure_integral
beta_poloidal_from_pressure_integral(pressure_integral, R0, Ip)
Convention-sensitive.
Poloidal beta in the IMAS definition, from the pressure volume integral.
\[\beta_p = \frac{4 \int p \, dV}{R_0 \mu_0 I_p^2}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
pressure_integral | float | Pa m^3 | Plasma pressure integrated over the plasma volume. |
R0 | float | m | Reference major radius the DD normalizes by. |
Ip | float | A | Plasma current. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Poloidal beta. |
Convention.
This is the DD-normative beta_pol, normalized by R_0 mu_0 Ip^2.
The EFIT/OMFIT circumference form is a different definition; see
beta_poloidal_from_circumference.
References.
- IMAS Data Dictionary,
equilibrium.time_slice[:].global_quantities.beta_pol. - J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Ch. 3, Equilibrium (definition of beta).
beta_t_from_n_T_B
beta_t_from_n_T_B(n_m3, T_eV, B_t_T, output='percent') — aliases calc_beta_t
Convention-sensitive.
Toroidal beta from density, temperature and field.
\[\beta_t\,[\%] = 8.05\times10^{-23}\,\frac{n\,[\mathrm{m^{-3}}]\;T\,[\mathrm{eV}]}{B_t^2\,[\mathrm{T^2}]}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n_m3 | float or np.ndarray | m^-3 | Electron density, strictly positive. |
T_eV | float or np.ndarray | eV | Temperature, strictly positive. |
B_t_T | float or np.ndarray | T | Toroidal field, strictly positive. |
output | str, optional | str |
|
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | % | Toroidal beta in percent, or as a fraction. |
Raises.
ValueError
For non-finite or non-positive input, or an unknown output.
Convention.
$8.05\times10^{-23} = 100\times2\mu_0\times2e$: the total pressure is taken as $2n_eT$ (equal electron and ion temperatures, $n_i = n_e$), and the default output is a percentage. Verdoolaege’s ITER example is reproduced by construction.
References.
- G. Verdoolaege et al., Nucl. Fusion 61 (2021) 076006, Sec. 2.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.5.
beta_toroidal_from_p_B0
beta_toroidal_from_p_B0(p_average, B0)
Toroidal beta from the volume-averaged pressure and the vacuum field.
\[\beta_t = \frac{2\mu_0 \langle p \rangle_V}{B_0^2}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
p_average | float | Pa | Volume-averaged plasma pressure. |
B0 | float | T | Vacuum toroidal field at |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Toroidal beta. |
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Ch. 3, Equilibrium (definition of beta).
- IMAS Data Dictionary,
equilibrium.time_slice[:].global_quantities.beta_tor.
bootstrap_current_fraction
bootstrap_current_fraction(n_e, T_e_keV, R0, a, q_95)
Empirical fit.
Heuristic bootstrap-current fraction $f_{BS}$.
\[f_{BS} = 0.3\sqrt{\beta_p}, \qquad \beta_p = \frac{0.4\,n_e\,T_e\,a}{R_0\,q_{95}^2}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n_e | float | any | Electron density in the unit the coefficient was fitted for. The original source does not record which. |
T_e_keV | float | keV | Electron temperature. |
R0 | float | m | Major radius. |
a | float | m | Minor radius. |
q_95 | float | - | Safety factor at the 95% flux surface. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Bootstrap fraction of the plasma current. |
Physical interpretation.
Neoclassical bootstrap current scales as $\epsilon^{1/2}\beta_p$; the inner expression is a crude $\beta_p$ estimate from an $n T$ pressure and the cylindrical $q$-$I_p$ relation, and the outer square root is a fit.
Validity.
Empirical fit. Labelled “ITER scaling for bootstrap current” in the original VAFT source without a publication or unit system for the coefficients 0.3 and 0.4. The physics it approximates is the $\sqrt{\epsilon}\,\beta_p$ scaling of Peeters [1] and Wesson [2].
Limitations.
Unsourced coefficients and unstated density unit; the $\beta_p$ estimate ignores profile shape and the ion pressure. Tracked in #361.
References.
- A. G. Peeters, Plasma Phys. Control. Fusion 42 (2000) B231, Sec. 2.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 4.9 (bootstrap current).
bremsstrahlung_power_density_from_T_e_p_Z_eff
bremsstrahlung_power_density_from_T_e_p_Z_eff(T_e, p, Z_eff=2.0)
Convention-sensitive.
Bremsstrahlung power density in the pressure form.
\[S_B = Z_{\mathrm{eff}}\,K_B\,\frac{p_{\mathrm{bar}}^2}{T_{\mathrm{keV}}^{3/2}} \ [\mathrm{MW/m^3}], \qquad K_B = 0.052\]which is the NRL $P_{br} = 1.69\times10^{-38}\,Z_{\mathrm{eff}}n_e^2\sqrt{T_e}$ rewritten with $n_e = p/(2T)$ (equal electron and ion pressure).
| Parameter | Type | Unit | Description |
|---|---|---|---|
T_e | float | eV | Electron temperature. |
p | float | Pa | Total plasma pressure. |
Z_eff | float, optional | - | Effective charge; default 2. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W/m^3 | Radiated power density. |
Convention.
Pressure is converted to bar ($10^5$ Pa) and temperature to keV internally; the prefactor 0.052 MW/m^3 follows exactly from the NRL coefficient and $p = 2n_eT$, so a pressure that already includes fast ions or unequal $T_i$ overestimates $n_e$.
Assumptions.
Maxwellian electrons, Gaunt factor 1, $n_i = n_e$ and $T_i = T_e$; no recombination or line radiation.
References.
- NRL Plasma Formulary (2019), p. 58 (bremsstrahlung).
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Ch. 4 (radiation losses).
bremsstrahlung_power_density_from_Z_eff_n_e_T_e
bremsstrahlung_power_density_from_Z_eff_n_e_T_e(n_e_m3, T_e_eV, Z_eff=2.0)
Convention-sensitive.
Maxwellian free-free (bremsstrahlung) power density from first principles.
\[S_B = \frac{2^{1/2}}{3\pi^{5/2}}\,\frac{e^6}{\varepsilon_0^3c^3h\,m_e^{3/2}}\; Z_{\mathrm{eff}}\,n_e^2\,\sqrt{k_BT_e}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n_e_m3 | float | m^-3 | Electron density. |
T_e_eV | float | eV | Electron temperature, converted to joules internally. |
Z_eff | float, optional | - | Effective charge; default 2. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W/m^3 | Radiated power density. |
Convention.
The prefactor evaluates to $4.2\times10^{-29}$ W m^3 J^-1/2, equal to the NRL
$1.69\times10^{-38}\,n_e^2\sqrt{T_{\mathrm{eV}}}$ used by
bremsstrahlung_radiation_power_from_z_eff_n_e_t_e; the two agree to
1 %.
Assumptions.
Maxwellian, non-relativistic electrons; Gaunt factor 1; $Z_{\mathrm{eff}}$ absorbs $\sum_Z Z^2 n_Z / n_e$.
Validity.
$T_e \ll m_ec^2$; relativistic corrections exceed 10 % above ~50 keV.
References.
- G. B. Rybicki and A. P. Lightman, Radiative Processes in Astrophysics, Wiley (1979), Eq. (5.15b).
- I. H. Hutchinson, Principles of Plasma Diagnostics, 2nd ed., Cambridge University Press (2002), Sec. 5.3.
bremsstrahlung_radiation_power_from_z_eff_n_e_t_e
bremsstrahlung_radiation_power_from_z_eff_n_e_t_e(Z_eff, n_e, T_e_eV)
Convention-sensitive.
Bremsstrahlung power density, NRL engineering form.
\[p_{br} = 1.69\times10^{-38}\,Z_{\mathrm{eff}}\,n_e^2\,\sqrt{T_e\,[\mathrm{eV}]} \ [\mathrm{W/m^3}]\]| Parameter | Type | Unit | Description |
|---|---|---|---|
Z_eff | float | - | Effective charge. |
n_e | float | m^-3 | Electron density. |
T_e_eV | float | eV | Electron temperature. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W/m^3 | Radiated power density. |
Convention.
The NRL Formulary $1.69\times10^{-32}\,n_e T_e^{1/2}\sum Z^2n_Z$ W/cm^3 with cm^-3 densities, converted to SI, and $\sum Z^2 n_Z = Z_{\mathrm{eff}}n_e$.
Assumptions.
Maxwellian electrons, Gaunt factor 1.
References.
- NRL Plasma Formulary (2019), p. 58.
calc_inverse_aspect_ratio
calc_inverse_aspect_ratio(a_m, R_geo_m)
Inverse aspect ratio $\varepsilon = a/R_{geo}$ with input validation.
\[\varepsilon = \frac{a}{R_{geo}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
a_m | float or np.ndarray | m | Minor radius, strictly positive. |
R_geo_m | float or np.ndarray | m | Geometric major radius, strictly positive. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | - | Inverse aspect ratio. |
Raises.
ValueError For non-finite or non-positive input.
See Also.
inverse_aspect_ratio_from_a_R : the unvalidated form.
check_kadomtsev_constraint
check_kadomtsev_constraint(alpha_I, alpha_B, alpha_P, alpha_n, alpha_R, tol=1e-06)
Whether engineering exponents satisfy the Kadomtsev constraint within a tolerance.
\[|\alpha_K| \le \mathrm{tol}\]with $\alpha_K$ from kadomtsev_constraint_from_engineering_exponents.
| Parameter | Type | Unit | Description | |||
|---|---|---|---|---|---|---|
alpha_I | float or np.ndarray | - | Exponent of the plasma current. | |||
alpha_B | float or np.ndarray | - | Exponent of the toroidal field. | |||
alpha_P | float or np.ndarray | - | Exponent of the heating power. | |||
alpha_n | float or np.ndarray | - | Exponent of the density. | |||
alpha_R | float or np.ndarray | - | Exponent of the major radius. | |||
tol | float, optional | - |
|
| Returns | Type | Unit | Description |
|---|---|---|---|
| bool or np.ndarray | bool |
|
Limitations.
The default tolerance is far tighter than any published fit satisfies
(ITER89P misses by 0.15); pass a physically motivated tol.
verify_kadomtsev_constraint evaluates a different expression from
the dimensionless indices; the two are tracked in #351.
References.
- B. B. Kadomtsev, Sov. J. Plasma Phys. 1 (1975) 295.
confinement_factor_ITER89P
confinement_factor_ITER89P(tau_E_exp, tau_E_ITER89P)
Confinement enhancement factor $H_{89}$ relative to ITER89P.
\[H_{89} = \frac{\tau_{E,\mathrm{exp}}}{\tau_{E,\mathrm{ITER89P}}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
tau_E_exp | float | s | Measured energy confinement time. |
tau_E_ITER89P | float | s | ITER89P prediction for the same discharge. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | $H_{89}$; values above 1 beat the L-mode scaling. |
References.
- P. N. Yushmanov et al., Nucl. Fusion 30 (1990) 1999.
confinement_time_from_P_loss_W_th
confinement_time_from_P_loss_W_th(P_loss, W_th)
Convention-sensitive.
Energy confinement time as stored energy over loss power.
\[\tau_E = \frac{W_{th}}{P_{loss}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
P_loss | float | W | Loss power. |
W_th | float | J | Thermal stored energy. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | s | Energy confinement time. |
Convention.
Thermal energy over loss power ($P_{heat} - dW/dt$, with or without
radiation subtracted depending on the database); the ITER definition of
$\tau_{E,th}$ needs $P_{loss}$ from loss_power_from_p_heat_dWdt_p_rad.
References.
- ITER Physics Expert Groups, Nucl. Fusion 39 (1999) 2175, Ch. 2, Sec. 3.
confinement_time_from_engineering_parameters
confinement_time_from_engineering_parameters(I_p, B_t, P_loss, n_e, M, R, epsilon, kappa, scaling='ITER89P', input_density_definition='line_avg', line_to_volume_factor=None)
Empirical fit. Convention-sensitive.
Thermal energy confinement time from an engineering-parameter scaling law.
\[\tau_{E,th} = C\prod_i x_i^{\alpha_i}\]with the product running only over the variables the selected scaling declares, in the engineering units MA, T, MW, $10^{19}$ m^-3, amu and m.
| Parameter | Type | Unit | Description |
|---|---|---|---|
I_p | float | A | Plasma current, converted to MA internally. |
B_t | float | T | Toroidal field. |
P_loss | float | W | Loss power, converted to MW internally. |
n_e | float | m^-3 | Electron density, converted to $10^{19}$ m^-3 internally. |
M | float | amu | Average ion mass. |
R | float | m | Major radius. |
epsilon | float | - | Inverse aspect ratio. |
kappa | float | - | Elongation. |
scaling | str, optional | str | Scaling-law name; default |
input_density_definition | str, optional | str | What |
line_to_volume_factor | float or None, optional | - | Volume-to-line density ratio, default |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | s | Thermal energy confinement time. |
Raises.
ValueError
Unknown scaling, non-positive input, or a density-definition mismatch
without line_to_volume_factor.
Convention.
Strict SI in; the SI-to-engineering conversions ($\times10^{-6}$ for
current and power, $\times10^{-19}$ for density) happen inside, so
pre-scaled inputs are wrong by orders of magnitude. Every prefactor $C$ is
tied to that unit convention: the NSTX fits were converted from the papers’
SI-like form, and the density definition each scaling expects is declared
in _SCALING_COEFS. Variables a scaling does not use are neither
range-checked nor raised to any power.
Validity.
Empirical fit. Multi-machine regressions of the ITER L-mode (ITER89P [1]) and ELMy H-mode (IPB98(y,2) [2]) databases, the NSTX H- and L-mode fits of Kaye [3], and the spherical-tokamak multi-machine H-mode fit of Kurskiev [4]; each is valid over its database’s parameter range and the ST fits are the only ones that include low-aspect-ratio data.
Limitations.
Extrapolation to VEST (small size, low field) lies outside every database
range except in part the ST fit; the Kurskiev regression’s absorbed-power
dependence is mapped onto P_loss as supplied.
References.
- P. N. Yushmanov et al., Nucl. Fusion 30 (1990) 1999 (ITER89P).
- ITER Physics Expert Groups, Nucl. Fusion 39 (1999) 2175, Ch. 2, Eq. (20) (IPB98(y,2)).
- S. M. Kaye et al., Nucl. Fusion 46 (2006) 848, Table 2.
- G. S. Kurskiev et al., Nucl. Fusion 62 (2022) 016011.
coulomb_logarithm_from_n_T
coulomb_logarithm_from_n_T(n_m3, T_eV) — aliases coulomb_logarithm
Convention-sensitive.
Coulomb logarithm $\ln\Lambda$ for electron collisions above 10 eV.
\[\ln\Lambda = 30.9 - \ln\!\left(\frac{\sqrt{n_e\,[\mathrm{m^{-3}}]}}{T_e\,[\mathrm{eV}]}\right)\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n_m3 | float or np.ndarray | m^-3 | Electron density, strictly positive. |
T_eV | float or np.ndarray | eV | Electron temperature, strictly positive. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | - | Coulomb logarithm. |
Raises.
ValueError For non-finite or non-positive input.
Convention.
The NRL Formulary electron-electron/electron-ion form $24 - \ln(n_e^{1/2} T_e^{-1})$ with $n_e$ in cm^-3, converted to m^-3 ($24 + \ln 10^3 = 30.9$); also the convention of the Verdoolaege confinement-database analysis.
Validity.
$T_e > 10$ eV; below that the NRL low-temperature branch applies.
References.
- NRL Plasma Formulary (2019), p. 34 (Coulomb logarithm).
- G. Verdoolaege et al., Nucl. Fusion 61 (2021) 076006, Sec. 2.
current_density_from_B
current_density_from_B(B, R)
Convention-sensitive.
Toroidal current density from the radial derivative of a poloidal field.
\[j_\varphi \approx \frac{1}{\mu_0}\,\frac{dB}{dR}\]the slab form of Ampere’s law $\mu_0 j_\varphi = \partial B_Z/\partial R - \partial B_R/\partial Z$ with the second term dropped.
| Parameter | Type | Unit | Description |
|---|---|---|---|
B | float or np.ndarray | T | Poloidal field component (normally $B_Z$) along a 1-D radial cut. |
R | float or np.ndarray | m | Major radius of the samples, monotonic. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | A/m^2 | Current density along the cut. |
Convention.
Sign follows the COCOS $\sigma_{B_p}$ of the supplied component: with the midplane $B_Z$ of a standard equilibrium the result has the sign of the plasma current. The $\partial B_R/\partial Z$ contribution is neglected, so the answer is exact only on the midplane of an up-down symmetric equilibrium.
Numerical notes.
numpy.gradient along the single supplied axis (second-order interior,
first-order ends); pass a 1-D slice, not a 2-D map.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.1 (Ampere’s law in the tokamak).
current_density_from_psi
current_density_from_psi(psi, R)
Convention-sensitive.
Radial-derivative current-density estimate from a poloidal flux cut.
\[j = -\frac{1}{\mu_0 R}\,\frac{d\psi}{dR}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
psi | float or np.ndarray | Wb/rad | Poloidal flux along a 1-D radial cut. |
R | float or np.ndarray | m | Major radius of the samples, monotonic. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | A/m | The quantity $-(\mu_0 R)^{-1}\,d\psi/dR$. |
Convention.
Hard-codes the historical $k=-1$ (weber-per-radian, COCOS 2/3/6/7) prefactor
inline instead of going through poloidal_field_factor, so unlike the
$B_R$/$B_Z$ helpers it cannot be told the COCOS. Tracked in #355.
Limitations.
$-(1/R)\,d\psi/dR$ is $B_Z$, so this expression is $B_Z/\mu_0$: a current per
unit length [A/m], not the toroidal current density $j_\varphi = -\Delta^*\psi
/(\mu_0 R)$ [A/m^2], which needs second derivatives. Kept unchanged for
compatibility; use profiles_2d.j_tor or current_density_from_B
with $B_Z$ for a density. Tracked in #355.
Numerical notes.
numpy.gradient along the single supplied axis; pass a 1-D slice.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.3 (Grad-Shafranov equation, $\mu_0 R j_\varphi = -\Delta^*\psi$).
current_drive_efficiency
current_drive_efficiency(n_e, T_e_keV, Z_eff=1.0)
Empirical fit.
Heuristic lower-hybrid current-drive efficiency $\eta_{CD}$.
\[\eta_{CD} = 0.3\,\sqrt{\frac{n_e\,T_e}{Z_{\mathrm{eff}}}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n_e | float | any | Electron density in the unit the coefficient was fitted for. The original source does not record which. |
T_e_keV | float | keV | Electron temperature. |
Z_eff | float, optional | - | Effective charge; default 1. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Efficiency figure in the coefficient’s own normalisation. |
Physical interpretation.
Lower-hybrid current drive becomes more efficient at higher temperature and lower $Z_{\mathrm{eff}}$ because the wave-driven fast electrons slow down on a hotter, cleaner background; the density factor here is unusual (the standard figure of merit $\eta = n_e I_{CD} R / P$ divides by density).
Validity.
Empirical fit. Labelled “ITER scaling for lower hybrid current drive” in the original VAFT source; no publication, dataset or unit system for the coefficient 0.3 was recorded, so the number is a placeholder. The theory of the efficiency and its $T_e/Z_{\mathrm{eff}}$ dependence is Fisch [1].
Limitations.
Unsourced coefficient and unstated density unit; treat the result as qualitative. Tracked in #361.
References.
- N. J. Fisch, Rev. Mod. Phys. 59 (1987) 175, Sec. VI (lower-hybrid current-drive efficiency).
current_limit_from_beta
current_limit_from_beta(beta_N, a, B0)
Current figure obtained by substituting $\beta_N$ for $q$ in the cylindrical relation.
\[I_p = \frac{2\pi a^2 B_0}{\mu_0\,\beta_N}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
beta_N | float | - | Normalised beta in whatever convention the caller uses. |
a | float | m | Minor radius. |
B0 | float | T | Toroidal field on axis. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | A m | The expression above. |
Limitations.
Dimensionally the cylindrical-$q$ formula with $\beta_N$ in the place of $q$;
no derivation or source records what this is meant to bound, and the result
depends on the units chosen for $\beta_N$. Kept for compatibility; prefer
vaft.formula.stability.beta_N_from_beta_a_B0_Ip and the Troyon limit.
Tracked in #362.
References.
- F. Troyon et al., Plasma Phys. Control. Fusion 26 (1984) 209 (the $\beta_N$ limit this appears to invert).
current_limit_from_q
current_limit_from_q(q_95, a, B0)
Plasma current at a prescribed edge safety factor, cylindrical approximation.
\[I_p = \frac{2\pi a^2 B_0}{\mu_0\,q_{95}}\]the inversion of $q_{cyl} = 2\pi a^2 B_0/(\mu_0 R\,I_p)\times R/R$ for a circular cross-section written per unit major radius.
| Parameter | Type | Unit | Description |
|---|---|---|---|
q_95 | float | - | Target safety factor at the 95% flux surface. |
a | float | m | Minor radius. |
B0 | float | T | Toroidal field on axis. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | A m | Plasma current reaching |
Assumptions.
Circular, large-aspect-ratio cylinder with $q_{95}$ standing in for the cylindrical $q_a$.
Limitations.
As written the expression lacks the $1/R$ of the cylindrical safety factor $q = 2\pi a^2 B_0/(\mu_0 R I_p)$ and therefore returns $I_p R$ [A m], not a current; divide by $R$ for amperes. Elongation is ignored. Tracked in #362.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.4 (cylindrical safety factor).
cyclotron_synchrotron_power_density_scaling_from_n_e_B_t_T_e
cyclotron_synchrotron_power_density_scaling_from_n_e_B_t_T_e(n_e_m3, B_t_T, T_e_eV)
Classical electron-cyclotron emission power density, no reabsorption.
\[p_{\mathrm{cyc}} = \frac{e^4}{3\pi\varepsilon_0 m_e^3c^3}\,n_e\,B_t^2\,k_BT_e \approx 6.2\times10^{-17}\,B_t^2\,n_e\,T_{\mathrm{keV}}\ \mathrm{W/m^3}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n_e_m3 | float | m^-3 | Electron density. |
B_t_T | float | T | Magnetic field. |
T_e_eV | float | eV | Electron temperature, converted to joules internally. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W/m^3 | Emitted cyclotron power density. |
Physical interpretation.
Total single-particle cyclotron radiation of a non-relativistic Maxwellian; the plasma is optically thick at the low harmonics, so the net loss is a small fraction of this, set by wall reflectivity and $\beta$ (Trubnikov).
Validity.
Non-relativistic electrons; an upper bound on the loss, intended as a start-up loss-channel estimate rather than a radiation-transport result.
Limitations.
Ignores reabsorption and wall reflection, which reduce the net loss by one to two orders of magnitude in a tokamak.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Ch. 4 (cyclotron radiation).
- B. A. Trubnikov, in Reviews of Plasma Physics, Vol. 7, Consultants Bureau (1979), p. 345.
cylindrical_safety_factor_from_R_B_epsilon_I_f_kappa_delta
cylindrical_safety_factor_from_R_B_epsilon_I_f_kappa_delta(R, B, epsilon, I, f_kappa_delta)
Convention-sensitive.
Cylindrical safety factor with a shape function.
\[q_{cyl} = \frac{2\pi\,\varepsilon^2 R\,B_T}{\mu_0\,I_p\,f(\kappa,\delta)} = \frac{2\pi a^2 B_T}{\mu_0 R I_p}\,\frac{1}{f(\kappa,\delta)}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
R | float | m | Major radius. |
B | float | T | Toroidal field. |
epsilon | float | - | Inverse aspect ratio $a/R$. |
I | float | A | Plasma current. |
f_kappa_delta | float | - | Shape function; $1/\kappa$ reproduces the ITER $q_{cyl} = 5a^2\kappa B/(RI_{MA})$. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Cylindrical safety factor. |
Convention.
$2\pi/\mu_0 = 5\times10^6$, so with SI current this is the ITER Physics Basis $q_{cyl}$ once $f = 1/\kappa$; the shape function is left to the caller because the ITER-89P and IPB98 databases used different $\kappa$ definitions. Unlike the flux-derivative $q$ it never changes sign.
References.
- ITER Physics Expert Groups, Nucl. Fusion 39 (1999) 2175, Ch. 2, Sec. 3 (definition of $q_{cyl}$).
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.4.
dimensionless_scaling_coeffs_from_engineering_scaling_coeffs
dimensionless_scaling_coeffs_from_engineering_scaling_coeffs(a_I, a_B, a_P, a_n, a_M, a_R, a_eps, a_kappa)
Dimensionless scaling indices $(\mu_\rho, \mu_\beta, \mu_\nu)$ from engineering exponents.
\[\Omega_i\tau_E \propto \rho_*^{\mu_\rho}\,\beta^{\mu_\beta}\,\nu_*^{\mu_\nu}\]with, for $\alpha_L = \alpha_R + \alpha_I$, $\alpha_B^* = \alpha_B + \alpha_I$ and $D = 1 + \alpha_P$,
\[\mu_\rho = \frac{3\alpha_L + \alpha_B^* + \alpha_n - 2\alpha_P - 5}{D}, \quad \mu_\beta = \frac{-\alpha_L - 2\alpha_n - \alpha_B^* + 3\alpha_P + 3}{D}, \quad \mu_\nu = \frac{\alpha_L + 3\alpha_n + \alpha_B^* - 2\alpha_P - 4}{2D}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
a_I | float | - | Exponent of the plasma current. |
a_B | float | - | Exponent of the toroidal field. |
a_P | float | - | Exponent of the heating power. |
a_n | float | - | Exponent of the density. |
a_M | float | - | Exponent of the ion mass, passed through. |
a_R | float | - | Exponent of the major radius. |
a_eps | float | - | Exponent of the inverse aspect ratio, unused. |
a_kappa | float | - | Exponent of the elongation, passed through. |
| Returns | Type | Unit | Description |
|---|---|---|---|
mu_rho | float | - | Gyroradius index; $-3$ is gyro-Bohm, $-2$ Bohm. |
mu_beta | float | - | Beta index. |
mu_nu | float | - | Collisionality index. |
mu_M | float | - | Mass index, equal to |
mu_kappa | float | - | Elongation index, equal to |
Assumptions.
Constant safety factor, $I_p \propto a^2B/R$, so current is absorbed into the size and field indices; temperature eliminated through $P = W/\tau_E$.
Limitations.
Returns None instead of a tuple when $1 + \alpha_P$ vanishes (tracked in
#352); indices are rounded to three decimals.
References.
- T. C. Luce, C. C. Petty and J. G. Cordey, Plasma Phys. Control. Fusion 50 (2008) 043001, Sec. 3 (engineering to dimensionless exponent transformation).
- B. B. Kadomtsev, Sov. J. Plasma Phys. 1 (1975) 295.
eK_from_K
eK_from_K(K)
Elongation parameter $e_K$ of the virial relations.
\[e_K = \frac{K^2 - 1}{K^2 + 1}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
K | float | - | Elongation $\kappa$. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | $e_K$, 0 for a circle and $\to1$ for infinite elongation. |
Physical interpretation.
The ellipticity measure in which the Martynov-Pustovitov virial approximations are linear.
References.
- A. A. Martynov and V. D. Pustovitov, Phys. Plasmas 31 (2024), “Virial relations for elongated plasmas in tokamaks”, definition preceding Eq. (21).
ec_heating_power_from_I_ec_V_ec
ec_heating_power_from_I_ec_V_ec(I_ec, V_ec)
Electron-cyclotron launched power $P_{ec} = I_{ec}V_{ec}$.
\[P_{\mathrm{ec}} = I_{\mathrm{ec}}\,V_{\mathrm{ec}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
I_ec | float | A | Gyrotron beam current. |
V_ec | float | V | Gyrotron beam voltage. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W | Electrical beam power of the source. |
Limitations.
Gyrotron electrical power, not RF power (efficiency ~30-50 %) and not the power absorbed by the plasma.
elongation_from_RZ_boundary
elongation_from_RZ_boundary(R, Z)
Convention-sensitive.
Boundary elongation $\kappa$ from the extremal points of a contour.
\[\kappa = \frac{Z_{\max} - Z_{\min}}{2a}, \qquad a = \frac{R_{\max} - R_{\min}}{2}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
R | np.ndarray | m | Major radius of the boundary points. |
Z | np.ndarray | m | Height of the boundary points. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Elongation. |
Convention.
The IMAS boundary.elongation definition (half-height over half-width of
the bounding box), not an area-based or flux-surface-averaged elongation.
Limitations.
A single-point or degenerate contour divides by zero; no validation.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.1.
- IMAS Data Dictionary,
equilibrium.time_slice[:].boundary.elongation.
exact_volume_from_RZ_contour
exact_volume_from_RZ_contour(R, Z)
Convention-sensitive.
Plasma volume from a closed $(R, Z)$ contour by Green’s theorem.
\[V = \pi\oint R^2\,dZ\]exact for the solid of revolution swept by a closed poloidal contour, with no mean-radius approximation.
| Parameter | Type | Unit | Description |
|---|---|---|---|
R | np.ndarray | m | Major radius of the contour vertices, at least 3. |
Z | np.ndarray | m | Height of the contour vertices. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | m^3 | Volume of the solid of revolution. |
Convention.
Orientation-agnostic: the sign of the contour integral follows the traversal direction and the magnitude is returned. The contour is closed automatically when its first and last points differ.
Limitations.
Unlike volume_from_RZ_boundary, which factors the integral as
$2\pi A_{\mathrm{poly}}\bar R$ with $\bar R = \mathrm{mean}(R)$, this
evaluates the contour integral itself. On VEST flux surfaces the two differ
by up to ~6 % at the plasma edge, where the $\bar R$ factorisation is
weakest. Use this one whenever the volume is a reported quantity rather than
an intermediate.
Numerical notes.
Trapezoidal rule on $R^2$ between successive vertices, second-order in the vertex spacing.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.1.
heating_power_from_p_ohm_p_aux
heating_power_from_p_ohm_p_aux(P_ohm, P_aux)
Total heating power $P_{heat} = P_{ohm} + P_{aux}$.
\[P_{\mathrm{heat}} = P_{\mathrm{ohm}} + P_{\mathrm{aux}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
P_ohm | float | W | Ohmic heating power. |
P_aux | float | W | Absorbed auxiliary heating power. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W | Total heating power. |
inductive_voltage_from_dW_magdt_I_p
inductive_voltage_from_dW_magdt_I_p(dW_magdt, I_p)
Inductive voltage from the rate of change of magnetic energy.
\[V_{\mathrm{ind}} = \frac{1}{I_p}\,\frac{dW_{\mathrm{mag}}}{dt}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
dW_magdt | float | W | Rate of change of the poloidal magnetic energy. |
I_p | float | A | Plasma current. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | V | Inductive voltage. |
Assumptions.
Exact for $W = \tfrac{1}{2}LI^2$ with constant $L$; when the inductance changes (current-profile evolution) the full inductive voltage is $d(LI)/dt$ and this expression captures only part of it.
inverse_aspect_ratio_from_a_R
inverse_aspect_ratio_from_a_R(a, R)
Inverse aspect ratio $\varepsilon = a/R$.
\[\varepsilon = \frac{a}{R}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
a | float | m | Minor radius. |
R | float | m | Major radius. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Inverse aspect ratio. |
See Also.
calc_inverse_aspect_ratio : the same ratio with positivity validation.
kadomtsev_constraint_from_engineering_exponents
kadomtsev_constraint_from_engineering_exponents(alpha_I, alpha_B, alpha_P, alpha_n, alpha_R)
Residual of the Kadomtsev high-beta constraint on engineering exponents.
\[\alpha_K = 4\alpha_R - 8\alpha_n - \alpha_I - 3\alpha_P - 5\alpha_B - 5\]for $\tau_E \propto I^{\alpha_I}B^{\alpha_B}P^{\alpha_P}n^{\alpha_n}R^{\alpha_R}$; $\alpha_K = 0$ when the scaling is expressible in the three dimensionless parameters $\rho_$, $\beta$, $\nu_$ alone.
| Parameter | Type | Unit | Description |
|---|---|---|---|
alpha_I | float or np.ndarray | - | Exponent of the plasma current. |
alpha_B | float or np.ndarray | - | Exponent of the toroidal field. |
alpha_P | float or np.ndarray | - | Exponent of the heating power. |
alpha_n | float or np.ndarray | - | Exponent of the density. |
alpha_R | float or np.ndarray | - | Exponent of the major radius. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | - | Constraint residual, 0 for exact satisfaction. |
Raises.
ValueError For non-finite input.
Physical interpretation.
Dimensional analysis of the Vlasov-Maxwell system: only three of the engineering variables are independent once $\rho_$, $\beta$ and $\nu_$ are fixed at constant geometry. ITER89P gives $\alpha_K = -0.15$ and IPB98(y,2) gives $-0.01$.
References.
- B. B. Kadomtsev, Sov. J. Plasma Phys. 1 (1975) 295.
- ITER Physics Expert Groups, Nucl. Fusion 39 (1999) 2175, Ch. 2, Sec. 6.2 (Kadomtsev constraint).
- G. Verdoolaege et al., Nucl. Fusion 61 (2021) 076006.
kinetic_energy_from_beta_p_B_pa_V_p
kinetic_energy_from_beta_p_B_pa_V_p(beta_p, B_pa, V_p)
Convention-sensitive.
Thermal energy from poloidal beta, $W_K = \tfrac{3}{2}\,\beta_p B_{pa}^2 V_p/(2\mu_0)$.
\[W_K = \frac{3}{2}\left(\frac{\beta_p\,B_{pa}^2}{2\mu_0}\,V_p\right)\]| Parameter | Type | Unit | Description |
|---|---|---|---|
beta_p | float | - | Poloidal beta, $2\mu_0\langle p\rangle/B_{pa}^2$. |
B_pa | float | T | Boundary-averaged poloidal field, $\mu_0 I_p/L_p$. |
V_p | float | m^3 | Plasma volume. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | J | Thermal (kinetic) energy. |
Convention.
$B_{pa}$ is the poloidal field averaged over the boundary contour of length $L_p$, the EFIT/Lao normalisation of $\beta_p$; the $3/2$ converts $pV$ to the ideal-gas thermal energy.
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 2 (definitions of $\beta_p$ and $B_{pa}$).
kink_safety_factor
kink_safety_factor(R, a, kappa, Ip, Bt, type_)
Convention-sensitive.
Kink safety factor $q_*$ with the Freidberg beta and current limits.
\[q_{\mathrm{kink}} = \frac{2\pi a^2 B_t}{\mu_0 I_p R}\;g(\kappa)\]with $g = 1$ ('circular'), $g = 1 + \tfrac{4}{\pi^2}(\kappa^2-1)$
('conventional') or $g = \tfrac{1}{2}(1+\kappa^2)$ ('ST'), plus the
matching Troyon-type $\beta$ limits and the current at $q_{\mathrm{kink}}
= q_{\min}$.
| Parameter | Type | Unit | Description |
|---|---|---|---|
R | float or np.ndarray | m | Major radius. |
a | float or np.ndarray | m | Minor radius. |
kappa | float or np.ndarray | - | Elongation. |
Ip | float or np.ndarray | A | Plasma current. |
Bt | float or np.ndarray | T | Toroidal field. |
type_ | str | str |
|
| Returns | Type | Unit | Description |
|---|---|---|---|
q_kink | float or np.ndarray | - | Kink safety factor. |
q_min | float or np.ndarray | - | Minimum stable kink safety factor $1 + \kappa/2$. |
beta_max | float or np.ndarray or None | - | Beta limit (fraction); |
beta_crit | float or np.ndarray or None | - | Critical beta (fraction); |
ip_max | float or np.ndarray | A | Current at which $q_{\mathrm{kink}}$ reaches $q_{\min}$. |
Convention.
$\beta$ limits are fractions, not percent, and are given in Freidberg’s $\epsilon$-scaled form ($\beta_{\max} = 0.072\,\tfrac{1+\kappa^2}{2}\, \epsilon$ for the ST branch, $\pi^2\kappa\epsilon/16q^2$ for the conventional one). $\mu_0$ is hard-coded as $4\pi\times10^{-7}$.
Validity.
Freidberg’s reduced-MHD estimates for external kink and pressure-driven limits; order-of-magnitude design numbers, not a stability code result.
References.
- J. P. Freidberg, Plasma Physics and Fusion Energy, Cambridge University Press (2007), Ch. 13, Eq. (13.158) and the surrounding kink and Troyon limit discussion.
- F. Troyon et al., Plasma Phys. Control. Fusion 26 (1984) 209.
li_3_from_Bp2_volume_integral
li_3_from_Bp2_volume_integral(Bp2_dV, Ip, R0)
Internal inductance in the IMAS li_3 definition, from the poloidal-field energy.
The same quantity OMFIT reports as li_(3)_IMAS.
| Parameter | Type | Unit | Description |
|---|---|---|---|
Bp2_dV | float | T^2 m^3 | Poloidal field squared integrated over the plasma volume. |
Ip | float | A | Plasma current. |
R0 | float | m | Reference major radius the DD normalizes by. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Internal inductance, |
References.
- IMAS Data Dictionary,
equilibrium.time_slice[:].global_quantities.li_3. - J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Ch. 3, Equilibrium (internal inductance).
line_to_volume_avg_density
line_to_volume_avg_density(n_line_m3, factor=0.88)
Volume-averaged density from a line average with a fixed profile factor.
\[\langle n\rangle_V = f\,\bar n_l, \qquad f = 0.88\ \text{by default}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n_line_m3 | float or np.ndarray | m^-3 | Line-averaged density, strictly positive. |
factor | float or np.ndarray, optional | - | Profile factor, strictly positive; default 0.88. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | m^-3 | Volume-averaged density. |
Raises.
ValueError For non-finite or non-positive input.
Assumptions.
A moderately peaked density profile; 0.88 is the ITPA workflow value for H-mode-like profiles and is not a measurement.
References.
- G. Verdoolaege et al., Nucl. Fusion 61 (2021) 076006, Sec. 2.
loop_voltage_from_total_flux
loop_voltage_from_total_flux(time_slice, psi_boundary)
Convention-sensitive.
Surface loop voltage from the time series of boundary flux.
\[V_{\mathrm{loop}} = \frac{d\Phi_{\mathrm{surface}}}{dt} = 2\pi\,\frac{d\psi_b}{dt}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
time_slice | np.ndarray | s | Time of each sample, monotonic. |
psi_boundary | np.ndarray | Wb/rad | Boundary poloidal flux at each time. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray | V | Loop voltage at the plasma surface at each time. |
Convention.
Assumes psi_boundary per radian, as surface_poloidal_flux_from_psi_boundary
does; a full-weber IMAS flux gives a voltage $2\pi$ too large. The sign is
that of $d\psi_b/dt$ in the supplied COCOS, so a discharge with positive
current and the usual $\sigma_{B_p}$ shows negative $V_{loop}$ during ramp-up.
Tracked in #354.
Physical interpretation.
Sum of resistive and inductive voltage at the last closed flux surface, the quantity a flux loop on the boundary would read.
Numerical notes.
numpy.gradient in time (second-order interior, first-order ends); noisy
$\psi_b$ reconstructions need smoothing first.
References.
- S. Ejima et al., Nucl. Fusion 22 (1982) 1313, Sec. 2.
loss_power_from_p_heat_dWdt_p_rad
loss_power_from_p_heat_dWdt_p_rad(P_heat, dWdt, p_rad)
Convention-sensitive.
Loss power $P_{loss} = P_{heat} - dW/dt - P_{rad}$.
\[P_{\mathrm{loss}} = P_{\mathrm{heat}} - \frac{dW}{dt} - P_{\mathrm{rad}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
P_heat | float | W | Total heating power. |
dWdt | float | W | Rate of change of stored energy. |
p_rad | float | W | Radiated power to subtract; 0 keeps radiation inside the loss. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W | Loss power. |
Convention.
With p_rad = 0 this is the ITER-database $P_L$ that the confinement
scalings are fitted to (radiation counted as a loss); with the core
radiation subtracted it is the conducted-plus-convected loss to the
boundary. Use the same choice as the scaling being compared against.
References.
- ITER Physics Expert Groups, Nucl. Fusion 39 (1999) 2175, Ch. 2, Sec. 3.
magnetic_energy_from_li_B_pa_V_p
magnetic_energy_from_li_B_pa_V_p(li, B_pa, V_p)
Convention-sensitive.
Poloidal magnetic energy from the internal inductance, $W_M = l_i B_{pa}^2 V_p/(2\mu_0)$.
\[W_M = \frac{l_i\,B_{pa}^2}{2\mu_0}\,V_p\]| Parameter | Type | Unit | Description |
|---|---|---|---|
li | float | - | Internal inductance $\langle B_p^2\rangle/B_{pa}^2$. |
B_pa | float | T | Boundary-averaged poloidal field, $\mu_0 I_p/L_p$. |
V_p | float | m^3 | Plasma volume. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | J | Poloidal field energy inside the plasma. |
Convention.
The Lao/EFIT $l_i$ (volume average of $B_p^2$ over $B_{pa}^2$), which is neither the IMAS $l_{i,3}$ nor the large-aspect-ratio $l_i = \langle B_p^2 \rangle/B_p(a)^2$; each differs by its normalising field.
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 2.
nbi_heating_power_from_I_nbi_V_nbi
nbi_heating_power_from_I_nbi_V_nbi(I_nbi, V_nbi)
Neutral-beam injected power $P_{nbi} = I_{nbi}V_{nbi}$.
\[P_{\mathrm{nbi}} = I_{\mathrm{nbi}}\,V_{\mathrm{nbi}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
I_nbi | float | A | Beam current. |
V_nbi | float | V | Acceleration voltage. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W | Beam power leaving the injector. |
Limitations.
Injected, not absorbed: neutralisation efficiency, duct losses and shine-through are not subtracted.
normalize_psi
normalize_psi(*args, **kw)
Deprecated.
Deprecated: use psi_normalised.
Kept for backwards compatibility; emits a DeprecationWarning and forwards
every argument unchanged.
See Also.
psi_normalised
normalized_collisionality_from_a_n_q_epsilon_T
normalized_collisionality_from_a_n_q_epsilon_T(a, n, q, epsilon, T_eV, C=1.0)
Convention-sensitive.
Collisionality scaling form $\nu_* \propto a\,n\,q/(\varepsilon^{5/2}T^2)$.
\[\nu_* = C\,\frac{a\,n\,q}{\varepsilon^{5/2}\,T^2}\]which is the Sauter form $\nu_* = 6.921\times10^{-18}\,qRn\ln\Lambda/ (T^2\varepsilon^{3/2})$ with $R = a/\varepsilon$ and $C = 6.921\times10^{-18} \ln\Lambda$ (electrons; times $Z^4$ for ions).
| Parameter | Type | Unit | Description |
|---|---|---|---|
a | float | m | Minor radius. |
n | float | m^-3 | Density. |
q | float | - | Safety factor. |
epsilon | float | - | Inverse aspect ratio. |
T_eV | float | eV | Temperature. |
C | float, optional | - | Proportionality constant; default 1 gives only the scaling. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Collisionality, or with the default |
Raises.
ValueError
For non-positive epsilon or T_eV.
Convention.
With C=1 the number is not $\nu_*$ but proportional to it; supply
$C = 6.921\times10^{-18}\ln\Lambda$ (with $n$ in m^-3 and $T$ in eV) for
Sauter’s electron collisionality. Tracked with the other two definitions in
#353.
References.
- O. Sauter, C. Angioni and Y. R. Lin-Liu, Phys. Plasmas 6 (1999) 2834, Eq. (18b).
normalized_collisionality_from_nu_ii_T_i_M_i_R_a_q
normalized_collisionality_from_nu_ii_T_i_M_i_R_a_q(nu_ii, T_i_eV, M_i, R, a, q)
Convention-sensitive.
Ion collisionality $\nu_*$ from a collision frequency.
\[\nu_* = \nu_{ii}\left(\frac{M_i}{eT_i}\right)^{1/2}\left(\frac{R}{a}\right)^{3/2} qR = \frac{\nu_{ii}\,qR}{\varepsilon^{3/2}\,v_{th,i}}\]the ratio of the effective detrapping frequency to the bounce frequency, with $v_{th,i} = \sqrt{eT_i/M_i}$.
| Parameter | Type | Unit | Description |
|---|---|---|---|
nu_ii | float | 1/s | Ion-ion collision frequency. |
T_i_eV | float | eV | Ion temperature. |
M_i | float | kg | Ion mass. |
R | float | m | Major radius. |
a | float | m | Minor radius. |
q | float | - | Safety factor. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Normalised collisionality. |
Convention.
Thermal speed $\sqrt{T/m}$ (no factor 2) and the collision frequency
supplied by the caller; with Sauter’s $\nu_{ii}$ this is Sauter Eq. (18b)
without its numeric prefactor. Two other $\nu_*$ definitions live in this
package (normalized_collisionality_from_a_n_q_epsilon_T and
nu_star_from_n_T_B_R_epsilon_kappa_I); tracked in #353.
Physical interpretation.
$\nu_* \ll 1$ is the banana (collisionless) regime, $\nu_* \gg \varepsilon^{-3/2}$ the Pfirsch-Schluter regime.
References.
- O. Sauter, C. Angioni and Y. R. Lin-Liu, Phys. Plasmas 6 (1999) 2834, Eq. (18b).
- F. L. Hinton and R. D. Hazeltine, Rev. Mod. Phys. 48 (1976) 239, Sec. IV (collisionality regimes).
normalized_larmor_radius_from_M_T_a_Bt
normalized_larmor_radius_from_M_T_a_Bt(M, T, a, Bt)
Convention-sensitive.
Normalised ion gyroradius $\rho_* = \rho_i/a$ in SI inputs.
\[\rho_* = \frac{\rho_i}{a}, \qquad \rho_i = \frac{m_i v_{th}}{eB_T} = \frac{\sqrt{2\,m_i\,eT_i}}{e\,B_T}\]with $v_{th} = \sqrt{2T_i/m_i}$ and $T_i$ in eV.
| Parameter | Type | Unit | Description |
|---|---|---|---|
M | float | kg | Ion mass. |
T | float | eV | Ion temperature. |
a | float | m | Minor radius. |
Bt | float | T | Toroidal field. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Normalised gyroradius. |
Convention.
Thermal speed $\sqrt{2T/m}$ and the toroidal field, normalised by the minor
radius: the ITER Physics Basis definition. Differs from
rho_star_from_M_T_B_R_epsilon (mass in amu, normalised by $R\varepsilon$
with a rounded prefactor) only in input units, and from
vaft.formula.stability.rhostar_from_Te_a_Bt in substance; the three
definitions are tracked in #353.
References.
- ITER Physics Expert Groups, Nucl. Fusion 39 (1999) 2175, Ch. 2, Sec. 6 (dimensionless parameters).
normalized_plasma_current
normalized_plasma_current(Ip, R, a, Bt)
Convention-sensitive.
Normalised plasma current $I_N = I_p/(a B_t)$ in MA/(m T).
\[I_N = \frac{I_p\,[\mathrm{MA}]}{a\,[\mathrm{m}]\,B_t\,[\mathrm{T}]}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
Ip | float or np.ndarray | A | Plasma current, converted to MA internally. |
R | float or np.ndarray | m | Major radius; accepted for signature symmetry, unused. |
a | float or np.ndarray | m | Minor radius. |
Bt | float or np.ndarray | T | Toroidal field. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | MA/(m T) | Normalised current. |
Convention.
SI current in, engineering-unit ratio out: the same $I_N$ that normalises $\beta_N = \beta_t[\%]/I_N$ and that the ST beta-limit literature plots against.
References.
- J. E. Menard et al., Phys. Plasmas 23 (2016) 072508, https://doi.org/10.1063/1.4959808, Sec. II.
- F. Troyon et al., Plasma Phys. Control. Fusion 26 (1984) 209.
nu_star_from_n_T_B_R_epsilon_kappa_I
nu_star_from_n_T_B_R_epsilon_kappa_I(n_m3, T_eV, B_t_T, R_geo_m, epsilon, kappa_a, I_p_A, ln_lambda=None) — aliases calc_nu_star
Convention-sensitive.
Normalised collisionality $\nu_*$ in the Verdoolaege engineering form.
\[\nu_* = 5\times10^{-11}\,\ln\Lambda\;\frac{n\,B_t\,R_{geo}^2\,\sqrt{\varepsilon}\,\kappa_a} {I_p\,T^2}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n_m3 | float or np.ndarray | m^-3 | Electron density, strictly positive. |
T_eV | float or np.ndarray | eV | Temperature, strictly positive. |
B_t_T | float or np.ndarray | T | Toroidal field, strictly positive. |
R_geo_m | float or np.ndarray | m | Geometric major radius, strictly positive. |
epsilon | float or np.ndarray | - | Inverse aspect ratio, strictly positive. |
kappa_a | float or np.ndarray | - | Area elongation, strictly positive. |
I_p_A | float or np.ndarray | A | Plasma current, strictly positive. |
ln_lambda | float or np.ndarray or None, optional | - | Coulomb logarithm; |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | - | Normalised collisionality. |
Raises.
ValueError For non-finite or non-positive input.
Convention.
Sauter’s $\nu_* = 6.921\times10^{-18}\,qRn\ln\Lambda/(T^2\varepsilon^{3/2})$ with $q = q_{cyl}$ substituted gives $3.46\times10^{-11}$ in front; the $5\times10^{-11}$ used here is Verdoolaege’s database convention and is 1.45 times larger, so values are comparable only within one convention. Tracked with the other $\nu_*$ definitions in #353.
References.
- G. Verdoolaege et al., Nucl. Fusion 61 (2021) 076006, Sec. 2.
- O. Sauter, C. Angioni and Y. R. Lin-Liu, Phys. Plasmas 6 (1999) 2834, Eq. (18b).
ohmic_heating_power_from_I_p_V_res
ohmic_heating_power_from_I_p_V_res(I_p, V_res)
Convention-sensitive.
Ohmic heating power $P_{ohm} = I_pV_{res}$.
\[P_{\mathrm{ohm}} = I_p\,V_{\mathrm{res}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
I_p | float | A | Plasma current. |
V_res | float | V | Resistive part of the loop voltage. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | W | Ohmic heating power. |
Convention.
With the surface loop voltage in place of $V_{res}$ the product also counts the inductive power $L\,dI_p/dt$ and the change of internal inductance, so it is a resistive-heating estimate only when $dI_p/dt \approx 0$.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 5.1 (ohmic heating).
omega_i_tau_E_from_B_tau_E_M
omega_i_tau_E_from_B_tau_E_M(B_t_T, tau_E_s, M_eff_amu, Z_i=1.0) — aliases calc_omega_i_tau_E
Convention-sensitive.
Ion-cyclotron-normalised confinement time $\Omega_i\tau_E$.
\[\Omega_i\tau_E = \frac{Z_i e B_t}{M_{eff}\,m_p}\,\tau_E\]| Parameter | Type | Unit | Description |
|---|---|---|---|
B_t_T | float or np.ndarray | T | Toroidal field, strictly positive. |
tau_E_s | float or np.ndarray | s | Energy confinement time, strictly positive. |
M_eff_amu | float or np.ndarray | amu | Effective ion mass, strictly positive. |
Z_i | float or np.ndarray, optional | - | Ion charge state, strictly positive; default 1. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | - | Normalised confinement time. |
Raises.
ValueError For non-finite or non-positive input.
Convention.
Exact SI angular cyclotron frequency with the proton mass and elementary
charge from vaft.formula.constants; not a fitted prefactor. The
dependent variable of dimensionless confinement scalings.
References.
- G. Verdoolaege et al., Nucl. Fusion 61 (2021) 076006, Sec. 2.
- ITER Physics Expert Groups, Nucl. Fusion 39 (1999) 2175, Ch. 2, Sec. 6.
peaking_factor
peaking_factor(central, volume_avg)
Profile peaking factor, central value over volume average.
\[\mathrm{PF} = \frac{X(0)}{\langle X\rangle}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
central | float | any | Value on the magnetic axis. |
volume_avg | float | any | Volume average of the same quantity, same unit. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Peaking factor. |
Limitations.
No guard against a zero volume average. Tracked in #357.
See Also.
vaft.formula.utils.calculate_peaking_factor
phi_from_Bphi
phi_from_Bphi(B_phi, dA)
Convention-sensitive.
Toroidal flux $\Phi$ through a poloidal cross-section.
\[\Phi = \int_{S} B_\varphi\,dA \approx \sum_i B_{\varphi,i}\,\Delta A_i\]| Parameter | Type | Unit | Description |
|---|---|---|---|
B_phi | np.ndarray | T | Toroidal magnetic field on the area elements. |
dA | np.ndarray | m^2 | Poloidal-plane area element of each sample, same shape as |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | Wb | Toroidal flux through the surface. |
Convention.
Full weber, never per radian: toroidal flux carries no $2\pi$ ambiguity. The sign is that of $B_\varphi$, i.e. $\sigma_{B_\varphi}$ of the COCOS in use (COCOS 1-8 and 11-18 differ only in the poloidal flux).
Assumptions.
dA are true area elements of the cross-section bounded by the flux surface
of interest; the routine does not construct them.
Numerical notes.
A Riemann sum, not a quadrature rule: accuracy is first order in the cell size of the caller’s grid.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.4 (toroidal flux and the safety factor).
poloidal_field_factor
poloidal_field_factor(cocos, *, psi_per_radian=None)
Convention-sensitive.
Sauter Eq. 20 prefactor $k = \sigma_{R\varphi Z}\,\sigma_{B_p}/(2\pi)^{e_{B_p}}$.
\[B_R = \frac{k}{R}\,\frac{\partial\psi}{\partial Z}, \qquad B_Z = -\frac{k}{R}\,\frac{\partial\psi}{\partial R}\]The factor carries both the $2\pi$ normalisation and the orientation sign, so applying only the former leaves the field inverted for half the conventions.
| Parameter | Type | Unit | Description |
|---|---|---|---|
cocos | int or None | - | COCOS index (1-8, 11-18); |
psi_per_radian | bool or None, optional | bool | Storage family of the flux when |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Prefactor $k$ multiplying $\nabla\psi/R$. |
Convention.
cocos=None keeps the weber-per-radian, $k=-1$ behaviour that the rest of
this module assumed before conventions were explicit: the COCOS 2/3/6/7 form.
Pass an index to get any other; it is resolved through
vaft.data.cocos.cocos_spec, the single source of truth for the COCOS
model in VAFT. The two halves are established by different evidence, so they
can be known separately: psi_per_radian supplies the $2\pi$ half on its
own for a caller that settled the storage family without pinning the index
(an ODS whose flux scale is unambiguous while clockwise_phi leaves the
index open). It is consulted only when cocos is None, where the
orientation still falls back to $-1$; an index carries both halves and wins
outright.
See Also.
vaft.data.eqdsk.ods_psi_to_wb_per_radian_factor
References.
- O. Sauter and S. Yu. Medvedev, Comput. Phys. Commun. 184 (2013) 293, Eq. (20) and Table I.
psi_from_RBtheta
psi_from_RBtheta(R, B_theta, l, psi_axis=0.0)
Convention-sensitive.
Poloidal flux $\psi$ from a line integral of $R B_\theta$ across flux surfaces.
\[\psi(l) = \int_0^{l} R\,B_\theta\,dl' + \psi_a\]along a path $l$ that crosses the flux surfaces (the outboard midplane, say), where $B_\theta$ is the poloidal field component normal to the path. This is the inverse of $B_p = |\nabla\psi|/R$, so the result is the flux per radian.
| Parameter | Type | Unit | Description |
|---|---|---|---|
R | np.ndarray | m | Major radius along the integration path. |
B_theta | np.ndarray | T | Poloidal magnetic field normal to the path, same shape as |
l | np.ndarray | m | Path coordinate, monotonic, same shape as |
psi_axis | float, optional | Wb/rad | Flux at the start of the path, added as an offset; default 0. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray | Wb/rad | Poloidal flux at every point of the path. |
Convention.
Returns flux per radian, $\psi = \int R B_\theta\,dl$, the COCOS 1-8 storage
of an EFIT g-file or of VFIT. Multiply by $2\pi$ for the IMAS Data
Dictionary’s full-weber equilibrium.*.psi (COCOS 11-18). The sign follows
the sign of B_theta and the direction of l; nothing is re-oriented.
Assumptions.
Axisymmetry, and that B_theta is the component perpendicular to the path
so that $R B_\theta\,dl$ is exactly $d\psi$.
Numerical notes.
Trapezoidal rule (numpy.trapezoid) on the supplied samples; the result is
returned only at the sample points and is second-order accurate in the
spacing of l.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.2 (flux functions).
- O. Sauter and S. Yu. Medvedev, Comput. Phys. Commun. 184 (2013) 293, Sec. 2 and Table I (per-radian versus full-weber flux).
psi_normalised
psi_normalised(psi, psi_axis, psi_boundary)
Convention-sensitive.
Normalised poloidal flux $\psi_N$.
\[\psi_N = \frac{\psi - \psi_a}{\psi_b - \psi_a}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
psi | float or np.ndarray | Wb/rad or Wb | Poloidal flux. |
psi_axis | float | Wb/rad or Wb | Flux at the magnetic axis, same unit as |
psi_boundary | float | Wb/rad or Wb | Flux at the plasma boundary, same unit as |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | - | Normalised flux, 0 on axis and 1 at the boundary. |
Convention.
Independent of the $2\pi$ storage convention and of the COCOS sign, because
both cancel in the ratio, provided all three inputs share one convention.
Equals the IMAS profiles_1d.psi_norm label.
Limitations.
Divides by psi_boundary - psi_axis without a guard; a degenerate
equilibrium with equal axis and boundary flux returns inf/nan.
Tracked in #357.
See Also.
vaft.formula.utils.normalize_profile
q_cyl_from_B_R_epsilon_kappa_I
q_cyl_from_B_R_epsilon_kappa_I(B_t_T, R_geo_m, epsilon, kappa_a, I_p_A) — aliases calc_q_cyl
Convention-sensitive.
Cylindrical safety factor in the Verdoolaege convention.
\[q_{cyl} = 5\times10^{6}\,\frac{B_t\,R_{geo}\,\varepsilon^2\,\kappa_a}{I_p\,[\mathrm{A}]}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
B_t_T | float or np.ndarray | T | Toroidal field, strictly positive. |
R_geo_m | float or np.ndarray | m | Geometric major radius, strictly positive. |
epsilon | float or np.ndarray | - | Inverse aspect ratio, strictly positive. |
kappa_a | float or np.ndarray | - | Area elongation, strictly positive. |
I_p_A | float or np.ndarray | A | Plasma current, strictly positive. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | - | Cylindrical safety factor. |
Raises.
ValueError For non-finite or non-positive input.
Convention.
cylindrical_safety_factor_from_R_B_epsilon_I_f_kappa_delta with
$f = 1/\kappa_a$ and $2\pi/\mu_0 = 5\times10^6$; $\kappa_a$ is the area
elongation $S/(\pi a^2)$ of the confinement databases, not the boundary
elongation.
References.
- G. Verdoolaege et al., Nucl. Fusion 61 (2021) 076006, Sec. 2.
- ITER Physics Expert Groups, Nucl. Fusion 39 (1999) 2175, Ch. 2, Sec. 3.
q_from_phi
q_from_phi(psi, phi)
Convention-sensitive.
Safety factor $q$ as the flux derivative $d\Phi/d\psi$.
\[q = \frac{d\Phi}{d\psi}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
psi | np.ndarray | Wb/rad | Poloidal flux profile, monotonic. |
phi | np.ndarray | Wb | Toroidal flux enclosed by the same surfaces. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray | - | Safety factor on the input surfaces. |
Convention.
Sauter and Medvedev define $q = \sigma_{\rho\theta\varphi}\sigma_{B_p}
(2\pi)^{-e_{B_p}}\,d\Phi/d\psi$. This routine applies neither sign nor
$2\pi$: it is exact for psi in Wb/rad (COCOS 1-8, $e_{B_p}=0$) up to the
orientation sign, and returns $2\pi q$ when psi is the IMAS full-weber
flux. Convert with vaft.data.eqdsk.ods_psi_to_wb_per_radian_factor
first, or take profiles_1d.q from the equilibrium directly. Tracked in
#354.
Numerical notes.
numpy.gradient: second-order central differences in the interior,
first-order one-sided at the two ends, noise-amplifying; needs at least two
samples and a strictly monotonic psi.
References.
- O. Sauter and S. Yu. Medvedev, Comput. Phys. Commun. 184 (2013) 293, Eq. (17) and Table I.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.4.
q_from_rhoN
q_from_rhoN(psiN, rhoN, C=1.0)
Convention-sensitive.
Safety factor from the toroidal-flux label $\rho_N(\psi_N)$.
\[q = C\,\rho_N\,\frac{d\rho_N}{d\psi_N}, \qquad C = \frac{2\,\Phi_b}{\psi_b - \psi_a}\]follows from $\Phi = \Phi_b\rho_N^2$ and $q = d\Phi/d\psi$.
| Parameter | Type | Unit | Description |
|---|---|---|---|
psiN | np.ndarray | - | Normalised poloidal flux, monotonic. |
rhoN | np.ndarray | - | Normalised toroidal-flux radius on the same surfaces. |
C | float, optional | - | Prefactor $2\Phi_b/(\psi_b-\psi_a)$ with $\psi$ in Wb/rad; default 1. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray | - | Safety factor, or with the default |
Convention.
With C=1 the result is $q$ up to the constant $2\Phi_b/(\psi_b-\psi_a)$
and is only proportional to the true profile. Supply C from the
equilibrium (with $\psi$ per radian, or $2\pi$ smaller with full-weber
$\psi$) for absolute values; the orientation sign is not applied.
Numerical notes.
numpy.gradient of rhoN against psiN (second-order interior,
first-order ends); the on-axis value is dominated by the one-sided difference
and by $\rho_N\to0$.
References.
- O. Sauter and S. Yu. Medvedev, Comput. Phys. Commun. 184 (2013) 293, Eq. (17).
- F. L. Hinton and R. D. Hazeltine, Rev. Mod. Phys. 48 (1976) 239, Sec. II.B.
radial_magnetic_field_from_psi
radial_magnetic_field_from_psi(psi, R, Z, cocos=None)
Convention-sensitive.
Radial magnetic field $B_R$ from the poloidal flux map.
\[B_R = \frac{k}{R}\,\frac{\partial\psi}{\partial Z}, \qquad k = \frac{\sigma_{R\varphi Z}\,\sigma_{B_p}}{(2\pi)^{e_{B_p}}}\]with $k$ from poloidal_field_factor (Sauter Eq. 20).
| Parameter | Type | Unit | Description |
|---|---|---|---|
psi | np.ndarray | Wb/rad or Wb | Poloidal flux along the vertical direction; a 1-D cut in $Z$. |
R | np.ndarray or float | m | Major radius of the samples. |
Z | np.ndarray | m | Vertical coordinate of the samples, monotonic. |
cocos | int or None, optional | - | COCOS index fixing sign and $2\pi$; |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray | T | Radial field on the samples. |
Convention.
cocos=None assumes psi in Wb/rad with $\sigma_{B_p}\sigma_{R\varphi Z}
=-1$ (COCOS 2/3/6/7). A full-weber map (IMAS Data Dictionary,
vaft.formula.green.green_psi_exact) passed without cocos
overestimates $|B_R|$ by $2\pi$; convert with
vaft.data.eqdsk.ods_psi_to_wb_per_radian_factor or pass the index.
Assumptions.
Axisymmetry. The derivative is taken along the first axis of psi
against Z, so the map must be indexed [Z] or [Z, R]; a
[R, Z]-ordered 2-D array differentiates along the wrong axis.
Numerical notes.
numpy.gradient (second-order interior, first-order one-sided ends).
References.
- O. Sauter and S. Yu. Medvedev, Comput. Phys. Commun. 184 (2013) 293, Eq. (20) and Table I.
rhoN_from_phi
rhoN_from_phi(phi, phi_boundary)
Convention-sensitive.
Normalised toroidal-flux radius $\rho_N$.
\[\rho_N = \sqrt{\frac{\Phi}{\Phi_b}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
phi | float or np.ndarray | Wb | Toroidal flux enclosed by the surface. |
phi_boundary | float | Wb | Toroidal flux enclosed by the plasma boundary. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | - | Toroidal-flux label, 0 on axis and 1 at the boundary. |
Convention.
This is the IMAS rho_tor_norm label (the square root of normalised
toroidal flux), not the poloidal-flux label $\sqrt{\psi_N}$ nor a geometric
minor radius. phi and phi_boundary must carry the same sign; a
COCOS-sign mismatch between them produces nan from the square root.
Physical interpretation.
$\rho_N$ is the minor radius of the circular cylinder that would enclose the same toroidal flux at the same $B_0$, scaled to the boundary value.
References.
- F. L. Hinton and R. D. Hazeltine, Rev. Mod. Phys. 48 (1976) 239, Sec. II.B (flux-surface coordinates).
- IMAS Data Dictionary,
equilibrium.time_slice[:].profiles_1d.rho_tor_norm.
rhoN_from_qpsiN
rhoN_from_qpsiN(psiN, qpsiN)
Convention-sensitive.
Normalised toroidal-flux radius from the $q$ profile.
\[\rho_N = \sqrt{\frac{\int_0^{\psi_N} q\,d\psi_N'}{\int_0^{1} q\,d\psi_N'}}\]which is $\sqrt{\Phi/\Phi_b}$ since $d\Phi = q\,d\psi$ and the constants cancel in the ratio.
| Parameter | Type | Unit | Description |
|---|---|---|---|
psiN | np.ndarray | - | Normalised poloidal flux, increasing from 0. |
qpsiN | np.ndarray | - | Safety factor on the same surfaces. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray | - | Normalised toroidal-flux radius on the input surfaces. |
Convention.
Independent of the $\psi$ unit and of the COCOS sign as long as qpsiN
does not change sign; a signed $q$ (COCOS with $\sigma_{\rho\theta\varphi}=-1$)
must be passed as $|q|$ or the square root returns nan.
Assumptions.
psiN starts at the magnetic axis; the integral is taken from the first
sample, so a profile that starts inside the plasma is mis-normalised.
Numerical notes.
Cumulative trapezoidal integral rebuilt from scratch at every sample ($O(N^2)$; tracked in #357); the denominator is not guarded against zero.
References.
- F. L. Hinton and R. D. Hazeltine, Rev. Mod. Phys. 48 (1976) 239, Sec. II.B.
rho_star_from_M_T_B_R_epsilon
rho_star_from_M_T_B_R_epsilon(M_eff_amu, T_eV, B_t_T, R_geo_m, epsilon) — aliases calc_rho_star
Convention-sensitive.
Normalised ion gyroradius $\rho_*$ in the Verdoolaege engineering form.
\[\rho_* = 1.44\times10^{-4}\,\frac{\sqrt{M_{eff}\,[\mathrm{amu}]\;T\,[\mathrm{eV}]}} {B_t\,[\mathrm{T}]\,R_{geo}\,[\mathrm{m}]\,\varepsilon}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
M_eff_amu | float or np.ndarray | amu | Effective ion mass, strictly positive. |
T_eV | float or np.ndarray | eV | Temperature, strictly positive. |
B_t_T | float or np.ndarray | T | Toroidal field, strictly positive. |
R_geo_m | float or np.ndarray | m | Geometric major radius, strictly positive. |
epsilon | float or np.ndarray | - | Inverse aspect ratio, strictly positive. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | - | Normalised gyroradius. |
Raises.
ValueError For non-finite or non-positive input.
Convention.
$1.44\times10^{-4} = \sqrt{2m_p/e}$, i.e. $\rho_i = \sqrt{2m_iT}/(eB)$
normalised by $a = R_{geo}\varepsilon$: the same physics as
normalized_larmor_radius_from_M_T_a_Bt in database units. Tracked
with the other $\rho_*$ definitions in #353.
References.
- G. Verdoolaege et al., Nucl. Fusion 61 (2021) 076006, Sec. 2.
rho_tor_from_phi
rho_tor_from_phi(phi, B0)
Convention-sensitive.
| Dimensional toroidal-flux radius $\rho_{tor} = \sqrt{ | \Phi | /(\pi | B_0 | )}$. |
| Parameter | Type | Unit | Description |
|---|---|---|---|
phi | float or np.ndarray | Wb | Toroidal flux enclosed by the surface. |
B0 | float | T | Vacuum toroidal field at the reference major radius. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | m | Toroidal-flux radius. |
Convention.
The IMAS rho_tor coordinate: the minor radius of the circle that
would carry the same toroidal flux in a uniform field $B_0$, with $B_0 =$
vacuum_toroidal_field.b0 at r0. Absolute values are taken, so the
result is independent of the COCOS signs of $\Phi$ and $B_0$; divide by
the boundary value for rhoN_from_phi’s rho_tor_norm.
Physical interpretation.
A length-like flux label that reduces to the geometric minor radius for a circular, large-aspect-ratio plasma with uniform $B_0$.
References.
- IMAS Data Dictionary,
equilibrium.time_slice[:].profiles_1d.rho_tor. - F. L. Hinton and R. D. Hazeltine, Rev. Mod. Phys. 48 (1976) 239, Sec. II.B.
shear_from_r_q
shear_from_r_q(r, q) — aliases magnetic_shear
Convention-sensitive.
Magnetic shear $s$ of the safety-factor profile.
\[s = \frac{r}{q}\,\frac{dq}{dr}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
r | np.ndarray | m or - | Flux-surface radius label, monotonic; minor radius or $\rho_N$. |
q | np.ndarray | - | Safety factor on the same surfaces. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray | - | Local magnetic shear. |
Convention.
The logarithmic derivative $d\ln q/d\ln r$, the definition used in the $s$-$\alpha$ ballooning diagram; any monotonic radius label gives the same number up to the choice of $r$ (minor radius versus $\rho_N$ differ in the Shafranov-shifted region). Sign is that of $dq/dr$, which is independent of COCOS.
Physical interpretation.
Rate at which field-line pitch changes across surfaces; positive shear stabilises ballooning modes at low $\alpha$ and localises resonant perturbations.
Numerical notes.
numpy.gradient (second-order interior, first-order ends), then division by
q and multiplication by r: the axis value is exactly 0 when r
starts at 0 and undefined where $q$ crosses zero.
References.
- J. W. Connor, R. J. Hastie and J. B. Taylor, Phys. Rev. Lett. 40 (1978) 396, definition of $s$.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 6.13.
spitzer_resistivity_from_T_e_Z_eff_ln_Lambda
spitzer_resistivity_from_T_e_Z_eff_ln_Lambda(T_e, Z_eff=2.0, ln_Lambda=17.0)
Convention-sensitive.
Spitzer parallel resistivity $\eta_\parallel$.
\[\eta = 5.2\times10^{-5}\,\frac{Z_{\mathrm{eff}}\,\ln\Lambda}{T_e^{3/2}} \quad[\Omega\,\mathrm{m}],\ T_e\ \text{in eV}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
T_e | float | eV | Electron temperature. |
Z_eff | float, optional | - | Effective ion charge; default 2. |
ln_Lambda | float, optional | - | Coulomb logarithm; default 17. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | Ohm m | Parallel resistivity. |
Convention.
The NRL Formulary value $\eta_\parallel = 1.65\times10^{-9}\,Z\ln\Lambda\, T_{\mathrm{keV}}^{-3/2}\ \Omega$ m rewritten for $T_e$ in eV; the $Z_{\mathrm{eff}}$ factor is applied linearly (the Spitzer-Harm $Z$-dependence is weaker than linear for $Z>1$).
Assumptions.
Classical collisional plasma, no neoclassical trapped-particle correction.
Validity.
Core tokamak plasmas well above the ionisation stage; the defaults
$Z_{\mathrm{eff}}=2$ and $\ln\Lambda=17$ are typical rather than derived,
use coulomb_logarithm_from_n_T for a self-consistent value.
Limitations.
Neoclassical resistivity in a spherical tokamak exceeds this by the trapped-fraction factor (up to ~2 at VEST aspect ratio).
References.
- NRL Plasma Formulary (2019), p. 29 (Spitzer resistivity).
- L. Spitzer and R. Harm, Phys. Rev. 89 (1953) 977.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 2.16 (resistivity).
stored_energy_from_beta_V
stored_energy_from_beta_V(beta, B0, V)
Convention-sensitive.
Stored energy from toroidal beta, $W = \beta B_0^2 V/(2\mu_0)$.
\[W = \beta\,\frac{B_0^2}{2\mu_0}\,V\]| Parameter | Type | Unit | Description |
|---|---|---|---|
beta | float | - | Toroidal beta as a fraction (not percent), $\langle p\rangle/(B_0^2/2\mu_0)$. |
B0 | float | T | Toroidal field on axis. |
V | float | m^3 | Plasma volume. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | J | Energy $\langle p\rangle V$. |
Convention.
Uses the fraction form of $\beta_t$; a percentage input is 100 times too
large. As for stored_energy_from_p_V, the result is $\langle p\rangle
V$, so the thermal energy is 1.5 times it.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.5 (definition of beta).
stored_energy_from_p_V
stored_energy_from_p_V(p, V)
Convention-sensitive.
Stored energy as pressure times volume, $W = pV$.
\[W = \int p\,dV \approx p\,V\]| Parameter | Type | Unit | Description |
|---|---|---|---|
p | float or np.ndarray | Pa | Pressure; a volume-averaged value gives the total energy. |
V | float | m^3 | Plasma volume. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float or np.ndarray | J | Energy $pV$. |
Convention.
$pV$ is the magnetic-like energy normalisation; the thermal energy of an
ideal gas is $W_{th} = \tfrac{3}{2}\int p\,dV$, so multiply by 1.5 for the
IMAS energy_thermal convention.
Assumptions.
p is the volume average (or the profile is flat) when V is the total
volume.
surface_poloidal_flux_from_psi_boundary
surface_poloidal_flux_from_psi_boundary(psi_boundary)
Convention-sensitive.
Total poloidal flux at the plasma surface, $\Phi_{surface} = 2\pi\psi_b$.
\[\Phi_{\mathrm{surface}} = 2\pi\,\psi_b\]| Parameter | Type | Unit | Description |
|---|---|---|---|
psi_boundary | np.ndarray or float | Wb/rad | Poloidal flux at the plasma boundary. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray or float | Wb | Surface flux in full weber. |
Convention.
Converts a per-radian boundary flux (COCOS 1-8, EFIT g-file, VFIT) to the full
flux that flux-consumption bookkeeping uses. An IMAS full-weber
global_quantities.psi_boundary (COCOS 11-18) must not be passed: the
result would be $2\pi$ too large. Tracked in #354.
Physical interpretation.
The poloidal flux linked by the plasma boundary, whose time derivative is the surface loop voltage in the Ejima flux-consumption balance.
References.
- S. Ejima et al., Nucl. Fusion 22 (1982) 1313, Sec. 2.
- O. Sauter and S. Yu. Medvedev, Comput. Phys. Commun. 184 (2013) 293, Table I.
toroidal_flux_from_q_psi
toroidal_flux_from_q_psi(q, psi_wb)
Convention-sensitive.
Cumulative toroidal flux $\Phi(\psi)$ from the $q$ profile on a full-weber grid.
\[\Phi(\psi) = \int_{\psi_a}^{\psi} q\,d\psi', \qquad \psi\ \text{in Wb}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
q | np.ndarray | - | Safety factor on the flux grid. |
psi_wb | np.ndarray | Wb | Poloidal flux of the same surfaces, monotonic, full weber. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray | Wb | Toroidal flux enclosed by each surface, starting at zero. |
Convention.
psi_wb is the IMAS Data Dictionary flux (COCOS 11-18). No $2\pi$
appears because $d\Phi/d\psi_{rad} = 2\pi q$ and $\psi_{wb} = 2\pi
\psi_{rad}$ cancel; pass 2*np.pi*psi_rad for an EFIT or VFIT
per-radian profile (vaft.data.eqdsk.ods_psi_to_wb_per_radian_factor
settles which family an ODS holds). The orientation sign of $q$ and
$\psi$ is not applied: a COCOS with $\sigma_{\rho\theta\varphi} = -1$
gives a negative $\Phi$.
Numerical notes.
Cumulative trapezoidal rule (scipy.integrate.cumulative_trapezoid via
vaft.compat.cumtrapz_compat); second order in the grid spacing,
and the result is the running integral, so its first element is zero.
References.
- O. Sauter and S. Yu. Medvedev, Comput. Phys. Commun. 184 (2013) 293, Eq. (17) and Table I.
- IMAS Data Dictionary,
equilibrium.time_slice[:].profiles_1d.phi.
triangularity_from_RZ_boundary
triangularity_from_RZ_boundary(R, Z, R0)
Convention-sensitive.
Boundary triangularity $\delta$ from the midplane intersection.
\[\delta = \frac{R_0 - R_{\mathrm{sep}}|_{Z=0}}{a}, \qquad a = \frac{R_{\max} - R_{\min}}{2}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
R | np.ndarray | m | Major radius of the boundary points. |
Z | np.ndarray | m | Height of the boundary points. |
R0 | float | m | Reference major radius, normally the geometric centre. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Triangularity. |
Convention.
Uses the single boundary point closest to $Z=0$, so the result is a
property of the midplane crossing chosen by argmin, not the standard
$\delta = (R_0 - R_{Z_{\max}})/a$ evaluated at the top and bottom
extremities (IMAS triangularity_upper/lower). Positive means the
crossing lies inboard of R0.
Limitations.
Whether the inboard or outboard midplane point is picked depends on which is nearer $Z=0$ in the sampling, so the sign is not stable; prefer the IMAS-style extremity definition for reported values. Tracked in #365.
References.
- IMAS Data Dictionary,
equilibrium.time_slice[:].boundary.triangularity. - J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.1.
verify_kadomtsev_constraint
verify_kadomtsev_constraint(mu_rho, mu_beta, mu_nu, a_P)
Reconstruct the Kadomtsev constraint value from dimensionless indices.
\[x = 5 + \mu_\rho(1 + \alpha_P) - \frac{3}{2}\left(\mu_\rho + 2\mu_\beta - 4\mu_\nu - 2\right)\]which should return 5 when the dimensionless mapping of
dimensionless_scaling_coeffs_from_engineering_scaling_coeffs
preserves the identity $\alpha_L + 2\alpha_n + \alpha_B^* - 3\alpha_P = 5$.
| Parameter | Type | Unit | Description |
|---|---|---|---|
mu_rho | float | - | Gyroradius index. |
mu_beta | float | - | Beta index. |
mu_nu | float | - | Collisionality index. |
a_P | float | - | Engineering exponent of the heating power. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Reconstructed constraint value, 5 for a consistent mapping. |
Limitations.
Evaluates a different expression from
check_kadomtsev_constraint (which uses the engineering exponents
directly) and the two need not agree; tracked in #351.
References.
- B. B. Kadomtsev, Sov. J. Plasma Phys. 1 (1975) 295.
- T. C. Luce, C. C. Petty and J. G. Cordey, Plasma Phys. Control. Fusion 50 (2008) 043001.
vertical_magnetic_field_from_psi
vertical_magnetic_field_from_psi(psi, R, Z, cocos=None)
Convention-sensitive.
Vertical magnetic field $B_Z$ from the poloidal flux map.
\[B_Z = -\frac{k}{R}\,\frac{\partial\psi}{\partial R}, \qquad k = \frac{\sigma_{R\varphi Z}\,\sigma_{B_p}}{(2\pi)^{e_{B_p}}}\]with $k$ from poloidal_field_factor (Sauter Eq. 20).
| Parameter | Type | Unit | Description |
|---|---|---|---|
psi | np.ndarray | Wb/rad or Wb | Poloidal flux along the radial direction; a 1-D cut in $R$. |
R | np.ndarray | m | Major radius of the samples, monotonic. |
Z | np.ndarray | m | Vertical coordinate of the samples, unused by the derivative. |
cocos | int or None, optional | - | COCOS index fixing sign and $2\pi$; |
| Returns | Type | Unit | Description |
|---|---|---|---|
| np.ndarray | T | Vertical field on the samples. |
Convention.
cocos=None assumes psi in Wb/rad with $\sigma_{B_p}\sigma_{R\varphi Z}
=-1$ (COCOS 2/3/6/7). A full-weber map (IMAS Data Dictionary,
vaft.formula.green.green_psi_exact) passed without cocos
overestimates $|B_Z|$ by $2\pi$; convert with
vaft.data.eqdsk.ods_psi_to_wb_per_radian_factor or pass the index.
Assumptions.
Axisymmetry. The derivative is taken along the first axis of psi
against R, so the map must be indexed [R] or [R, Z].
Numerical notes.
numpy.gradient (second-order interior, first-order one-sided ends).
References.
- O. Sauter and S. Yu. Medvedev, Comput. Phys. Commun. 184 (2013) 293, Eq. (20) and Table I.
virial_D0_boundary_from_bp_li_eK
virial_D0_boundary_from_bp_li_eK(beta_p, li_int, eK, b_minor, R_plasma)
Convention-sensitive.
Boundary Shafranov shift $D_0(b)$ from $\beta_p$, $l_i$ and elongation.
\[D_0(b) = -\frac{b}{2R_{\mathrm{plasma}}}\; \frac{2\beta_p + l_i + \tfrac{1}{2}e_K}{1 + \tfrac{1}{2}e_K}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
beta_p | float | - | Poloidal beta. |
li_int | float | - | Internal inductance. |
eK | float | - | Elongation parameter $(\kappa^2-1)/(\kappa^2+1)$. |
b_minor | float | m | Minor radius at which the shift is evaluated. |
R_plasma | float | m | Plasma major radius. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Normalised shift $D_0$ at radius |
Convention.
Negative sign convention of Martynov and Pustovitov: the magnetic axis moves outboard, so $D_0 < 0$ for positive $\beta_p + l_i/2$.
Validity.
First order in $b/R$; elongation through $e_K$ only.
References.
- A. A. Martynov and V. D. Pustovitov, Phys. Plasmas 31 (2024), “Virial relations for elongated plasmas in tokamaks”, Eq. (37).
virial_S1_approx
virial_S1_approx()
Convention-sensitive.
Leading-order value of the first Shafranov integral, $S_1 = 2$.
\[S_1 = 2 + O(\epsilon, D_0, \delta)\]| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | The constant 2. |
Convention.
Lao/EFIT normalisation of the surface integrals by $B_{pa}$ and the plasma volume, in which $S_1\to2$ for a circular, unshifted, large-aspect-ratio boundary.
Validity.
Valid to first order in inverse aspect ratio, Shafranov shift $D_0$ and triangularity; a placeholder when the surface integral itself is unavailable.
References.
- A. A. Martynov and V. D. Pustovitov, Phys. Plasmas 31 (2024), “Virial relations for elongated plasmas in tokamaks”, Sec. III.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421.
virial_S2_approx_from_D0_a_R0
virial_S2_approx_from_D0_a_R0(eK, D0, a_minor, R0)
Convention-sensitive.
Analytic approximation of the second Shafranov integral for an elongated boundary.
\[S_2 = -\frac{2a}{R_0}\,(D_0 + 1)\left(1 + \frac{e_K}{2}\right)\]| Parameter | Type | Unit | Description |
|---|---|---|---|
eK | float | - | Elongation parameter $(\kappa^2-1)/(\kappa^2+1)$. |
D0 | float | - | Normalised Shafranov shift of the boundary. |
a_minor | float | m | Minor radius. |
R0 | float | m | Reference major radius. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | $S_2$. |
Convention.
Lao/EFIT normalisation of the surface integrals; $D_0$ as defined by Martynov and Pustovitov (shift over minor radius).
Validity.
First order in $a/R_0$ and in the shift; elongation enters only through $e_K$.
References.
- A. A. Martynov and V. D. Pustovitov, Phys. Plasmas 31 (2024), “Virial relations for elongated plasmas in tokamaks”, Eq. (21).
virial_S3_approx_from_eK_d
virial_S3_approx_from_eK_d(eK, d_param)
Convention-sensitive.
Analytic approximation of the third Shafranov integral for an elongated boundary.
\[S_3 = 1 - \frac{e_K}{2} - \delta\left(1 - \frac{e_K^2}{2}\right)\]| Parameter | Type | Unit | Description |
|---|---|---|---|
eK | float | - | Elongation parameter $(\kappa^2-1)/(\kappa^2+1)$. |
d_param | float | - | Triangularity-like shape parameter $\delta$ of the approximation. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | $S_3$. |
Convention.
Lao/EFIT normalisation of the surface integrals.
Validity.
First order in the shape parameters.
References.
- A. A. Martynov and V. D. Pustovitov, Phys. Plasmas 31 (2024), “Virial relations for elongated plasmas in tokamaks”, Eq. (22).
virial_beta_p_from_S_alpha_mu
virial_beta_p_from_S_alpha_mu(S1, S2, S3, alpha, mui_hat)
Convention-sensitive.
Poloidal beta from the Shafranov integrals, low-aspect-ratio closure.
\[\beta_p = \frac{(S_1 + S_2)(\alpha - 1) + \alpha\hat\mu_i + S_3}{3(\alpha-1) + 1}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
S1 | float | - | First Shafranov surface integral. |
S2 | float | - | Second Shafranov surface integral. |
S3 | float | - | Third Shafranov surface integral. |
alpha | float | - | Closure coefficient multiplying $l_i$ in the third virial relation. |
mui_hat | float | - | Diamagnetic parameter $\hat\mu_i$. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Poloidal beta. |
Convention.
$S_1$-$S_3$ and $\hat\mu_i$ in the Lao/EFIT normalisation by $B_{pa}$
(virial_beta_p_from_volume). The closure retains the diamagnetic
term, so it holds at low aspect ratio where the Lao form does not.
References.
- M. W. Bongard et al., Phys. Plasmas 23 (2016), low-aspect-ratio virial closure (journal page not recorded in the VAFT source).
- V. D. Shafranov, Plasma Phys. 13 (1971) 757.
virial_beta_p_from_S_li
virial_beta_p_from_S_li(S1, S2, li)
Poloidal beta from $S_1$, $S_2$ and a known internal inductance.
\[\beta_p^{\mathrm{vir}} = \frac{S_1}{4} + \frac{S_2}{2} - \frac{l_i}{2}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
S1 | float | - | First Shafranov surface integral. |
S2 | float | - | Second Shafranov surface integral. |
li | float | - | Internal inductance. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Poloidal beta. |
Physical interpretation.
Solves the first virial relation $S_1 + S_2 = 3\beta_p + l_i - \hat l_i$ for $\beta_p$ after dropping $\hat l_i$ and rescaling, giving the classic “$\beta_p + l_i/2$ from magnetics” separation when $l_i$ is known independently.
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 3.
virial_beta_p_from_volume
virial_beta_p_from_volume(p, dV, B_pa, Omega, mu0=None)
Convention-sensitive.
Poloidal beta from a volume integral of pressure.
\[\beta_p = \frac{2\mu_0}{B_{pa}^2\,\Omega}\int_\Omega p\,dV\]| Parameter | Type | Unit | Description |
|---|---|---|---|
p | np.ndarray | Pa | Pressure at each cell. |
dV | np.ndarray | m^3 | Volume of each cell. |
B_pa | float | T | Boundary-averaged poloidal field, $\mu_0 I_p/L_p$. |
Omega | float | m^3 | Plasma volume $\Omega = \sum dV$. |
mu0 | float, optional | H/m | Vacuum permeability; default |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Poloidal beta. |
Convention.
The EFIT/Lao definition normalised by $B_{pa} = \mu_0 I_p/L_p$ with $L_p$ the boundary contour length, as used by the virial closures below. Other codes normalise by $B_p$ at the boundary or by $\mu_0 I_p/(2\pi a)$; the values differ by shape-dependent factors.
Numerical notes.
Plain weighted sum over the supplied cells.
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 2.
- V. D. Shafranov, Plasma Phys. 13 (1971) 757.
virial_beta_p_lao_from_S_mu_rt
virial_beta_p_lao_from_S_mu_rt(S1, S2, mui, RT_over_R0)
Poloidal beta, Lao large-aspect-ratio virial closure.
\[\beta_p = \frac{S_1}{2} + \frac{S_2}{2}\left(1 + \frac{R_T}{R_0}\right) + \mu_i\]| Parameter | Type | Unit | Description |
|---|---|---|---|
S1 | float | - | First Shafranov surface integral. |
S2 | float | - | Second Shafranov surface integral. |
mui | float | - | Diamagnetic parameter $\mu_i$. |
RT_over_R0 | float | - | Current-centroid radius over reference radius, $R_T/R_0$. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Poloidal beta. |
Validity.
Large aspect ratio; at VEST aspect ratio the neglected $\epsilon$ terms reach tens of percent, which is why the Bongard closure exists.
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 3.
virial_beta_p_li_from_S_alpha_mu_rt
virial_beta_p_li_from_S_alpha_mu_rt(S1, S2, S3, alpha, mui, RT_over_R0, eps=1e-12)
Lao closure bundle: $\beta_p$, $l_i$ and $\beta_{p,d}$ in one call.
Evaluates virial_beta_p_lao_from_S_mu_rt,
virial_li_from_S_alpha_rt and virial_beta_pd_from_S_mu_rt
on the same inputs.
| Parameter | Type | Unit | Description | |||
|---|---|---|---|---|---|---|
S1 | float | - | First Shafranov surface integral. | |||
S2 | float | - | Second Shafranov surface integral. | |||
S3 | float | - | Third Shafranov surface integral. | |||
alpha | float | - | Closure coefficient multiplying $l_i$ in the third virial relation. | |||
mui | float | - | Diamagnetic parameter $\mu_i$. | |||
RT_over_R0 | float | - | Current-centroid radius over reference radius. | |||
eps | float, optional | - |
|
| Returns | Type | Unit | Description |
|---|---|---|---|
beta_p_lao | float | - | Poloidal beta. |
li_lao | float | - | Internal inductance. |
beta_pd_vir | float | - | Diamagnetic poloidal beta. |
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 3.
virial_beta_pd_from_S_mu_rt
virial_beta_pd_from_S_mu_rt(S1, S2, mui, RT_over_R0)
Diamagnetic poloidal beta $\beta_{p,d}$ from $S_1$, $S_2$ and $\mu_i$.
\[\beta_{p,d}^{\mathrm{vir}} = \frac{S_1}{2} - \mu_i + \frac{S_2}{2}\left(1 - \frac{R_T}{R_0}\right)\]| Parameter | Type | Unit | Description |
|---|---|---|---|
S1 | float | - | First Shafranov surface integral. |
S2 | float | - | Second Shafranov surface integral. |
mui | float | - | Diamagnetic parameter $\mu_i$. |
RT_over_R0 | float | - | Current-centroid radius over reference radius. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Diamagnetic poloidal beta. |
Validity.
Large aspect ratio (Lao closure).
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 3.
virial_bongard_from_S_alpha_mu
virial_bongard_from_S_alpha_mu(S1, S2, S3, alpha, mui)
Low-aspect-ratio virial closure (Bongard 2016): $\beta_p$ and $l_i$.
Evaluates virial_beta_p_from_S_alpha_mu and
virial_li_from_S_alpha_mu.
| Parameter | Type | Unit | Description |
|---|---|---|---|
S1 | float | - | First Shafranov surface integral. |
S2 | float | - | Second Shafranov surface integral. |
S3 | float | - | Third Shafranov surface integral. |
alpha | float | - | Closure coefficient multiplying $l_i$ in the third virial relation. |
mui | float | - | Diamagnetic parameter $\hat\mu_i$. |
| Returns | Type | Unit | Description |
|---|---|---|---|
beta_p_bongard | float | - | Poloidal beta. |
li_bongard | float | - | Internal inductance. |
References.
- M. W. Bongard et al., Phys. Plasmas 23 (2016), low-aspect-ratio virial closure (journal page not recorded in the VAFT source).
virial_bp_li_lihat_from_S123
virial_bp_li_lihat_from_S123(S1, S2, S3, a_param, RT_over_R0)
Solve the three virial relations for $\beta_p$, $l_i$ and $\hat l_i$.
\[3\beta_p + l_i - \hat l_i = S_1 + S_2, \qquad \beta_p + l_i + \hat l_i = \frac{R_T}{R_0}S_2, \qquad \beta_p - (\alpha-1)\,l_i - \hat l_i = S_3\]| Parameter | Type | Unit | Description |
|---|---|---|---|
S1 | float | - | First Shafranov surface integral. |
S2 | float | - | Second Shafranov surface integral. |
S3 | float | - | Third Shafranov surface integral. |
a_param | float | - | Closure coefficient $\alpha$ of the third relation. |
RT_over_R0 | float | - | Current-centroid radius over reference radius. |
| Returns | Type | Unit | Description |
|---|---|---|---|
beta_p | float | - | Poloidal beta. |
li_int | float | - | Internal inductance. |
li_hat | float | - | Toroidal-field contribution $\hat l_i$. |
Numerical notes.
Direct solve of the 3x3 linear system with numpy.linalg.solve; singular
when $\alpha = 1/3$ (rows become dependent).
References.
- A. A. Martynov and V. D. Pustovitov, Phys. Plasmas 31 (2024), “Virial relations for elongated plasmas in tokamaks”, Eqs. (1)-(3).
- V. D. Shafranov, Plasma Phys. 13 (1971) 757.
virial_kinetic_energy
virial_kinetic_energy(n, v, m, V)
Bulk kinetic energy of a sampled flow, $W_{kin} = \tfrac{1}{2}\sum n m v^2\,V$.
\[W_{\mathrm{kin}} = \int\frac{1}{2}\,n\,m\,v^2\,dV\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n | np.ndarray | m^-3 | Number density at each sample. |
v | np.ndarray | m/s | Flow speed at each sample. |
m | float | kg | Particle mass. |
V | float | m^3 | Volume attributed to each sample. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | J | Kinetic energy of the flow. |
Assumptions.
Equal-volume samples (V is the cell volume); the flow is a bulk velocity,
not a thermal speed.
References.
- V. D. Shafranov, in Reviews of Plasma Physics, Vol. 2, Consultants Bureau (1966), p. 103.
virial_lao_from_S_alpha_mu_rt
virial_lao_from_S_alpha_mu_rt(S1, S2, S3, alpha, mui, RT_over_R0, eps=1e-12)
Large-aspect-ratio virial closure (Lao 1985): $\beta_p$ and $l_i$.
Evaluates virial_beta_p_lao_from_S_mu_rt and
virial_li_from_S_alpha_rt.
| Parameter | Type | Unit | Description | |||
|---|---|---|---|---|---|---|
S1 | float | - | First Shafranov surface integral. | |||
S2 | float | - | Second Shafranov surface integral. | |||
S3 | float | - | Third Shafranov surface integral. | |||
alpha | float | - | Closure coefficient multiplying $l_i$ in the third virial relation. | |||
mui | float | - | Diamagnetic parameter $\mu_i$. | |||
RT_over_R0 | float | - | Current-centroid radius over reference radius. | |||
eps | float, optional | - |
|
| Returns | Type | Unit | Description |
|---|---|---|---|
beta_p_lao | float | - | Poloidal beta. |
li_lao | float | - | Internal inductance. |
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 3.
virial_li_from_S_alpha_mu
virial_li_from_S_alpha_mu(S1, S2, S3, alpha, mui_hat)
Convention-sensitive.
Internal inductance from the Shafranov integrals, low-aspect-ratio closure.
\[l_i = \frac{S_1 + S_2 - 2\hat\mu_i - 3S_3}{3\alpha - 2}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
S1 | float | - | First Shafranov surface integral. |
S2 | float | - | Second Shafranov surface integral. |
S3 | float | - | Third Shafranov surface integral. |
alpha | float | - | Closure coefficient multiplying $l_i$ in the third virial relation. |
mui_hat | float | - | Diamagnetic parameter $\hat\mu_i$. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Internal inductance. |
Convention.
Companion of virial_beta_p_from_S_alpha_mu, same normalisation.
Limitations.
Ill-conditioned as $\alpha\to2/3$; no guard.
References.
- M. W. Bongard et al., Phys. Plasmas 23 (2016), low-aspect-ratio virial closure (journal page not recorded in the VAFT source).
virial_li_from_S_alpha_rt
virial_li_from_S_alpha_rt(S1, S2, S3, alpha, RT_over_R0, eps=1e-12)
Internal inductance, Lao large-aspect-ratio virial closure.
\[l_i^{\mathrm{vir}} = \frac{\tfrac{S_1}{2} + \tfrac{S_2}{2}\left(1 - \tfrac{R_T}{R_0}\right) - S_3}{\alpha - 1}\]| Parameter | Type | Unit | Description | |||
|---|---|---|---|---|---|---|
S1 | float | - | First Shafranov surface integral. | |||
S2 | float | - | Second Shafranov surface integral. | |||
S3 | float | - | Third Shafranov surface integral. | |||
alpha | float | - | Closure coefficient multiplying $l_i$ in the third virial relation. | |||
RT_over_R0 | float | - | Current-centroid radius over reference radius. | |||
eps | float, optional | - |
|
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Internal inductance. |
Raises.
ValueError
When alpha is within eps of 1 (the closure is singular there).
Validity.
Large aspect ratio, as virial_beta_p_lao_from_S_mu_rt.
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 3.
virial_li_from_volume
virial_li_from_volume(B_p, dV, B_pa, Omega)
Convention-sensitive.
Internal inductance from a volume integral of $B_p^2$.
\[l_i = \frac{1}{B_{pa}^2\,\Omega}\int_\Omega B_p^2\,dV\]| Parameter | Type | Unit | Description |
|---|---|---|---|
B_p | np.ndarray | T | Poloidal field magnitude at each cell. |
dV | np.ndarray | m^3 | Volume of each cell. |
B_pa | float | T | Boundary-averaged poloidal field, $\mu_0 I_p/L_p$. |
Omega | float | m^3 | Plasma volume. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | Internal inductance. |
Convention.
Lao/EFIT normalisation by $B_{pa}$; not the IMAS $l_{i,3}$ (normalised by $(\mu_0 I_p)^2 R_0/2$) nor the cylindrical $l_i$.
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 2.
virial_magnetic_energy
virial_magnetic_energy(B, V)
Magnetic energy of a sampled field, $W_{mag} = \sum B^2\,V/(2\mu_0)$.
\[W_{\mathrm{mag}} = \int\frac{B^2}{2\mu_0}\,dV \approx \frac{V}{2\mu_0}\sum_i B_i^2\]| Parameter | Type | Unit | Description |
|---|---|---|---|
B | np.ndarray | T | Field magnitude at each sample. |
V | float | m^3 | Volume attributed to each sample. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | J | Magnetic energy. |
Assumptions.
Equal-volume samples: V multiplies the plain sum, so it is the cell
volume, not the total. Pass V_total / B.size for a uniform grid.
Numerical notes.
A Riemann sum, first order in the cell size.
References.
- V. D. Shafranov, in Reviews of Plasma Physics, Vol. 2, Consultants Bureau (1966), p. 103 (virial theorem for a confined plasma).
virial_muihat_from_Bt_R0_dphi
virial_muihat_from_Bt_R0_dphi(B_t, R0, dphi, B_pa, Omega)
Convention-sensitive.
Diamagnetic parameter $\hat\mu_i$ from the measured diamagnetic flux.
\[\hat\mu_i \approx \frac{4\pi\,B_t\,R_0\,\Delta\phi}{B_{pa}^2\,\Omega}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
B_t | float | T | Vacuum toroidal field at |
R0 | float | m | Major radius at which |
dphi | float | Wb | Diamagnetic flux $\Delta\phi$ (plasma-induced change of toroidal flux). |
B_pa | float | T | Boundary-averaged poloidal field. |
Omega | float | m^3 | Plasma volume. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | - | $\hat\mu_i$. |
Convention.
Sign follows dphi: a paramagnetic (low-$\beta_p$) plasma increases the
toroidal flux and gives $\hat\mu_i > 0$ in the sign convention of the
diamagnetic loop; check the loop’s polarity before comparing with a virial
closure. $\Delta\phi$ is a full-weber toroidal flux.
Assumptions.
Large-aspect-ratio expansion of the toroidal-field energy term, $B_t R_0$ constant over the cross-section.
References.
- L. L. Lao, H. St. John, R. D. Stambaugh and W. Pfeiffer, Nucl. Fusion 25 (1985) 1421, Sec. 2 ($\mu_i$ definition).
- V. D. Shafranov, Plasma Phys. 13 (1971) 757.
virial_stability_criterion
virial_stability_criterion(W_mag, W_kin, W_th)
Virial-ratio margin against the heuristic threshold $r_v = 0.5$.
\[\Delta = r_v - 0.5, \qquad r_v = \frac{W_{\mathrm{kin}} + W_{\mathrm{th}}}{W_{\mathrm{mag}}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
W_mag | float | J | Magnetic energy. |
W_kin | float | J | Bulk kinetic energy. |
W_th | float | J | Thermal energy. |
| Returns | Type | Unit | Description |
|---|---|---|---|
margin | float | - | $r_v - 0.5$. |
critical_ratio | float | - | The threshold 0.5. |
Limitations.
The threshold 0.5 is labelled “theoretical value for stability” in the original VAFT source but no derivation or reference for it was recorded; the scalar virial theorem constrains equilibrium, not stability. Treat the margin as a bookkeeping diagnostic. Tracked in #366.
References.
- V. D. Shafranov, in Reviews of Plasma Physics, Vol. 2, Consultants Bureau (1966), p. 103.
virial_theorem
virial_theorem(W_mag, W_kin, W_th)
Total energy and virial ratio of magnetic, kinetic and thermal contributions.
\[W_{\mathrm{total}} = W_{\mathrm{mag}} + W_{\mathrm{kin}} + W_{\mathrm{th}}, \qquad r_v = \frac{W_{\mathrm{kin}} + W_{\mathrm{th}}}{W_{\mathrm{mag}}}\]| Parameter | Type | Unit | Description |
|---|---|---|---|
W_mag | float | J | Magnetic energy. |
W_kin | float | J | Bulk kinetic energy. |
W_th | float | J | Thermal energy. |
| Returns | Type | Unit | Description |
|---|---|---|---|
W_total | float | J | Sum of the three energies. |
virial_ratio | float | - | Ratio of material to magnetic energy. |
Physical interpretation.
The scalar virial theorem forbids a plasma confined by its own fields alone: a positive-definite $W_{\mathrm{mag}}$ must be balanced by external (coil) fields, and the ratio measures how far the material energy is from that balance.
References.
- V. D. Shafranov, in Reviews of Plasma Physics, Vol. 2, Consultants Bureau (1966), p. 103.
- J. P. Freidberg, Ideal MHD, Cambridge University Press (2014), Sec. 3.6 (virial theorem).
virial_thermal_energy
virial_thermal_energy(n, T, V)
Convention-sensitive.
Thermal energy of a sampled plasma, $W_{th} = \tfrac{3}{2}\sum n T\,V$.
\[W_{\mathrm{th}} = \int\frac{3}{2}\,n\,T\,dV\]| Parameter | Type | Unit | Description |
|---|---|---|---|
n | np.ndarray | m^-3 | Number density at each sample. |
T | np.ndarray | J | Temperature at each sample, in energy units. |
V | float | m^3 | Volume attributed to each sample. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | J | Thermal energy. |
Convention.
T must be in joules ($k_B T$); a temperature in eV needs the factor
QE. One species only: sum electron and ion calls for the total.
Assumptions.
Equal-volume samples (V is the cell volume); three degrees of freedom.
References.
- V. D. Shafranov, in Reviews of Plasma Physics, Vol. 2, Consultants Bureau (1966), p. 103.
volume_from_RZ_boundary
volume_from_RZ_boundary(R, Z)
Plasma volume from a boundary polygon, mean-radius approximation.
\[V = 2\pi\oint R\,Z\,dR \approx 2\pi\,A_{\mathrm{poly}}\,\bar R\]| Parameter | Type | Unit | Description |
|---|---|---|---|
R | np.ndarray | m | Major radius of the boundary vertices, closed or open polygon. |
Z | np.ndarray | m | Height of the boundary vertices. |
| Returns | Type | Unit | Description |
|---|---|---|---|
| float | m^3 | Volume of the solid of revolution. |
Assumptions.
$\bar R$ is the arithmetic mean of the vertex radii, not the area centroid demanded by Pappus’ theorem; exact only for a boundary symmetric about $\bar R$.
Limitations.
On VEST flux surfaces the mean-radius factorisation differs from the exact
contour integral by up to ~6 % at the edge; use
exact_volume_from_RZ_contour for a reported volume.
Numerical notes.
Shoelace formula for the polygon area (exact for straight edges); the polygon
is implicitly closed by numpy.roll.
References.
- J. Wesson, Tokamaks, 4th ed., Oxford University Press (2011), Sec. 3.1 (plasma volume of a toroidal cross-section).
Refreshing this snapshot
From a checkout of the develop branch, run:
python -m vaft.formula.catalog --output /path/to/vaft-gh/_data/formula_catalog.yml
The snapshot records the SHA-256 of every vaft/formula/*.py source file; documentation
validation compares them when VAFT_REGISTRY_SOURCE points to the corresponding source checkout.
The same text is available offline as vaft.formula.describe("<name>"),
vaft.formula.search("<text>") and vaft.formula.list_formulas(category="<category>").