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.3

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.3
File Size Uploaded
yancc-0.0.3.tar.gz 227.2 kB Details

Built distribution (wheel)

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

Total release size: 384.6 kB

Release files / yancc-0.0.3.tar.gz

Download URL yancc-0.0.3.tar.gz
Size 227.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fc20aa180cb4bc9159f3ed0d451983d19b88e04d1ae601ee1f16672bce048dd1
BLAKE2b-256 checksum
How to use checksums
2b58f6a7d378de38b3fea0496e22d5090a3b3403db8df9e2ddec42512a629bfd
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 Oct 14, 2026.

Transparency log

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

Download URL yancc-0.0.3-py3-none-any.whl
Size 157.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3346a1c5058b2e01d991aa07c0b12f121337b80817439795eaefd21d9c967505
BLAKE2b-256 checksum
How to use checksums
6bd93a40b36cce3558a9aafc50051679beaebf9ffdcf5ae3c52a47a402423b7b
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 Oct 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

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