Inputs (namelist) reference
dkx reads Fortran-style namelist files, typically named
input.namelist. The input surface is compatible with the mature SFINCS-style
ecosystem so equilibria, scans, and case descriptions carry over, but this page
documents the public dkx interface in its own right and enumerates every
parameter the canonical parser recognizes.
How the namelist parser works
The canonical typed parser is dkx.inputs.SfincsInput. Group names
are matched case-insensitively; each supported parameter is a typed field whose
Python type is inferred from its default (tuple \(\to\) float array,
bool, int, float, else str). Two behaviors are worth stating up
front:
Species arrays accept indexed assignment (
Zs(2) = 6.0) and are folded into vectors; the species count is the number ofZsentries.Unknown keys are not an error. A key that is not a typed field of a recognized group is dropped from the typed struct but retained in
SfincsInput.raw; an unknown group is likewise retained inrawbut never typed. “Supported” below means specifically the typed fields.
The parser has an inverse: dkx.inputs.SfincsInput.to_namelist()
serializes a typed input back to Fortran-readable namelist text (compact —
non-default fields only — by default, every typed field with
include_defaults=True), and write() puts
it in a file. Untyped keys retained in raw and the rank-2
boozer_bmnc(m,n) spectra survive the round trip. Inputs can also be
built without a file at all: dkx.inputs.SfincsInput.from_params()
takes the flat Fortran parameter names of the tables below
(case-insensitively) and returns a validated typed input that the run
drivers accept directly (see Usage).
The tables give the Fortran namelist name, default, and type for every typed field, grouped by namelist.
&general
Name |
Default |
Type / meaning |
|---|---|---|
|
|
int; 1 = profile solve, 2 = 3×3 transport matrix, 3 = monoenergetic 2×2 |
|
|
bool; solve for the ambipolar \(E_r\) |
|
|
int; root-finder option (2 = Brent, canonical) |
|
|
int; number of \(E_r\) samples |
|
|
float; root-find tolerances |
|
|
float; \(E_r\) search bracket |
|
|
str; output file name |
|
|
bool; solve (vs geometry/grids only) |
|
|
bool; legacy dump toggles |
&geometryParameters
Name |
Default |
Type / meaning |
|---|---|---|
|
|
int; geometry family (Geometry models and loading) |
|
|
str; |
|
|
float; Boozer flux functions and rotational transform (analytic schemes) |
|
|
float; reference field ratio |
|
|
float; edge flux and minor-radius normalizations |
|
|
float; scheme-1 toroidal / helical / antisymmetric ripple amplitudes |
|
|
int; scheme-1 helical mode numbers |
|
|
int; scheme-1 antisymmetric mode numbers |
|
|
int; field periods (0 = infer from scheme) |
|
|
float; Boozer harmonic filter / ripple scaling |
|
|
int; surface label (0=ψ, 1=ψ_N, 2=r̂, 3=r_N, 4=Er) |
|
|
int; gradient label |
|
|
float; requested surface ( |
|
|
int; VMEC radial-interpolation and Nyquist conventions |
&speciesParameters
Species arrays default to empty tuples; give one entry per species. All arrays are float arrays. Gradients are accepted in every radial coordinate.
Name |
Meaning |
|---|---|
|
charge, mass, density, temperature (per species) |
|
density gradient in each radial coordinate |
|
temperature gradient in each radial coordinate |
|
adiabatic species toggle (default |
|
NBI fast-species toggle (default |
&physicsParameters
Name |
Default |
Type / meaning |
|---|---|---|
|
|
float; drift-kinetic ordering parameters (Normalizations and units) |
|
|
float; inductive parallel field \(\hat E_\parallel\) |
|
|
float; radial-electric-field drive in each coordinate |
|
|
int; 0 = full Fokker–Planck, 1 = pitch-angle scattering, 3 = improved Sugama model operator (momentum- and energy-conserving) |
|
|
int; source/constraint scheme (−1 = auto by collision operator) |
|
|
bool; \(E_r\) energy drift \(\dot x\,\partial_x\) |
|
|
bool; \(E_r\) pitch drift \(\dot\xi\,\partial_\xi\) |
|
|
bool; DKES (\(\langle B^2\rangle\)) vs full (\(B^2\)) ExB |
|
|
bool; compressible ExB correction |
|
|
bool; add \(C_{ab}[f_{aM},f_{bM}]\) to the RHS |
|
|
bool; enable the quasineutrality / \(\Phi_1\) block |
|
|
bool; \(\Phi_1\) terms in the DKE (requires |
|
|
bool; poloidal density factor in collisions |
|
|
int; 1 = full Boltzmann, 2 = EUTERPE adiabatic |
|
|
bool; treat \(\Phi_1\) as a fixed external field (linear solve, no Newton iteration) |
|
|
float; monoenergetic collisionality / electric field ( |
|
|
int; tangential magnetic drift (schemes 0–9, matching Fortran v3) |
|
|
float; optional non-conserving drag |
&resolutionParameters
Name |
Default |
Meaning |
|---|---|---|
|
|
poloidal / toroidal grid points |
|
|
Legendre pitch modes |
|
|
Rosenbluth-potential Legendre modes ( |
|
|
speed-grid nodes (forced to 1 for |
|
|
speed-grid extent / Rosenbluth potential resolution |
|
|
linear-solve residual target |
|
|
round grid sizes to odd |
The Fortran convergence-scan ramp arrays (NthetaNumRuns, Nx_min, …)
have no typed fields; if present they are retained in raw only and are not
acted upon.
&otherNumericalParameters
Name |
Default |
Meaning |
|---|---|---|
|
|
angular finite-difference scheme |
|
|
ExB derivative scheme |
|
|
magnetic-drift derivative / upwinding scheme |
|
|
speed-derivative scheme (canonical: 0) |
|
|
speed-grid family and weight exponent \(k\) |
|
|
\(N_\xi\)-for-\(x\) ramp (Numerics and algorithms) |
|
|
iterative vs direct (alias |
|
|
legacy PETSc knobs (retained for compatibility) |
&preconditionerOptions
Name |
Default |
Meaning |
|---|---|---|
|
|
1 = self-collisions only in the coarse operator |
|
|
x-diagonal collisions in the preconditioner |
|
|
drop L±1 streaming coupling in the preconditioner |
|
|
angular coarsening |
|
|
minimum L kept per angle |
|
|
magnetic-drift truncation in the preconditioner |
|
|
reuse the factorization across right-hand sides |
These map onto the tier-2 coarse preconditioner in Numerics and algorithms.
Unsupported inputs
Stated plainly, the remaining gaps against SFINCS Fortran v3 are:
MPI multi-node execution — dkx runs single-node (multicore CPU or GPU); there is no distributed-memory mode.
Convergence-scan ramp arrays (
NthetaNumRuns,Nx_min, …) — no typed fields; retained inrawonly and not acted upon (see above).
Everything else in the Fortran v3 input surface is fully supported on the
canonical stack (see the README feature matrix for the parity evidence),
including the &export_f group (export_full_f / export_delta_f),
readExternalPhi1 (fixed external \(\Phi_1\) as a linear solve),
non-stellarator-symmetric (lasym) VMEC equilibria, and
magneticDriftScheme 0–9.
Geometry and equilibrium inputs
The public geometry families are documented in Geometry models and loading. The most common
choices are analytic tokamak (geometryScheme = 1), VMEC
(geometryScheme = 5 with equilibriumFile or wout_path), and Boozer
.bc (geometryScheme = 11 or 12). The CLI and Python API share one
equilibrium search order:
absolute path from the namelist or explicit override,
relative to the input namelist directory,
relative to the current working directory,
directories listed in
DKX_EQUILIBRIA_DIRS,small bundled test/example data directories,
then known release-hosted public fixtures by basename, fetched into the
DKX_DATA_DIRcache when needed.
Prefetch the fixture cache with
python -m dkx.validation.data_fetch, or set DKX_OFFLINE=1
to require a pre-populated cache.
Runtime overrides
Without editing the namelist, override the equilibrium source through:
CLI:
--equilibrium-file ...or--wout-path ...Python:
equilibrium_file=...orwout_path=...indkx.api.write_output()
When an override is used, the embedded input.namelist dataset written to
sfincsOutput.h5 reflects the effective configuration.
Transport-matrix modes (RHSMode = 2/3)
For RHSMode = 2 and RHSMode = 3 the solver loops over whichRHS and
overwrites the relevant drives internally before building each RHS. On the
canonical stack this is KineticOperator._with_rhs_settings, so the transport-mode right-hand side reproduces the
v3 solver RHS exactly. For RHSMode = 3 the speed grid collapses to the single
node at \(x=1\) (Nx = 1), matching v3 createGrids.F90; this is handled
by dkx.drift_kinetic.KineticOperator.from_namelist().
Worked example decks are in examples/ (see Examples), and the geometry
input knobs are cross-referenced from Geometry models and loading.