JAX-native monoenergetic neoclassical transport solver
Project description
NTX
NTX is a JAX-native monoenergetic neoclassical transport solver for stellarator flux surfaces. It solves the Legendre-space formulation described in Javier Escoto's PhD thesis, Fast monoenergetic neoclassical transport coefficients in stellarators.
Use NTX as:
- a command-line solver for file-backed transport calculations,
- a Python/JAX library for scans, autodiff, uncertainty propagation, and optimization,
- a NEOPAX-compatible monoenergetic database builder for bootstrap-current workflows.
Install
pip install ntx
For local development:
pip install -e ".[dev,docs,io]"
Optional geometry-coupled examples use upstream JAX geometry tools:
pip install git+https://github.com/uwplasma/vmec_jax.git
pip install git+https://github.com/uwplasma/booz_xform_jax.git
Quick Start
Run the smallest bundled case:
ntx examples/example_surface.toml
This writes examples/example_surface.npz. Plot it with:
python examples/plot_output_npz.py examples/example_surface.npz
Use NTX from Python:
from ntx import GridSpec, MonoenergeticCase, example_surface, solve_monoenergetic
surface = example_surface()
grid = GridSpec(n_theta=17, n_zeta=25, n_xi=32)
case = MonoenergeticCase(nu_hat=1e-3, epsi_hat=0.0)
result = solve_monoenergetic(surface, grid, case)
print(result.D11, result.D31, result.D13, result.D33)
For JAX scans:
import jax.numpy as jnp
from ntx import GridSpec, example_surface, solve_monoenergetic_scan
surface = example_surface()
grid = GridSpec(17, 25, 16)
nu_hat = jnp.logspace(-5, -2, 8)
coefficients = solve_monoenergetic_scan(
surface,
grid,
nu_hat,
epsi_hat=jnp.zeros_like(nu_hat),
)
Outputs
For each monoenergetic case, NTX computes:
D11,D31,D13,D33, andD33_spitzer,- residual and Onsager diagnostics,
- resolved electric-field normalization,
- geometry arrays and run metadata in compressed
.npzoutputs.
The input schema is documented in docs/input-file.md.
Validation Snapshot
Validation claims are tracked in the maintained benchmark matrix and physics-gate summary. The README keeps only the highest-signal artifacts:
| Solver validation | Fixed-field current comparison |
|---|---|
| Bootstrap-current workflow | Differentiable geometry/current path |
|---|---|
Current promoted validation includes monoenergetic convergence and identities,
the fixed-field Redl comparison on the precise-QS benchmark family, the
fixed-field NTX+NEOPAX total-current stress gate, the integrated W7-X
workflow transfer, and prepared derivative agreement against direct
reverse-mode differentiation. The fixed-field current result uses documented
normalization and moment-closure conventions, not fitted bridge constants.
Species-resolved fixed-field closure parity, broader geometry-family studies,
and large-optimization studies remain tracked as stress diagnostics or planned
research lanes in the docs.
Run the local gate summary with:
python scripts/check_physics_gates.py
Common Workflows
CLI solves:
ntx examples/sample_dkes.toml
ntx examples/sample_vmec.toml
NEOPAX database and bootstrap-current examples:
python examples/neopax_with_ntx.py
python examples/bootstrap_current_with_neopax.py
python examples/bootstrap_current_from_vmec_or_boozmn.py
Autodiff and optimization examples:
python examples/derivative_audit.py
python examples/explicit_relaxed_boundary_current_derivative_benchmark.py
python examples/bootstrap_current_optimization.py
Performance examples:
python examples/prepared_geometry_reuse_profile.py --preset smoke
python scripts/benchmark_scaling.py --help
Full example coverage is in docs/examples.md.
Current Open Research Lanes
The major open lanes are:
- full geometry-family reproduction on paper-resolution W7-X, QI, QA/QH, and additional stellarator-family inputs,
- reusable hidden-symmetry and omnigenous benchmark families,
- broader geometry-control autodiff with direct AD, prepared adjoints, and finite-difference agreement on reusable geometry families,
- restoration of implicit-equilibrium sensitivities only after residual contraction and Boozer/NTX transport finite-difference agreement pass,
- additional dedicated GPU nodes with healthy multi-GPU execution and device-memory timelines,
- broader fixed-field NTX+NEOPAX closure transfer, including species-resolved current decomposition and any future default closure, without regressing the integrated W7-X workflow,
- broader profile, uncertainty, and robust-design studies before promoting stellarator-design claims.
The live roadmap is in docs/research-roadmap.md.
Documentation
- Documentation: ntx.readthedocs.io/en/latest/
- Validation: docs/validation.md
- Performance: docs/performance.md
- GPU notes: docs/gpu.md
- NEOPAX bridge: docs/neopax.md
- Source map: docs/source-map.md
Local Checks
python -m ruff check .
python -m mypy src/ntx
python -m pytest -q
python -m sphinx -b html docs docs/_build/html
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ntx-0.2.1.tar.gz.
File metadata
- Download URL: ntx-0.2.1.tar.gz
- Upload date:
- Size: 8.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97fb8657050b212e05c09070c407d262e70a21ff43d6746176d22e00e54d025b
|
|
| MD5 |
a06feb073a42d603266f4840fe575db1
|
|
| BLAKE2b-256 |
766c3834b7b2585fd61ed29640d8f4277bfc4f1dc4936337fcda75b925d3ac7d
|
Provenance
The following attestation bundles were made for ntx-0.2.1.tar.gz:
Publisher:
release.yml on uwplasma/NTX
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ntx-0.2.1.tar.gz -
Subject digest:
97fb8657050b212e05c09070c407d262e70a21ff43d6746176d22e00e54d025b - Sigstore transparency entry: 1385281024
- Sigstore integration time:
-
Permalink:
uwplasma/NTX@9f6280ea08397d42749b66992af0dd31e6933e0f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/uwplasma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9f6280ea08397d42749b66992af0dd31e6933e0f -
Trigger Event:
push
-
Statement type:
File details
Details for the file ntx-0.2.1-py3-none-any.whl.
File metadata
- Download URL: ntx-0.2.1-py3-none-any.whl
- Upload date:
- Size: 126.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a338246ddf8003ed775cf0e59b508b42ccb2dd88f4aa2671c6b80ff21ed86e82
|
|
| MD5 |
8f975fb3b442d0fe4a9397b09f4c5cb2
|
|
| BLAKE2b-256 |
4dda21daeceaf4d2b657c3d435e38836d9b796498cb9912bb69ba166c3544bc5
|
Provenance
The following attestation bundles were made for ntx-0.2.1-py3-none-any.whl:
Publisher:
release.yml on uwplasma/NTX
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ntx-0.2.1-py3-none-any.whl -
Subject digest:
a338246ddf8003ed775cf0e59b508b42ccb2dd88f4aa2671c6b80ff21ed86e82 - Sigstore transparency entry: 1385281055
- Sigstore integration time:
-
Permalink:
uwplasma/NTX@9f6280ea08397d42749b66992af0dd31e6933e0f -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/uwplasma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9f6280ea08397d42749b66992af0dd31e6933e0f -
Trigger Event:
push
-
Statement type: