Skip to main content

JAX-native monoenergetic neoclassical transport solver

Project description

Release License: MIT Tests Docs Coverage Python

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, and D33_spitzer,
  • residual and Onsager diagnostics,
  • resolved electric-field normalization,
  • geometry arrays and run metadata in compressed .npz outputs.

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
Monoenergetic validation summary Fixed-field SFINCS, Redl, and NTX + NEOPAX bootstrap-current comparison
Bootstrap-current workflow Differentiable geometry/current path
NTX + NEOPAX bootstrap-current profile Explicit-relaxed boundary current derivative benchmark

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

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

ntx-0.2.1.tar.gz (8.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ntx-0.2.1-py3-none-any.whl (126.3 kB view details)

Uploaded Python 3

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

Hashes for ntx-0.2.1.tar.gz
Algorithm Hash digest
SHA256 97fb8657050b212e05c09070c407d262e70a21ff43d6746176d22e00e54d025b
MD5 a06feb073a42d603266f4840fe575db1
BLAKE2b-256 766c3834b7b2585fd61ed29640d8f4277bfc4f1dc4936337fcda75b925d3ac7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ntx-0.2.1.tar.gz:

Publisher: release.yml on uwplasma/NTX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for ntx-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a338246ddf8003ed775cf0e59b508b42ccb2dd88f4aa2671c6b80ff21ed86e82
MD5 8f975fb3b442d0fe4a9397b09f4c5cb2
BLAKE2b-256 4dda21daeceaf4d2b657c3d435e38836d9b796498cb9912bb69ba166c3544bc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ntx-0.2.1-py3-none-any.whl:

Publisher: release.yml on uwplasma/NTX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page