Configuration and Runtime Controls¶
NEO_JAX exposes the solver through a compact high-level configuration object,
an xneo-style CLI, and a small set of environment variables for runtime
selection. This page collects those controls in one place.
High-Level Python Configuration¶
The main user entrypoint is neo_jax.NeoConfig.
Field |
Meaning |
Typical usage |
|---|---|---|
|
Flux surfaces to analyze, either as 1-based indices or normalized
toroidal-flux values |
Use |
|
Angular grid resolution used for Fourier reconstruction and spline construction on each surface. |
|
|
Optional Fourier truncation applied to the Boozer spectrum before field reconstruction. |
Leave at |
|
Number of pitch-parameter samples \(\eta\) between \(B_{\min}/B_0\) and \(B_{\max}/B_0\). |
Increase for smoother trapped-particle quadrature. |
|
Maximum trapped-particle class index accumulated in \(\epsilon_{\mathrm{eff}}^{3/2}\). |
|
|
Accuracy target for rational-surface coverage and convergence checks. |
Smaller values increase runtime, especially when |
|
Number of poloidal bins used when deciding whether a rational surface has been covered adequately. |
|
|
RK4 steps per field period. |
Increase for more difficult surfaces or stronger mode content. |
|
Minimum and maximum number of field periods integrated before stopping. |
|
|
Current-path control used when the parallel-current solve is active. |
Leave at the default unless reproducing a known control deck. |
|
Preflight ceiling on the estimated rational-surface workload. |
Keep enabled by default; set to |
|
Policy when the preflight estimate exceeds the ceiling. |
|
|
Reference scaling for the reported \(B_\mathrm{ref}\). |
|
|
Enable progress prints and optional diagnostic file generation. |
Most Python API workflows leave these off. |
Common Python patterns:
from neo_jax import NeoConfig, run_neo
config = NeoConfig(
surfaces=[0.2, 0.5, 0.8],
theta_n=96,
phi_n=96,
npart=64,
multra=2,
acc_req=0.01,
)
results = run_neo("boozmn.nc", config=config)
Runtime selection flags¶
The main runtime arguments are carried by neo_jax.run_neo().
Argument |
Meaning |
Notes |
|---|---|---|
|
Select the JAX backend instead of the Python-loop backend. |
Default is |
|
Print high-level status and per-surface preflight information. |
Useful for long runs and debugging. |
|
Evaluate multiple surfaces with the batched JAX scan path. |
Best for JIT workflows and repeated calls. |
|
One-shot mode truncation overrides. |
Usually leave these in |
Environment variables¶
The runtime also recognizes several environment variables:
Variable |
Effect |
|---|---|
|
Enable 64-bit floating point in JAX by default for production accuracy. |
|
Global JAX precision override. |
|
Force eager execution for debugging and tracing. |
|
Choose between |
|
Set the preflight rational-work ceiling globally. |
|
Choose |
|
Emit extra trapped-particle convergence diagnostics. |
|
Enable optional GPU smoke tests in the regression suite. |
|
Enable slow reference-comparison cases. |
|
Override the reference executable used in CLI comparison tests. |
Near-zero-|iota| controls¶
The most important runtime knobs for difficult surfaces are:
When |iota| is very small, the rational-surface correction can request a
very large number of field periods. NEO_JAX therefore separates three modes of
operation:
guarded exact workflow: keep
rational_surface_policy="error"and a finitemax_rational_field_periodscontrolled fallback: keep the ceiling but set
rational_surface_policy="approximate"full exact long run: set
max_rational_field_periods=0
The approximate mode keeps the base integration result and skips only the expensive rational-surface correction when the preflight estimate is too large. Whenever this happens, the terminal output and diagnostics say so explicitly.
CLI options¶
The command-line interface retains the standard xneo positional usage but
also adds explicit flags:
--control: select a specific control file--boozmn: override the resolved Boozer input path--output: override the output filename--jax/--no-jax: choose the backend--verbose/--quiet: control progress output
For CLI-specific details and output-file conventions, see CLI.
Outputs and diagnostics¶
The public Python API returns neo_jax.NeoResults, a sequence-like
container with vector accessors such as:
epsilon_effectiveepsilon_effective_by_classs,sqrt_s,r_effiota,b_ref,r_refctrone,ctrtot,bareph,barept,yps
Each surface also carries a diagnostics mapping. This is where NEO_JAX
stores extra information such as the rational-work estimate, the selected
reference policy, and whether the approximate low-|iota| path was used.