SPECTRAX-GK
SPECTRAX-GK is a JAX-native gyrokinetic solver using Hermite-Laguerre velocity space, Fourier perpendicular coordinates, and field-aligned flux-tube geometry.
Install with pip install spectraxgk and run spectraxgk in a terminal to
launch the default linear Cyclone demo. The same executable also accepts
checked-in TOMLs directly and can plot saved runtime outputs with
spectraxgk --plot <artifact>.
Documentation map
The documentation is organized so that the core physics, equations, numerical methods, and model-specific paths are easy to locate:
Theory summarizes the gyrokinetic ordering, field equations, and flux-tube assumptions.
Linear Model And Derivations gives the operator-level derivation tied directly to the implemented linear equations and diagnostics.
Operators And Terms lists every implemented term, collision model, hyperdiffusion/hypercollision control, and the runtime parameters that select them.
Numerics documents discretization, time integration, FFT brackets, solver contracts, and JAX parallelization.
Geometry and Input Files and Executable cover the supported model paths (analytic s-alpha, Miller, VMEC/imported geometry, slab) together with the TOML schema used by the executable and Python drivers.
For a first technical read, start with Theory, then move to Operators And Terms and Numerics. That path gives the governing equations, the term-by-term implementation contract, and the numerical approximations in the same order they appear in the code.
Contents
- Quickstart
- Input Files and Executable
- Saved Outputs and Restart Files
- Theory
- Linear Model And Derivations
- Operators And Terms
- Numerics
- Spectral discretization
- Algorithm mapping (numerics → code)
- JAX execution model
- Structured solver dependency contract
- Time integration algorithms
- Diffrax integration
- Nonlinear FFT bracket
- Equilibrium-flow shearing coordinates
- De-aliasing and hyperdiffusion
- Performance tuning
- Automatic solver + fit-signal selection
- Custom collision operators
- Gyroaverage and polarization
- Parallel streaming
- Curvature, grad-B, and mirror couplings
- Field solve and electromagnetic coupling
- Normalization control
- Diamagnetic drive
- Time integration
- Boundary damping
- Dealiasing
- Nonlinear Electromagnetic Terms
- Parallelization policy
- Normalization
- Quasilinear Transport
- Current validated scope
- Literature anchors and claim policy
- Scoped core and universal-stress verdict
- Executable usage
- Model details
- Implementation map
- Algorithmic workflow
- Numerics and differentiability
- Validation gates
- Calibration reports
- Train/holdout transfer
- Non-axisymmetric HSX holdout
- W7-X NetCDF nonlinear-window path
- Saturation-rule sweep
- Shape-aware saturation diagnostic
- Candidate uncertainty gate
- Residual-anatomy gate
- Regularization sensitivity audit
- Stellarator usefulness summary
- Screening and rank-correlation gate
- Dataset-sufficiency gate
- Model-selection status
- Holdout-gap report
- External-VMEC next-holdout runbook
- VMEC equilibrium portfolio for future holdouts
- Axisymmetric spectrum-shape gates
- Differentiable Stellarator Optimization
- Purpose
- Source Map
- VMEC-JAX-Style QA Transport Scripts
- Optimizer Strategy and Literature Anchor
- Broad nonlinear matrix outcome
- Optimizer-Comparison Manifest
- Full Max-Mode-5 Optimizer Sweeps
- Configurable Solved-Boundary Driver
- Development-Only Reduced Diagnostics
- Aspect-6 QA Low-Turbulence Comparison
- Historical Projected-Gradient Evidence
- VMEC-JAX Geometry Examples
- Production VMEC-JAX Optimization Plan
- Development Portfolio Gate
- Objective
- Numerics and Differentiation
- Objective-portfolio artifact guard
- Development Diagnostic Results
- Zonal-flow Objective Contract
- Connection to Literature
- Solver-objective Geometry Gradients
- Promotion Gates for Full VMEC/Boozer/GK Optimization
- Geometry
- Algorithms
- Solvers
- Architecture
- Benchmarks
- Figure generation
- Capability and matched-comparison contract
- Tracked results index
- Fresh-run refresh workflow
- Tracked benchmark metrics
- Primary publication set
- Interpretation of validation
- Benchmark runner internals
- README summary panel
- Supplementary closure figures
- Extended stress matrix
- Case groups
- Notes on interpretation
- Examples
- Config-backed runtime cases
- Runtime TOML entry points
- Scaling utilities
- Plotting outputs
- Geometry examples
- Nonlinear restart and continuation
- Geometry generation workflows
- Benchmark and scan helpers
- Foundational demos
- Differentiable optimization examples
- Secondary slab workflow
- Full-GK ETG nonlinear pilot
- Related Codes
- Performance
- JAX performance model
- Cache profiling
- Fixed-step linear integrator profiling
- Nonlinear profiling
- JAX/XProf operational notes
- Recent nonlinear profiling (Cyclone, benchmark-locked config)
- Nonlinear benchmark harness
- RHS kernel profile (nonlinear Cyclone)
- Benchmark-size Cyclone Miller RHS profile
- Runtime-mode stellarator RHS smoke profile
- Linear RHS term profile
- Full fused linear RHS trace
- Parallelization scaling guardrail
- Fixed-step nonlinear state sharding
- Spectral nonlinear mode (gated fast toggle)
- Runtime and memory comparison workflow
- Final runtime/memory figure
- Interpretation of short nonlinear GPU rows
- Startup phase profiler
- Cached basis indices
- GMRES preconditioner policy
- JIT considerations
- Planned optimizations
- Linear-to-nonlinear optimization roadmap
- Testing
- Testing philosophy
- Current testing target
- Nonlinear matrix release gates
- Test categories
- Unit tests (numerical invariants)
- Physics regression tests
- Benchmark regression tests
- Literature-anchored response and spectrum tests
- Diffrax and nonlinear smoke tests
- Parallelization identity gates
- Nonlinear parity snapshots
- Linear physics checks
- Running tests
- Benchmark reproducibility stack
- Stress-matrix parity gates
- CI split: fast PR vs manual full
- Core modular coverage gate
- Core solver coverage gates
- Validation And Coverage Strategy
- Verification Matrix
- Release Scope and Claim Boundaries
- Code Structure
- Architecture Refactor Plan
- Purpose
- Plan Authority And Conflict Resolution
- Planning Snapshot
- Current Consolidation Decision
- External Design Guidance
- Non-Negotiable Constraints
- What “Simpler” Means
- Structured Numerical Algebra Ownership
- Architecture Principles
- Python API, Executable, And Differentiability Boundary
- Differentiation Method Policy
- Performance And Memory Rules
- Target Source Layout
- Naming Rules
- Migration Phases
- Finite Completion Sequence For The Current Branch
- Acceptance Gates
- Documentation Requirements
- Test Structure Plan
- First Concrete Tranche
- Longer-Term Success Criteria
- Differentiable Refactor Plan
- Manuscript Figures
- References
- Roadmap
- Current target
- Pre-release scope
- Executable open-lane status
- Pre-manuscript closure gates
- Post-release scope
- Current release-scope guardrail
- Active refactor lane
- Validation gates
- Near-term physics priorities
- Performance and memory
- Differentiable geometry and optimization
- Testing and CI
- Documentation and examples
- Release policy
- API Reference
- Public API Registry
- Core Refactor Contracts
- Core Extension Points
- Velocity-Space Core
- Geometry
- Geometry Core
- Analytic Geometry
- Flux-Tube Geometry
- Miller EIK Generation
- VMEC EIK Generation
- Differentiable Geometry
- Differentiable Geometry Backend Discovery
- Differentiable Flux-Tube Contract
- Differentiable Geometry AD Checks
- Differentiable Geometry Sensitivity
- Differentiable Boozer Bridge
- Differentiable VMEC-State Sensitivity
- Differentiable VMEC Boozer Core
- Differentiable VMEC Boozer Constants
- Differentiable VMEC Flux-Tube Reports
- Differentiable VMEC Tensor Mapping
- Differentiable Geometry Numerics
- Grids
- Species
- Operators
- Linear Operators
- Linear
- Linear Linked Boundaries
- Linear Cache
- Linear Collisions
- Linear Moments
- Linear Parameters
- Linear RHS
- Linear Dissipation
- Linear Implicit Solvers
- Linear Integrators
- Linear Diagnostic Integration
- Linear Parallel RHS
- Linear Parallel Policy
- Linear Parallel Streaming
- Linear Parallel Electrostatic Slices
- Linear Krylov Solvers
- Linear Eigenmode Solver Internals
- Nonlinear
- Nonlinear Diagnostics
- Nonlinear Diagnostic State
- Nonlinear Collision Split Helpers
- Nonlinear Helpers
- Nonlinear Projection Helpers
- Nonlinear RHS
- Nonlinear Bracket Kernels
- Nonlinear Term Assembly
- Nonlinear Explicit Step
- Nonlinear State Integration
- Nonlinear Diagnostic Drivers
- Nonlinear Diagnostic Integration
- Nonlinear IMEX
- Explicit Time Integrators
- Explicit Step Kernels
- Explicit Diagnostic Integrators
- Explicit CFL Policy
- Diffrax Time Integrators
- Config-Driven Time Runners
- Runtime Execution Dispatch
- Nonlinear Replicate Diagnostics
- Nonlinear Replicate Follow-Up
- Nonlinear Transport Optimization Diagnostics
- Nonlinear Gradient Evidence Diagnostics
- Nonlinear Gradient Campaign Follow-Up Tools
- Benchmarks
- Validation Gates
- Autodiff Validation
- Parallelization
- Parallel Identity Reports
- Parallel Batch Mapping
- Parallel Independent Tasks
- Nonlinear Parallel Spectral Core
- Nonlinear Domain Decomposition
- Nonlinear Parallel Device-Z Core
- Velocity Sharding Plans
- State Sharding Policy
- Sharded Integrators
- Zonal Validation
- Zonal Flow Objectives
- Analysis
- Mode Diagnostics
- Growth-Rate Diagnostics
- Growth-Rate Fit Kernels
- Growth-Rate Fit Windows
- Runtime Output Plots
- Benchmark And Scan Plots
- Diagnostic Plots
- Zonal Response Plots
- Plotting Facade
- Config
- Normalization
- Energy Diagnostics
- Transport Diagnostics
- Resolved Diagnostics
- Runtime Config
- Runtime Startup
- Runtime Policies
- Runtime Diagnostics
- Runtime Diagnostic Arrays
- Runtime Initial Conditions
- Runtime Phi Initializer
- Runtime Chunks
- Runtime Results
- Runtime Orchestration
- Runtime Commands
- Runtime TOML Inputs
- Runtime Artifact Package
- Runtime Artifact IO
- Runtime Restart Artifacts
- Runtime Artifact Linear Writers
- Runtime Artifact Nonlinear Writers
- NetCDF Spectral Layout
- Nonlinear Output NetCDF Geometry
- Nonlinear Output NetCDF Field Writer
- Nonlinear Output NetCDF Diagnostics Writer
- Nonlinear Output NetCDF Facade
- Runtime Artifact Nonlinear Diagnostics
- Quasilinear Transport Facade
- Quasilinear Transport Diagnostics
- Quasilinear Calibration
- Quasilinear Nonlinear-Window Gates
- Quasilinear Model Selection
- Solver Eigen Objectives
- Solver Objective Core
- Solver Objective Sampling
- Solver Geometry Objectives
- Solver-Ready Gradient Gates
- Solver VMEC/Boozer Gradient Gates
- Solver VMEC/Boozer Objectives
- Solver VMEC/Boozer Finite-Difference Gates
- Solver VMEC/Boozer Line-Search Gates
- Parallel Decomposition Contracts
- QA Low-Turbulence Model And Gates
- QA Low-Turbulence Optimizer
- QA Low-Turbulence Artifacts
- VMEC-JAX Transport Objective
- VMEC-JAX Transport Configuration
- VMEC-JAX Transport Tables
- VMEC-JAX Transport Branch Gates
- VMEC-JAX Transport Admission
- Stellarator Transport Reports
- VMEC-JAX Transport Gradient
- VMEC-JAX Boundary Chain
- VMEC-JAX Transport Line Search
- VMEC-JAX Candidate Gates
- Stellarator ITG Objectives
- Stellarator ITG Objective Tables
- Stellarator ITG Contracts
- Stellarator Reduced ITG Model And Gates
- Stellarator Objective Portfolio Contracts
- Stellarator Objective Portfolio Sensitivity
- Stellarator Objective Portfolio Artifact Guards
- Runtime Runner