GKX

Getting started

  • Quickstart
    • Install
    • First run
    • Full Cyclone benchmark deck
    • Progress and output files
    • Precision
    • Self-contained VMEC geometry
    • Geometry path overrides
    • Python demo
    • Run from TOML
    • Figure generation
  • Tutorial
    • What GKX solves
    • 1. First run
    • 2. Stellarator geometry
    • 3. Nonlinear turbulence, tokamak
    • 4. Nonlinear turbulence, stellarator
    • 5. Kinetic electrons
    • 6. Electromagnetic
    • 7. Collisions
    • 8. Quasilinear transport
    • 9. Automatic differentiation
    • 10. Stellarator optimization with VMEX
    • 11. Parallel scans
    • 12. Restart and analysis
  • Resolution, Step and Solver Guidance
    • Defaults at a glance
    • Default stepper: measured cost
    • Choose the time stepper
    • Resolution
    • Velocity space per species
    • Kinetic electrons
    • Electromagnetic and KBM
    • End damping
    • Collisions
    • Eigensolver

Inputs and outputs

  • Input Files and Executable
    • Unified Runtime Schema
      • Resolution and time-step defaults
      • Runtime precision
      • Minimal runtime TOML example
      • Schema compatibility
      • Quasilinear diagnostics
    • Time-integration controls
    • Geometry controls
      • Executable path overrides
    • Solver and fit-signal keys
    • Executable usage
    • Python driver
    • Runtime sections
      • Per-species velocity resolution
      • Runtime parallelization controls
      • Runtime output and restart controls
      • Warm-started scans
  • Saved Outputs and Restart Files
    • Lightweight saved outputs
    • Nonlinear NetCDF bundle
      • *.out.nc
      • *.big.nc
      • *.restart.nc
    • Restart workflow
    • Plotting diagnostics

Examples

  • Examples
    • Config-backed runtime cases
      • Tokamak cases
      • VMEC-backed tokamak and stellarator cases
    • Runtime TOML entry points
    • Scaling utilities
      • Parallel identity gates
    • Plotting outputs
    • Geometry examples
    • Nonlinear restart and continuation
    • Nonlinear kinetic electrons
    • Lightweight turbulence movies
    • Geometry generation workflows
    • Benchmark and scan helpers
    • Foundational demos
    • Differentiable optimization examples
    • Secondary slab workflow
    • Full-GK ETG nonlinear pilot
  • Stellarator optimization
    • QA nonlinear transport
    • Mathematical model
    • Algorithm
    • Run
    • Controls
    • Matched validation
    • Uncertainty estimator
    • VMEX turbulence examples
    • Reproduce

Physics and models

  • Theory
    • Gyrokinetic ordering
    • Flux-tube model
    • Hermite-Laguerre velocity space
    • Field solve and gyrokinetic variable
    • Linear gyrokinetic operator
    • Nonlinear E×B and flutter terms
  • Normalization
    • Canonical normalization contract
    • Dimensionless units
    • Kinetic species conventions
    • Field-aligned grid parameters
    • Spectral grids
    • Perpendicular normalization
    • Sign conventions
    • Normalization parameters
    • Diagnostic normalization mode
    • Diagnostic scaling
    • Programmatic usage
  • Conventions and conversion to GX, GS2 and stella
    • Reference quantities
    • Conversion formulas
    • Gradients and geometry parameters
    • Parallel coordinate
    • Perpendicular grid
    • Fourier and frequency signs
    • Fields
    • Velocity space
    • Input keys
    • Worked example: Cyclone base case
  • Geometry
    • S-alpha flux-tube model
    • Parameters
    • Field-aligned grid parameters
    • Curvature and grad-B drift
    • Slab Model
    • Geometry Data Contract
      • Imported field-line geometry
      • VMEC runtime bridge
      • Miller geometry
    • In-memory geometry adapters
    • Closed VMEX mirror geometry
      • The shipped case: field-strength modulation, not a mirror ratio
    • Open-ended mirrors are out of scope
    • VMEX WOUT geometry
    • Differentiable geometry bridge validation
      • Multi-Equilibrium Boozer Parity Matrix
    • In-memory differentiable geometry API
    • VMEC and Miller runtime examples
  • Linear Model And Derivations
    • Scope
    • Normalized equation
    • Hermite-Laguerre projection
    • Gyroaverage and \(k_\perp\)
    • Field equations
    • Growth-rate/frequency extraction
    • Numerical realization
    • Benchmark contract
  • Operators And Terms
    • State And Coupled Variable
    • Implemented Linear Operator
    • Gyroaverage And Bessel Factors
    • Streaming
    • Mirror
    • Curvature And Grad-B
    • Diamagnetic Drive
    • Collisions
      • Linearized Landau operator (default)
      • Collision frequency
      • Baseline Lenard-Bernstein model
      • Structural verification of the moment operators
      • Tabulated resolutions
      • Cost and the resolution ceiling
      • Python collision protocol
      • Research operators (Python only)
      • Collision validation evidence
    • Hypercollisions
    • Declared velocity-space regularization
    • Hyperdiffusion And End Damping
    • Nonlinear \(E \\times B\) And Flutter
    • Source Mapping
    • Parameter Surface
  • Quasilinear Transport
    • Status
    • Literature anchors
    • Configuration and outputs
    • Running it
    • Model
      • Linear eigenproblem
      • Field solve and linear weights
      • Amplitude normalization and effective scale
      • Saturation rules
    • Implementation map
    • Algorithm
    • Differentiability
    • Tests
    • Calibration reports
      • Guardrails
    • Calibration portfolio
    • Results
      • HSX and W7-X
    • Spectrum-shape gates
    • Convergence evidence

Numerics and algorithms

  • Numerics
    • Spectral discretization
    • JAX execution model
    • Time integration algorithms
    • What a first run gets
    • Measurements behind the defaults
    • Saturation stop policy
    • Distributed state sharding
    • Nonlinear FFT bracket
    • The ky layout contract
    • Equilibrium-flow shearing coordinates
    • Parallel boundary and end damping
    • De-aliasing and hyperdiffusion
    • Linear solver options
    • Automatic solver and fit-signal selection
    • Custom collision operators
    • Landau damping against the exact kinetic roots
    • Hermite closure and recurrence
    • Operator assembly
    • Nodal magnetic-moment grid
      • Quadrature
      • Representation
      • Parallel advection
      • Conservation
      • Scaled amplitude and fields
      • Free energy
      • Relation to the Laguerre expansion
      • Dougherty collisions
      • Measured against the Laguerre expansion
  • Solvers
    • Time integration
    • Shift-invert preconditioners
      • pr3-cm
      • Linked boundaries
      • Sparse shift-invert
    • State intake on linked boundaries
      • Supplied states below the runtime
    • Eigenpair certification
      • Why the default is not pr3-cm shift-invert
    • Solver status on results
    • One nonlinear diagnostics graph
    • One adjoint window graph
    • Differentiable eigenmodes
    • Optional damping
    • Performance caching
    • Growth-rate extraction
  • Methods and Decisions
    • Summary of the decisions
    • Hermite–Laguerre velocity space
    • Velocity-space truncation
    • Collisions
    • Linked chains at the parallel boundary
    • Eigenpair certification
      • Eigensolver policy
    • The nonlinear bracket and dealiasing
    • Where the step’s time goes, and a measurement that did not pay
    • One graph per nonlinear route
    • Precision
    • Differentiability
    • Where GKX sits
    • Reading order
  • Differentiable matrix-free eigenmodes
    • Scope
    • Algorithm and acceptance
    • Cold discovery
    • Differentiation
    • Dense rule for forward-mode Jacobians
    • Sparse shift-invert
    • Velocity resolution
    • Usage
  • Nonlinear automatic differentiation
    • Objective
    • Discrete derivation
    • Why this method
    • Memory
    • Spectral zero mode
    • Python use
    • Choosing the window
    • Regenerating the evidence
    • Evidence and scope
    • Device parity
    • Tests
    • References
  • Parallelization policy
    • Strategy registry
    • Production path: independent work
      • Scaling evidence
    • Production closure status
    • Nonlinear runs: the species x Hermite mesh
    • Runtime routing for nonlinear runs
    • Diagnostic path: whole-state nonlinear sharding
    • Diagnostic path: nonlinear domain and device-z decomposition
    • Velocity-space routes for linear runs
      • Diagnostic gate: differentiable species initial states
    • Claim rules
    • Large-run scaling acceptance checklist
    • Fast artifact contract check
    • Release artifact policy

How the code works

  • Design and Code Map
    • Design choices
    • Code map
    • Geometry paths
    • Equations to code
    • Repository rules
  • Numerical defaults from SOLVAX

Benchmarks and validation

  • Validation
    • Evidence ledger
    • Claim scope
    • Coverage manifest
    • Verification matrix
    • Ledger rows
    • Row notes
    • Cross-code linear parity matrix
    • Lanes outside the ledger
    • Nonlinear heat-flux statistics
    • Nonlinear W7-X ETG against GX
    • Benchmarks
    • Tracked results index
    • Reading the panels
  • Performance
    • JAX performance model
    • Explicit-step kernels
    • Running on CPU
    • Persistent compilation cache
    • Warm-started scans
    • Profiling tools
      • Nonlinear end-to-end profile
      • Startup and cache construction
      • Fixed-step linear integrator
    • Tracked kernel profiles
      • Nonlinear RHS split (Cyclone)
      • Benchmark-size Cyclone Miller RHS
      • Stellarator runtime-mode RHS
      • Linear RHS terms
      • Full fused linear RHS
    • Repeated simulations and diagnostics cost
    • Spectral nonlinear mode (gated fast toggle)
    • Runtime and memory comparison
    • Preconditioner policies
    • Parallel scaling
  • Related Codes
    • Comparison-code roles
    • Capability comparison
    • How references are used
    • Benchmarking policy
    • Implementation lessons carried forward
  • Features and Claim Scope
    • Features
      • Geometry
      • Physics
      • Linear runs
      • Nonlinear runs
      • Derivatives and optimization
      • Hardware and precision
    • Claim scope
    • Explicitly unpromoted claims
    • Negative and blocking evidence
    • Deferred lanes

Development

  • Testing
    • Test tree
    • Running tests
    • CI jobs
    • Contracts a local pytest cannot catch
    • Numerical stack
    • Validation gate tooling
  • API Reference
    • Public API Registry
    • Contract types
    • Workflow
    • Prepared simulations
    • Collision Operator Interface
      • CollisionContext
      • CollisionOperator
      • SplitCollisionOperator
    • Velocity-Space Core
      • J_l_all()
      • associated_bessel_laguerre_coefficients()
      • bessel_j0()
      • bessel_j1()
      • bessel_laguerre_kernels()
      • gamma0()
      • hermite_ladder_coeffs()
      • laguerre()
      • laguerre_gyroaverage_neighbors()
      • laguerre_quadrature_count()
      • laguerre_scaled_functions()
      • laguerre_transform()
      • mu_grid_gyro_factors()
      • mu_grid_laguerre_modes()
      • mu_grid_lb_rate()
      • mu_grid_nodes()
    • Geometry
    • Geometry Core
      • FluxTubeGeometryData
      • GeometryConfig
      • GridConfig
      • SAlphaGeometry
      • SlabGeometry
      • _bgrad_from_bmag()
      • _periodic_spectral_derivative()
      • apply_geometry_grid_defaults()
      • apply_imported_geometry_grid_defaults()
      • build_flux_tube_geometry()
      • effective_boundary()
      • ensure_flux_tube_geometry_data()
      • load_imported_geometry_netcdf()
      • sample_flux_tube_geometry()
      • twist_shift_params()
      • zero_shear_enabled()
    • Analytic Geometry
      • MillerCoreParams
      • SAlphaGeometry
      • SlabGeometry
      • _SpectralGeometry
      • _SpectralGeometryMixin
      • build_collocation_surfaces()
      • effective_boundary()
      • zero_shear_enabled()
    • Flux-Tube Geometry
      • FluxTubeGeometryData
      • _ImportedGeometrySelection
      • _bgrad_from_bmag()
      • _infer_root_theta_closed_interval()
      • _periodic_spectral_derivative()
      • _select_imported_geometry_variables()
      • load_imported_geometry_netcdf()
      • sample_flux_tube_geometry()
    • Miller EIK Generation
      • MillerGeometryRequest
      • build_miller_geometry_request()
      • default_miller_eik_output_path()
      • generate_runtime_miller_eik()
    • VMEC EIK Generation
      • VmecGeometryRequest
      • _resolve_runtime_vmec_file()
      • build_vmec_geometry_request()
      • default_vmec_eik_output_path()
      • generate_runtime_vmec_eik()
    • Differentiable Geometry
      • booz_xform_spectral_sensitivity_report()
      • discover_differentiable_geometry_backends()
      • evaluate_boozer_bmag_on_field_line()
      • finite_difference_jacobian()
      • flux_tube_geometry_from_mapping()
      • flux_tube_geometry_observables()
      • geometry_inverse_design_report()
      • geometry_sensitivity_report()
      • observable_gradient_validation_report()
      • vmec_boundary_aspect_sensitivity_report()
    • Differentiable Geometry Backend Discovery
      • _candidate_paths()
      • _find_importable_module()
      • _is_traced()
      • _jax_float_dtype()
      • discover_differentiable_geometry_backends()
      • geometry_precision()
      • internal_vmec_backend_available()
    • Differentiable Flux-Tube Contract
      • flux_tube_geometry_from_mapping()
      • flux_tube_geometry_observables()
      • geometry_observable_names()
      • vmec_field_line_tensor_observable_names()
      • vmec_metric_tensor_observable_names()
    • Differentiable Geometry AD Checks
      • _json_ready()
      • _sensitivity_conditioning_metadata()
      • finite_difference_jacobian()
      • observable_gradient_validation_report()
    • Differentiable VMEC Boozer Core
      • _cached_booz_xform_constants()
      • flux_tube_geometry_from_vmec_boozer_state()
      • load_solved_vmex_case()
      • resolve_vmex_case_input_path()
      • vmex_boozer_equal_arc_core_profiles_from_state()
    • Differentiable VMEC Boozer Drifts
      • BoozerCartesianDerivatives
      • BoozerCoordinateGradients
      • BoozerFieldLineDerivatives
      • RawDriftProfiles
      • boozer_cartesian_derivatives()
      • boozer_coordinate_gradients()
      • boozer_pressure_gradient()
      • evaluate_boozer_field_line_derivatives()
      • raw_drift_profiles()
    • Differentiable VMEC Tensor Mapping
      • from_vmex()
      • from_vmex_mirror()
      • from_vmex_wout()
      • vmex_flux_tube_mapping_from_state()
    • Differentiable Geometry Numerics
      • _boozer_half_mesh_s_grid()
      • _interp_equal_arc_profile()
    • Grids
      • SpectralGrid
      • build_spectral_grid()
      • real_fft_mesh()
      • real_fft_ordered_kx()
      • real_fft_unique_ky()
      • select_ky_grid()
      • select_real_fft_ky_grid()
      • twothirds_mask()
      • FULL
      • HALF
      • KY_AXIS
      • conjugate_kx_order()
      • describe()
      • half_dealias_mask()
      • half_ky_values()
      • half_twothirds_mask()
      • hermitian_mode_weights()
      • is_half()
      • ky_layout_of()
      • ky_row_weights()
      • negative_ky_block()
      • ny_full_candidates()
      • nyc_from_ny()
      • nyquist_row()
      • rows_for_layout()
      • self_conjugate_row_mask()
      • self_conjugate_rows()
      • source_ky_layout()
      • source_ny_full()
      • symmetrize_self_conjugate_rows()
      • to_full()
      • to_half()
      • transport_mode_weights()
    • Species and Linear Parameters
      • Species
      • build_linear_params()
    • Operators
    • Linear Operators
    • Linear Linked Boundaries
      • _build_linked_end_damping_profile()
      • _build_linked_fft_maps()
      • linked_cover_mask()
      • linked_cover_mask_from_cache()
      • mask_supplied_state()
      • project_to_linked_cover()
    • Linear Cache
    • Linear Collisions
    • Linear Moments
      • apply_hermite_v()
      • apply_hermite_v2()
      • apply_laguerre_x()
      • build_H()
      • compute_b()
      • diamagnetic_drive_coeffs()
      • energy_operator()
      • grad_z_periodic()
      • hermite_streaming()
      • lenard_bernstein_eigenvalues()
      • quasineutrality_phi()
      • shift_axis()
      • streaming_term()
    • Linear Parameters
    • Linear RHS
      • linear_rhs()
      • linear_rhs_cached()
    • Linear Dissipation
      • CollisionInvariantRates
      • collision_invariant_rates()
      • collision_quadratic_rate()
      • collisions_contribution()
      • drift_kinetic_sugama_six_moment_contribution()
      • hyperdiffusion_contribution()
    • Linear Implicit Solvers
      • ImplicitSolveStats
      • ImplicitSolveSummary
      • _build_field_corrected_shifted_preconditioner()
      • _build_shifted_hermite_preconditioner()
      • _integrate_linear_implicit_cached()
      • implicit_solve_payload()
      • require_converged_implicit_solves()
    • Linear Integrators
      • _integrate_linear_cached_impl()
      • integrate_linear()
      • integrate_linear_diagnostics()
    • Linear Parallel RHS
      • _electrostatic_streaming_field_rhs()
      • _linear_rhs_electrostatic_slices_velocity_sharded_fused()
      • _resolve_parallel_devices()
      • _streaming_electrostatic_from_phi_velocity_sharded()
      • linear_rhs_electrostatic_slices_velocity_sharded()
      • linear_rhs_electrostatic_species_hermite_sharded()
      • linear_rhs_electrostatic_species_sharded()
      • linear_rhs_parallel_cached()
      • linear_rhs_streaming_electrostatic_velocity_sharded()
      • linear_rhs_streaming_velocity_sharded()
      • prepare_electrostatic_species_hermite_state()
      • prepare_electrostatic_species_inputs()
    • Linear Parallel Policy
      • _resolve_parallel_devices()
    • Linear Parallel Streaming
      • _electrostatic_streaming_field_rhs()
      • _streaming_electrostatic_from_phi_velocity_sharded()
      • linear_rhs_electrostatic_species_hermite_sharded()
      • linear_rhs_streaming_electrostatic_velocity_sharded()
      • linear_rhs_streaming_velocity_sharded()
      • prepare_electrostatic_species_hermite_state()
    • Linear Parallel Electrostatic Slices
      • _linear_rhs_electrostatic_slices_velocity_sharded_fused()
      • linear_rhs_electrostatic_slices_velocity_sharded()
      • linear_rhs_electrostatic_species_sharded()
      • prepare_electrostatic_species_inputs()
    • Linear Krylov Solvers
      • KrylovConfig
      • _mode_family_sign()
      • _omega_scale()
      • _physical_omega()
      • _select_by_overlap()
      • _select_by_target()
      • adaptive_propagator_eigenpair()
      • build_shift_invert_preconditioner()
      • certifiable_residual_tolerance()
      • dominant_eigenpair()
      • dominant_eigenpair_cached()
      • dominant_eigenpair_power()
      • dominant_eigenpair_propagator_cached()
    • Linear Eigenmode Solver Internals
    • Nonlinear Diagnostic State
      • NonlinearDiagnosticKernels
      • compute_nonlinear_diagnostic_tuple()
      • make_nonlinear_diagnostic_tuple_fn()
    • Nonlinear Collision Split Helpers
      • NonlinearCollisionSplitPolicy
      • _apply_collision_split()
      • _collision_damping()
      • build_nonlinear_collision_split_policy()
    • Nonlinear Helpers
    • Nonlinear Projection Helpers
      • ShearingCoordinateUpdate
      • _make_compressed_real_fft_projector()
      • _make_fixed_mode_projector()
      • _make_hermitian_projector()
      • _make_nonlinear_state_projector()
      • advance_shearing_coordinates()
      • hermitian_projector_for_signature()
      • hermitian_projector_signature()
    • Nonlinear RHS
      • linear_rhs_jit_for_terms_impl()
      • nonlinear_em_term_cached_impl()
      • nonlinear_rhs_cached_impl()
    • Nonlinear Bracket Kernels
      • _complete_hermitian_ky()
      • _fft2_xy_remove_radial_phase()
      • _fft_scales()
      • _ifft2_xy_with_radial_phase()
      • _spectral_bracket_full_core()
      • _spectral_bracket_half_core()
      • _spectral_bracket_multi_real_fft()
      • _spectral_bracket_real_fft_core()
    • Nonlinear Term Assembly
      • _LaguerreGridContext
      • _NonlinearBracketContext
      • _PreparedNonlinearInputs
      • _PreparedNonlinearPath
      • _field_sum()
      • _prepare_nonlinear_path()
      • nonlinear_em_contribution()
    • Nonlinear Explicit Step
      • advance_explicit_nonlinear_state()
      • advance_rk4_pi_state()
      • block_checkpoint_plan()
      • checkpointed_explicit_scan()
      • integrate_nonlinear_scan()
      • make_explicit_diagnostic_step()
      • run_explicit_diagnostic_scan()
    • Nonlinear State Integration
    • Nonlinear Diagnostic Drivers
      • PreparedExplicitNonlinearDiagnostics
      • ShearedTransportTrace
      • _integrate_nonlinear_explicit_diagnostics_impl()
      • _linear_rhs_jit_for_terms()
      • _nonlinear_diagnostic_kernels()
      • _sample_indices_with_final()
      • build_nonlinear_simulation_diagnostics()
      • finalize_nonlinear_scan_diagnostics()
      • integrate_imex_nonlinear_diagnostics_impl()
      • integrate_nonlinear()
      • integrate_nonlinear_cached()
      • integrate_nonlinear_explicit_diagnostics()
      • integrate_nonlinear_explicit_diagnostics_state()
      • integrate_nonlinear_imex_cached()
      • integrate_nonlinear_imex_diagnostics()
      • integrate_nonlinear_sheared()
      • integrate_nonlinear_sheared_transport()
      • maybe_emit_nonlinear_progress()
      • nonlinear_heat_flux_window()
      • nonlinear_rhs_cached()
      • prepare_explicit_nonlinear_diagnostics_impl()
      • prepare_nonlinear_explicit_diagnostics()
      • run_sampled_explicit_diagnostic_scan()
      • sampled_scan_intervals()
      • select_nonlinear_step_diagnostics()
    • Nonlinear Diagnostic Integration
    • Nonlinear IMEX
      • ChainImplicitLinear
      • ImexDtControl
      • advance_imex_nonlinear_state()
      • advance_imex_nonlinear_state_with_stats()
      • build_chain_implicit_linear()
      • collisions_bind()
      • imex_fixed_point_guess()
      • integrate_cached_imex_scan()
      • make_imex_diagnostic_step()
      • make_imex_nonlinear_term()
      • make_imex_solve_step()
      • make_imex_solve_step_with_stats()
      • refactor_chain_implicit_linear()
      • run_imex_diagnostic_scan()
      • solve_imex_step()
      • solve_imex_step_with_stats()
    • Explicit Time Integrators
      • ExplicitTimeConfig
      • ExplicitTimeConfigLike
      • _apply_completed_step_state_mask()
      • _completed_step_state_mask()
      • _growth_rate_mode_mask()
      • _instantaneous_growth_rate_step()
      • _laguerre_velocity_max()
      • _linear_explicit_step()
      • _linear_native_step()
      • _parallel_periods_from_grid()
      • integrate_linear_explicit()
      • integrate_linear_explicit_diagnostics()
      • integrate_linear_explicit_from_config()
    • Config-Driven Time Runners
      • _check_moment_basis_matches_operator()
      • _moment_count()
      • _operator_moment_layout()
      • _resolve_config_collision_operator()
      • _validate_nonlinear_config_state_sharding()
      • integrate_linear_from_config()
      • integrate_nonlinear_from_config()
    • Benchmarks
    • Autodiff Validation
      • autodiff_finite_difference_report()
      • central_finite_difference_jacobian()
      • covariance_diagnostics()
      • explicit_complex_operator_matrix()
      • implicit_eigenpair_observable_sensitivity_report()
      • isolated_eigenpair_observable_sensitivity_report()
      • isolated_eigenvalue_sensitivity_report()
    • Parallelization
      • IndependentEnsembleProvenanceReport
      • IndependentMapExecutionError
      • IndependentWorkerMetadata
      • ParallelIdentityReport
      • SpeciesHermiteRun
      • VelocityShardingPlan
      • batch_map()
      • batch_map_identity_report()
      • build_species_hermite_mesh()
      • build_species_hermite_mesh_plan()
      • build_velocity_sharding_plan()
      • curvature_gradb_drift_reference()
      • curvature_gradb_drift_shard_map()
      • diamagnetic_drive_reference()
      • diamagnetic_drive_shard_map()
      • electrostatic_phi_reference()
      • electrostatic_phi_shard_map()
      • hermite_field_moment_head()
      • hermite_halo_extend()
      • hermite_halo_interior()
      • hermite_neighbor_reference()
      • hermite_neighbor_shard_map()
      • hermite_shift_reference()
      • hermite_shift_shard_map()
      • hermite_streaming_ladder_reference()
      • hermite_streaming_ladder_shard_map()
      • hermite_window_cache_arrays()
      • hermite_window_indices()
      • independent_ensemble_provenance_gate()
      • independent_map()
      • independent_map_identity_report()
      • independent_worker_metadata()
      • integrate_linear_sharded()
      • integrate_nonlinear_sharded()
      • integrate_nonlinear_species_hermite()
      • ky_scan_batches()
      • mirror_drift_reference()
      • mirror_drift_shard_map()
      • pad_to_multiple()
      • parallel_identity_report()
      • periodic_streaming_reference()
      • periodic_streaming_shard_map()
      • resolve_species_hermite_sharding()
      • resolve_state_sharding()
      • species_hermite_device_counts()
      • species_hermite_state_spec()
      • split_evenly()
      • stage_from_host()
      • velocity_field_reduce_reference()
      • velocity_field_reduce_shard_map()
    • Parallel Independent Tasks
      • IndependentEnsembleProvenanceReport
      • IndependentMapExecutionError
      • IndependentWorkerMetadata
      • ParallelIdentityReport
      • batch_map()
      • batch_map_identity_report()
      • independent_ensemble_provenance_gate()
      • independent_map()
      • independent_map_identity_report()
      • independent_worker_metadata()
      • ky_scan_batches()
      • pad_to_multiple()
      • parallel_identity_report()
      • split_evenly()
    • Velocity Sharding Plans
      • VelocityShardingPlan
      • build_species_hermite_mesh_plan()
      • build_velocity_sharding_plan()
      • species_hermite_device_counts()
      • hermite_cache_partition_specs()
      • hermite_field_moment_head()
      • hermite_halo_extend()
      • hermite_halo_interior()
      • hermite_neighbor_reference()
      • hermite_neighbor_shard_map()
      • hermite_shift_reference()
      • hermite_shift_shard_map()
      • hermite_window_cache_arrays()
      • hermite_window_indices()
      • velocity_field_reduce_reference()
      • velocity_field_reduce_shard_map()
      • diamagnetic_drive_reference()
      • diamagnetic_drive_shard_map()
      • electrostatic_phi_reference()
      • electrostatic_phi_shard_map()
    • State Sharding Policy
      • build_species_hermite_mesh()
      • resolve_species_hermite_sharding()
      • resolve_state_sharding()
      • species_hermite_state_spec()
    • Sharded Integrators
      • SpeciesHermiteRun
      • integrate_linear_sharded()
      • integrate_nonlinear_sharded()
      • integrate_nonlinear_species_hermite()
      • stage_from_host()
    • Analysis
    • Mode Diagnostics
      • EigenfunctionComparisonMetrics
      • ModeSelection
      • extract_eigenfunction()
      • extract_mode()
      • extract_mode_time_series()
      • normalize_eigenfunction()
      • select_ky_index()
    • Growth-Rate Diagnostics
      • GrowthRateFitStats
      • _log_amp_phase()
      • fit_growth_rate()
      • fit_growth_rate_auto()
      • fit_growth_rate_auto_with_stats()
      • fit_growth_rate_uncertainty()
      • fit_growth_rate_with_stats()
      • instantaneous_growth_rate_from_phi()
      • select_fit_window()
      • select_fit_window_loglinear()
      • select_fit_window_stationary()
    • Publication Plotting
    • Transport Figures
    • Automatic Run Figures
    • Whole-Run Summary Figure
    • Foreign Output Dispatch
    • Persistent Compilation Cache
    • Config
      • CycloneBaseCase
      • GeometryConfig
      • GridConfig
      • InitializationConfig
      • KBMBaseCase
      • KineticElectronModelConfig
      • ModelConfig
      • TimeConfig
      • explicit_method_default_cfl_fac()
      • method_error()
      • resolve_cfl_fac()
    • Normalization
      • NormalizationContract
      • apply_diagnostic_normalization()
      • get_normalization_contract()
    • Moment And Energy Diagnostics
      • _cached_hermitian_mode_weight()
      • _fold_ky_into_kx()
      • _hermitian_mode_weight()
      • _jl_family()
      • _ky_pair_fold()
      • _masked_abs2()
      • _reduce_scalar_kykxz()
      • _reduce_species_kykxz()
      • _transport_mode_weight()
      • distribution_free_energy()
      • distribution_free_energy_resolved()
      • electrostatic_field_energy()
      • electrostatic_field_energy_resolved()
      • fieldline_quadrature_weights()
      • heat_flux_channel_resolved_species()
      • magnetic_vector_potential_energy()
      • magnetic_vector_potential_energy_resolved()
      • particle_flux_channel_resolved_species()
      • phi2_resolved()
      • total_energy()
      • turbulent_heating_resolved_species()
      • zonal_phi_line_kxt()
      • zonal_phi_mode_kxt()
    • Runtime Config
    • Runtime Startup
      • _as_runtime_species_array()
      • _build_initial_condition()
      • _build_single_phi_gaussian_profile()
      • _centered_glibc_random_pairs()
      • _dealiased_initial_mode_pairs()
      • _density_moments_for_target_phi()
      • _enforce_full_ky_hermitian()
      • _expand_ky()
      • _load_initial_state_from_file()
      • _periodic_zp_from_grid()
      • build_runtime_geometry()
      • build_runtime_linear_params()
      • build_runtime_linear_terms()
      • build_runtime_term_config()
      • end_damping_status()
      • load_netcdf_restart_state()
      • runtime_geometry_config_for_builder()
      • runtime_state_dtype()
    • Runtime Diagnostics
      • RuntimeLinearFitResult
      • ensure_finite_linear_history()
      • finalize_runtime_linear_quasilinear()
      • fit_runtime_linear_diagnostics()
      • half_horizon_settled_probe()
      • refit_runtime_linear_trajectory()
      • warn_if_growth_unresolved()
    • Runtime Diagnostic Arrays
      • TimestepCostReport
      • concat_runtime_diagnostics()
      • slice_runtime_diagnostics()
      • stride_runtime_diagnostics()
      • timestep_cost_payload()
      • timestep_cost_report()
      • validate_finite_runtime_diagnostics()
    • Runtime Resolution Estimator
      • GeometryFeatures
      • KY_TARGETS_BY_CLASS
      • LINEAR_SCAN_DT
      • PERP_LADDER
      • _apply_class_resolution_defaults()
      • _apply_linear_scan_defaults()
      • _count_bmag_wells()
      • _dt_hint()
      • _flag_value()
      • _force_vmec_geometry()
      • _pop_estimate_flag()
      • _print_deck_header()
      • _print_resolution_estimate()
      • _resolve_deck_paths()
      • _resolved_output_prefix()
      • _resolved_output_target()
      • _wout_nfp()
      • default_wout_deck_path()
      • direct_config_shorthand_args()
      • estimate_resolution()
      • extract_wout_flag_value()
      • format_estimate_table()
      • geometry_class()
      • geometry_features()
      • is_wout_file()
      • ky_max_target()
      • perp_points_for()
      • resolution_from_features()
      • resolved_deck_text()
      • wout_shorthand_args()
    • Runtime Chunks
      • AdaptiveChunkResult
      • RuntimeProgressSnapshot
      • _chunk_diagnostics_to_host()
      • _chunk_end_time()
      • _effective_diagnostics_stride()
      • _load_spilled_chunk()
      • _next_elapsed_time()
      • _offset_chunk_diagnostics_time()
      • _spill_chunk()
      • build_runtime_progress_message()
      • run_adaptive_runtime_chunk_loop()
    • Runtime Results
      • LinearResult
      • NonlinearResult
      • RuntimeLinearResult
      • RuntimeLinearScanResult
      • RuntimeNonlinearResult
      • RuntimeParameterScanResult
      • ScanResult
      • _ResultArtifacts
      • _dataset_payload()
      • build_runtime_nonlinear_result()
      • checked_solve_summary()
      • nonlinear_field_phi2()
      • plot()
      • solve_stats_request()
    • Runtime Orchestration
      • RuntimeIndependentParallelPlan
      • run_runtime_parameter_scan()
      • run_runtime_scan()
      • run_runtime_scan_batch()
      • run_runtime_scan_ky_task()
      • NonlinearArtifactPolicy
      • print_nonlinear_command_outputs()
      • print_saved_paths()
      • resolve_nonlinear_artifact_policy()
      • run_runtime_nonlinear_with_artifacts()
      • write_command_outputs()
      • write_linear_runtime_command_outputs()
      • write_runtime_nonlinear_artifacts()
      • write_scan_runtime_command_outputs()
      • SaturationPlan
      • SaturationRefreshPolicy
      • SaturationWarmStart
      • WarmStartPolicy
      • carry_state()
      • flux_tube_signature()
      • linear_scan_warm_start_refusal()
      • relative_change()
      • resolve_scan_warm_start()
      • scan_visit_order()
      • signature_from_arrays()
      • state_norm()
    • Runtime Commands
      • RuntimeLinearCommandOptions
      • RuntimeNonlinearCommandOptions
      • RuntimeScanCommandOptions
      • _arg_or_section()
      • _parse_ky_values()
      • _prepare_runtime_command_config()
      • _resolve_grid_time_options()
      • _resolve_linear_command_options()
      • _resolve_linear_fit_options()
      • _resolve_nonlinear_command_options()
      • _resolve_scan_command_options()
      • _runtime_fit_config()
      • apply_quasilinear_overrides()
      • apply_runtime_path_overrides()
      • attach_preloaded_runtime_config()
      • auto_plot_runtime_outputs()
      • load_runtime_command_config()
      • plot_saved_output_command()
      • print_linear_run_header()
      • print_nonlinear_run_header()
      • print_nonlinear_run_summary()
      • run_linear_case()
      • run_nonlinear_case()
      • run_runtime_linear_command()
      • run_runtime_nonlinear_command()
      • runtime_output_path()
      • scan_runtime_linear_command()
      • should_show_progress()
      • should_write_plots()
    • Runtime TOML Inputs
      • _apply_runtime_section_overrides()
      • _default_nonlinear_stepper()
      • _merge_dataclass()
      • _normalize_geometry_overrides()
      • _normalize_time_overrides()
      • _replace_runtime_section()
      • _resolve_runtime_config_paths()
      • _runtime_base_config()
      • _runtime_run_from_toml()
      • _runtime_species_from_toml()
      • _validate_removed_time_keys()
      • describe_binary_input()
      • load()
      • load_runtime_from_toml()
      • load_toml()
      • migrate_end_damping_reference()
      • reject_unknown_keys()
      • resolve_runtime_path()
      • toml_shorthand_command()
    • Runtime Artifact Package
      • validate_finite_array()
      • validate_finite_runtime_result()
      • write_quasilinear_artifacts()
      • write_runtime_linear_artifacts()
      • write_runtime_linear_scan_artifacts()
      • write_runtime_nonlinear_table_artifacts()
    • Runtime Artifact IO
      • load_netcdf_restart_state()
      • validate_finite_array()
      • validate_finite_runtime_result()
      • write_netcdf_restart_state()
      • write_quasilinear_artifacts()
      • write_runtime_linear_artifacts()
      • write_runtime_linear_scan_artifacts()
      • write_runtime_nonlinear_table_artifacts()
    • NetCDF Spectral Layout
      • KY_WEIGHTING_PER_ROW
      • _condense_kx_for_output()
      • _condense_ky()
      • _condense_ky_for_output()
      • _condense_kykx()
      • _condense_kykx_for_output()
      • _dealiased_ky_values()
      • _dealiased_spectral_field()
      • _half_ky_publish_factor()
      • _restart_to_netcdf_layout()
      • _spectral_species_to_xy()
      • _spectral_to_xy()
    • Nonlinear Output NetCDF
      • _build_output_grid_and_geometry()
      • _write_diagnostics_group()
    • Quasilinear Transport Diagnostics
      • QuasilinearTransportResult
      • compute_quasilinear_from_linear_state()
      • effective_kperp2()
      • mixing_length_amplitude2_jax()
      • normalize_quasilinear_channels()
      • phi_norm2()
      • quasilinear_feature_objective()
      • saturated_flux_from_linear_weight()
      • saturation_amplitude2()
      • spectral_phi_weights()
    • Run-to-Saturation Stop Policy
      • SaturationStopConfig
      • saturation_stop_decision()
      • sokal_autocorrelation_time()
    • Solver Eigen Objectives
      • dominant_eigenvalue_branch_locality_report()
      • dominant_real_eigenvalue()
    • Solver Objective Core
      • AdaptiveLinearEigensolverConfig
      • solver_growth_rate_from_geometry()
      • solver_linear_operator_matrix_from_geometry()
      • solver_objective_vector_from_geometry()
      • solver_scalar_objective_from_vector()
    • VMEC-JAX Transport Objective
      • StellaratorObjectivePortfolioContract
      • VMEXGKXTransportObjective
      • VMEXTransportObjectiveConfig
      • aggregate_objective_portfolio()
      • portfolio_objective_weight_vector()
      • portfolio_sample_weight_tensor()
      • validate_objective_portfolio_contract()
      • vmex_transport_objective_from_state()
    • Runtime Runner
      • RuntimeIndependentParallelPlan
      • RuntimeLinearResult
      • RuntimeLinearScanResult
      • RuntimeNonlinearResult
      • build_runtime_geometry()
      • build_runtime_linear_params()
      • build_runtime_linear_terms()
      • build_runtime_nonlinear_diagnostics_kwargs()
      • build_runtime_term_config()
      • prepare()
      • run_runtime_linear()
      • run_runtime_nonlinear()
      • run_runtime_scan()
      • solve()
  • References
GKX
  • Related Codes
  • View page source
Previous Next

Related Codes

GKX is a clean JAX implementation with explicit benchmark contracts. Other codes are used as independent references for equations, diagnostics, geometry conventions, validation cases, and performance expectations.

Comparison-code roles

GX [GX]

The closest algorithmic and parity reference. GX uses a Fourier-Hermite-Laguerre formulation and GPU-native kernels. For GKX, GX is most useful for Cyclone, KBM, W7-X, HSX, nonlinear transport, velocity-space convergence, and performance/scaling comparisons. Source-level audits should inform tests and diagnostics, not copy implementation.

stella and GENE [GENE]

The W7-X benchmark between stella and GENE [GonzalezJerez22] is the most complete public stellarator validation ladder: multiple flux tubes, linear ITG/TEM scans, zonal-flow response, and nonlinear ITG heat fluxes. It is the reference for any paper-level W7-X claim.

GENE, ORB5, and XGC

Verification work around these codes ties equation verification to numerical verification. The corresponding GKX tests cover reduced-equation limits, observed order, conservation or free-energy behavior, and electromagnetic/KBM benchmark observables.

VMEC and Boozer-coordinate tools

File-based VMEC geometry (wout files) is the compatibility path. The differentiable path takes a vmex equilibrium state in memory (gkx.geometry.differentiable.vmex_flux_tube_mapping_from_state) and maps it to Boozer coordinates with booz_xform_jax, a required dependency of the VMEC geometry path.

DESC, SIMSOPT, TORAX, Equinox, and Lineax

These projects provide useful patterns for differentiable plasma workflows: typed PyTrees, exact or validated derivatives, objective APIs, solver adapters, persistent compilation-cache workflows, and optimization examples.

Capability comparison

The table records scope of implementation for orientation, not a judgement of quality: each of these codes is mature and each is stronger than GKX in areas GKX does not attempt. It is included because the collision-operator scope in particular is what motivates several GKX design choices.

GKX

GX [GX]

GENE [GENE]

Velocity representation

Hermite-Laguerre gyro-moments

Hermite-Laguerre gyro-moments

grid in \((v_\parallel, \mu)\)

Collision models

Lenard-Bernstein/Dougherty, Sugama, improved Sugama, drift-kinetic Coulomb, gyrokinetic Coulomb

Dougherty plus hypercollisions

Landau and model operators

Perpendicular treatment

Fourier, with finite-Larmor Coulomb tables in \(k_\perp\)

Fourier

Fourier

Differentiability

JAX autodiff end to end, including an implicit eigenvalue adjoint

not a design goal

not a design goal

Geometry

analytic s-alpha, Miller, imported VMEC, differentiable VMEC/Boozer

analytic, Miller, VMEC

analytic, Miller, VMEC, and more

Hardware

CPU and GPU through JAX

GPU-native

CPU and GPU

Two entries deserve qualification. The collision row counts selectable models, not fidelity: a Dougherty operator that is well converged can be a better physical answer than a Coulomb operator that is not, and Hoffmann, Frei & Ricci [Hoffmann23] found the choice of collision model has little effect on the ITG growth rate and saturated heat flux at tokamak-relevant collisionality. Collisions still act on nonlinear transport through zonal-flow damping [Lin99], so comparing collision models needs zonal and nonlinear observables, not linear growth alone. The differentiability row is a statement about design intent rather than a deficiency, since both other codes predate the current autodiff tooling.

GKX’s velocity representation is deliberately the same family as GX, which is what makes GX the closest parity reference; the differences that matter for verification are the collision hierarchy and the differentiable geometry path.

How references are used

Each comparison must be traceable:

  • reference code, paper, or dataset;

  • exact input file and geometry source;

  • generated GKX artifact;

  • comparison script;

  • fit/window policy;

  • numeric gate;

  • figure path used in docs or publication material.

For linear comparisons, preferred observables are growth rate, real frequency, branch identity, eigenfunction overlap, and convergence with resolution.

For nonlinear comparisons, preferred observables are windowed heat-flux statistics, mode-resolved spectra, conserved or nearly conserved quantities in reduced limits, and restart/diagnostic reproducibility.

For response-function comparisons, preferred observables are residual level, damping rate, oscillation frequency, recurrence behavior, and sensitivity to velocity-space closure or hypercollision.

Benchmarking policy

  • Each benchmark lane’s reference, its provenance and its pass/fail status are recorded in the evidence ledger tools/evidence_ledger.toml. Status: see Validation.

  • Benchmark panels include only tracked assets generated by repository scripts (Validation).

  • A lane stays provisional until its reference and gates are frozen.

Implementation lessons carried forward

Source-code audits of comparison projects set these engineering rules for GKX:

  • keep geometry contracts explicit and testable;

  • precompute and reuse cacheable linear pieces;

  • avoid expensive cold-start work in warm-runtime measurements;

  • keep diagnostics order-stable across restarts;

  • separate benchmark-policy code from solver kernels;

  • profile before introducing custom kernels or deeper JAX abstractions;

  • make every differentiable objective validate its gradients before it is used for optimization.

Previous Next

© Copyright .

Built with Sphinx using a theme provided by Read the Docs.