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.2.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.2-py3-none-any.whl (126.3 kB view details)

Uploaded Python 3

File details

Details for the file ntx-0.2.2.tar.gz.

File metadata

  • Download URL: ntx-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 cdab869db0576932b52b78379fe5d0d04f1bc2d2c0c4f6398fb5a683f1c2edc4
MD5 644e509de2638cfcf1a29e0daea1ae84
BLAKE2b-256 b40177a3bf51864a9a1cebb5cabe34d268ebbe01f79481c7a1b163478f991f9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ntx-0.2.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: ntx-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9febeff960e8760041409259f41cfb06e81aa69894e7298e005d07f495877b9d
MD5 2c9e6bf9c31c44cc35ca860078a18479
BLAKE2b-256 f2c2356b6be424d86604286ade6034a9caba0b6f98d9cd944361707aed578c6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ntx-0.2.2-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