Theory
For a full operator-level derivation tied to the implemented code paths (normalization, Hermite-Laguerre projection, field equations, and growth-rate diagnostics), see Linear Model And Derivations. For the explicit implemented operator set, collisions, hypercollisions, nonlinear brackets, and parameter-to-source mapping, see Operators And Terms.
Gyrokinetic ordering
GKX targets the low-frequency, strongly magnetized regime where the characteristic fluctuation frequency is small compared to the ion cyclotron frequency. In this limit, the phase-space dynamics can be reduced to a five-dimensional gyrokinetic system for the non-adiabatic part of the distribution function. Classic derivations of the gyrokinetic equation can be found in Frieman & Chen (1982) and Antonsen & Lane (1980). [FC82] [AL80]
Flux-tube model
We employ a field-aligned, local flux-tube model in which the perpendicular spatial dependence is represented spectrally and the parallel coordinate is resolved along a field line. This approximation underlies the Cyclone base case benchmark commonly used in gyrokinetic validation studies. [Dimits00]
The default boundary condition is a linked (twist-and-shift) flux tube, so the
parallel derivative couples Fourier modes across adjacent \(k_x\) indices.
GridConfig(non_twist=True) selects the non-twisting flux tube (NTFT): the
linear cache shifts \(k_x\) along the field line by
\(\delta k_x = k_y f_{twist}(z) + \rho_* m_0/x_0\), with
\(f_{twist} = \hat{s}\,g_{ds21}/g_{ds22}\) and \(m_0\) the nearest-integer
link index, in both \(k_\perp\) and the drifts
(gkx.operators.linear.cache_builder._build_ntft_kperp_and_drift_arrays).
Hermite-Laguerre velocity space
The perturbed distribution is expanded in a Hermite (parallel velocity) and Laguerre (magnetic moment) basis. For a single species, the expansion is
where the normalized velocity basis includes the chosen Laguerre sign and Hermite normalization. Its projected gyroaverage coefficient, not the Laguerre polynomial evaluated at the wavenumber, is
where \(b = k_\perp^2 \rho^2\). This Laguerre-Hermite formulation is detailed by Mandell, Dorland & Landreman (2017). [MDL17]
Field solve and gyrokinetic variable
GKX supports electrostatic and electromagnetic linear closures. For electrostatic runs, quasineutrality is solved in Fourier space for \(\phi\), with an optional adiabatic response controlled by \(\tau_e = T_i/T_e\):
For Boltzmann electrons the \(k_y = 0\) response is \(\tau_e(\phi - \langle\phi\rangle)\), with \(\langle\cdot\rangle\) the flux-surface average, so zonal potential carries no electron response. Boltzmann ions (ETG runs) respond to the full \(\phi\). Every field-solve route, serial and sharded, applies the same rule.
Electromagnetic runs solve the coupled quasineutrality/perpendicular-Ampere system for \((\phi, B_\parallel)\) and then obtain \(A_\parallel\) from parallel Ampere’s law. The gyrokinetic variable is
with \(J_{\ell}^{B} = J_{\ell} + J_{\ell-1}\). These relations match the Laguerre-Hermite pseudo-spectral form used in the gyrokinetic literature.
The nonzonal field-system test in tests/unit/operators/test_terms_fields.py
assembles a separate dense \(3\times3\) system from
GX (arXiv v3), (32)–(34) at \(B=1\).
It uses two kinetic species with unequal temperatures/masses, finite FLR, and
separate density/current/perpendicular-moment excitations; float32/64 values
and normalized residuals must agree. Variable-\(B\) cases test GKX’s
additional \(B^{-2}\) perpendicular-Ampere convention only: its physical
normalization remains unqualified by those paper equations alone. The
independent physical-energy identification below supplies the additional field
normalization check. Zonal/gauge tests remain separate.
The companion geometry-to-field test checks the constant-\(B\), nonzonal quadratic implied by GX (arXiv v3), (12), (16), and (32)–(34). For the retained basis it independently forms
and
Howes et al. (2006), (B19)–(B20) identify the physical fluctuation energy as particle entropy plus magnetic energy. Applying quasineutrality and the corrected local-\(B\) field equations in published GX, (2.12) and (4.22)–(4.25) gives, mode by mode,
The fields here are dimensionless. GX Appendix A, Tables 4–5 normalize \(k_\perp\) by \(\rho_{\rm ref}^{-1}\), \(A_\parallel\) by \(\rho_*\rho_{\rm ref}B_N\), and \(\delta B_\parallel\) by \(\rho_*B_N\); GKX stores \(\mathtt{bpar}=\delta B_\parallel/(\rho_*B(z))\). Hence \(\delta B_\perp/(\rho_*B_N)=k_{\perp,N}A_\parallel\) and \(\delta B_\parallel/(\rho_*B_N)=B\,\mathtt{bpar}\). Together with \(\beta_{\rm ref}=8\pi n_{\rm ref}T_{\rm ref}/B_N^2\) and \(v_{th}=\sqrt{T/m}\), this gives the two \(1/\beta_{\rm ref}\) magnetic terms above (and the \(\beta_{\rm ref}/2\) in Ampere’s law), with no hidden \(\sqrt{2}\) factor.
For the \(B^{-2}\) cache convention tested at varying \(B\), \(k_{\perp,N}^2=\mathtt{kperp2}\,B^2\). The test constructs this expression independently and checks \(F_{\rm src}=F_{\rm phys}\) first at constant \(B=1\), then with the varying-\(B\) volume measure; dropping either magnetic \(B^2\) factor must fail. The constant-\(B\) check exercises both cache conventions but cannot distinguish them. This is a per-mode finite-FLR, nonzonal, periodic identity; zonal/gauge and general multi-mode Hermitian weighting remain open. Within that envelope the componentwise JAX convention is \(\operatorname{conj}(\nabla_G F_{\rm src})=n_sT_sH_s\). The symmetric truncated Hermite ladder and skew-adjoint periodic derivative also give the tested streaming-only identity
This excludes curved-geometry, drive, collision, boundary-damping and nonlinear
terms. The runtime Wg + Wphi + Wapar diagnostic is a
distinct monitoring quantity and contains no \(B_\parallel\) contribution.
For varying \(B\), the companion term-level gate follows Mandell et al. (2018), (4.4)–(4.6): it contracts streaming plus mirror forcing with \(n_sT_sH_s^*\) and the field-line volume weight \(J(z)\propto 1/(|\mathrm{gradpar}|B)\). The periodic boundary contribution vanishes, and the finite-resolution defect converges once aliased products are resolved. Differentiating the reduced source quadratic with its self-consistent fields gives the same weighted \(n_sT_sH_s^*\) contraction. With equilibrium gradients, collisions, hyper-dissipation, and end damping disabled, the gate also contracts the complete assembled linear right-hand side: streaming, mirror, curvature, and grad-\(B\). Every retained term is nonzero, while wrong volume/sign and missing-imaginary-unit controls produce nonzero exchange. The physical identification and variational identity do not establish a full budget: nonlinear transfer, heat-flux normalization, sources, sinks, and time-discretization remain outside this instantaneous gate.
Linear gyrokinetic operator
In the linear model, the Hermite-Laguerre moments evolve according to a drift/mirror operator,
where \(\mathcal{L}_m\) is the Hermite streaming ladder and
\(b^\prime(\theta)\) is the parallel magnetic field gradient used in the
mirror force. The curvature (cv) and grad-\(B\) (gb) drift couplings
are encoded in \(\mathcal{C}_m\) and \(\mathcal{G}_\ell\). Explicitly,
The diamagnetic drive term \(\mathcal{D}_{\ell m}\) follows a Laguerre formulation with explicit \(a/L_n\) and \(a/L_T\) dependence, including a separate coupling in \(m=2\) for temperature-gradient drive.
Streaming acts on \(H\): the parallel derivative is applied to
\(H_{\ell m}\) (field terms included at \(m = 0, 1\)) before the
Hermite ladder, periodically or along the linked twist-and-shift chains
(gkx.terms.linear_terms.streaming_contribution).
Nonlinear E×B and flutter terms
The nonlinear gyrokinetic equation adds the \(E\times B\) bracket and the electromagnetic flutter coupling. In GKX the nonlinear contribution is
with the Poisson bracket
The gyrokinetic potential includes the perpendicular magnetic perturbation through
so the nonlinear operator naturally splits into \(E\times B\),
\(B_\parallel\), and flutter contributions. The implementation in
gkx.terms.nonlinear supports standard gyrokinetic normalization:
gradients are computed with FFTs in \(x,y\), the bracket is evaluated in
real space, and the result is filtered by the de-alias mask before returning to
spectral space.