Yet Another NeoClassical Code.
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.field import Field
from yancc.solve import solve_dke
from yancc.species import Hydrogen, LocalMaxwellian
from yancc.velocity_grids import MaxwellSpeedGrid, UniformPitchAngleGrid
# 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.
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 yancc-0.0.1.tar.gz.
File metadata
- Download URL: yancc-0.0.1.tar.gz
- Upload date:
- Size: 197.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
429284e21c8134c57408e805f293cf173d7b55591b370d0927e1229125860580
|
|
| MD5 |
2857a5b48b86d25eae9e2f3681c004d2
|
|
| BLAKE2b-256 |
3baaa8854b5815fd35c22ff7b0941bc1e33e70a311830038f0a5638b34449b9f
|
File details
Details for the file yancc-0.0.1-py3-none-any.whl.
File metadata
- Download URL: yancc-0.0.1-py3-none-any.whl
- Upload date:
- Size: 129.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f607e9a5a8b5f4d27b3454f964d074a1417bfbc353f3943bf7adbac01576a94
|
|
| MD5 |
715318e7443495a6b21aae4481b60d44
|
|
| BLAKE2b-256 |
0deecc2dc68b91f61c30572df602010c283a154e23a2af9b4b46628f1ad62747
|