Skip to main content
yancc

Yet Another NeoClassical Code.

License

Documentation UnitTests Coverage

yancc solves the drift kinetic equation to compute neoclassical flows and transport fluxes in toroidal geometry (both tokamaks and stellarators).

Installation

yancc is a pure-Python package built on JAX and requires Python 3.10 or newer.

From PyPI:

pip install yancc

From source (for development):

git clone https://github.com/f0uriest/yancc.git
cd yancc
pip install -e ".[dev]"

JAX provides separate wheels for CPU and GPU backends; see the JAX install guide to pick the appropriate one for your hardware.

Example: Solving the Drift Kinetic Equation

A minimal end-to-end DKE solve for a single hydrogen species:

from yancc import (
    Field,
    Hydrogen,
    LocalMaxwellian,
    MaxwellSpeedGrid,
    UniformPitchAngleGrid,
    solve_dke,
)

# Field and grids.
rho = 0.5
nt, nz, na, nx = 15, 31, 61, 6
field = Field.from_vmec("wout_NCSX.nc", rho, nt, nz)
pitchgrid = UniformPitchAngleGrid(na)
speedgrid = MaxwellSpeedGrid(nx)

# Single hydrogen species. Density and temperature gradients are with
# respect to rho = sqrt(normalized toroidal flux), so multiply physical
# gradients by the minor radius.
species = [
    LocalMaxwellian(
        Hydrogen,
        temperature=0.8e3,                        # eV
        density=1.5e20,                           # 1/m^3
        dTdrho=-2.0e3 * field.a_minor,
        dndrho=-0.4e20 * field.a_minor,
    )
]

# Radial electric field, in Volts. Erho = -dPhi/drho.
Er_kV_per_m = 0.5
Erho = Er_kV_per_m * field.a_minor * 1000

sol, info = solve_dke(
    field,
    pitchgrid,
    speedgrid,
    species,
    Erho=Erho,
    verbose=2,
    rtol=1e-5,
)

print("<Gamma>  =", sol.get("<particle_flux>"))   # particles/(m^2 s)
print("<Q>      =", sol.get("<heat_flux>"))       # J/(m^2 s)
print("<V||B>   =", sol.get("<V||B>"))            # T*m/s
print("<J||B>   =", sol.get("<J||B>"))            # T*A/m^2

See the documentation for the monoenergetic solver, multi-species runs, the full list of output variables, and the API reference.

Metadata

Release files for yancc 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yancc 0.0.2
File Size Uploaded
yancc-0.0.2.tar.gz 183.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yancc 0.0.2
File Interpreter ABI Platform
yancc-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 309.1 kB

Release files / yancc-0.0.2.tar.gz

Download URL yancc-0.0.2.tar.gz
Size 183.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d87d86be90007f9cbb4fbedd4be9c4e1739748e33a437616f3e7859bf31b39cb
BLAKE2b-256 checksum
How to use checksums
21da04e9791df9e10b77dcfdc01b26c68541c6adc4edfd168ed83d2fae60a7ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / yancc-0.0.2-py3-none-any.whl

Download URL yancc-0.0.2-py3-none-any.whl
Size 125.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c7e865be6e703db6687e8c3185ce8ef201c9662fbd0a3a10844651ea18979e7
BLAKE2b-256 checksum
How to use checksums
b5cc07dc87f7d5b0a68429578e06df48908eda27e92a117e303105810d74d8e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.0.3

2 release files

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page