Skip to main content

CI testing codecov PyPI version

OpenMC-plasma-source

This python-based package offers a collection of pre-built OpenMC neutron sources for fusion applications.

Installation

OpenMC is required to use this package.

To install openmc_plasma_source, simply run:

pip install openmc_plasma_source

Usage

Tokamak Source

Create a source with a spatial and temperature distribution of a tokamak plasma. The function returns an openmc.MeshSource, plasma volume, and fusion power. The source is backed by a CylindricalMesh. The plasma cross-section is discretised onto the mesh and each mesh voxel is assigned its own neutron source strength (its neutron emission rate in neutrons per second) and energy distribution based on the local ion temperature. The strength of the returned source, my_source.strength, is the total neutron emission rate of the plasma, which can be used to normalise tallies (OpenMC tally results are per source neutron).

The equations implemented here are taken from this paper.

from openmc_plasma_source import tokamak_source

make_source = tokamak_source(
    elongation=1.557,
    ion_density_centre=1.09e20,
    ion_density_pedestal=1.09e20,
    ion_density_peaking_factor=1,
    ion_density_separatrix=3e19,
    ion_temperature_centre=45.9e3,
    ion_temperature_pedestal=6.09e3,
    ion_temperature_separatrix=0.1e3,
    ion_temperature_peaking_factor=8.06,
    ion_temperature_beta=6,
    major_radius=906,
    minor_radius=292.258,
    pedestal_radius=0.8 * 292.258,
    mode="H",
    shafranov_factor=0.44789,
    triangularity=0.270,
    fuel={"D": 0.5, "T": 0.5},
)
my_source = make_source.source

The mesh resolution and the density of the internal sampling grid can be controlled with optional arguments, along with the toroidal extent of the source:

make_source = tokamak_source(
    # ... plasma parameters as above ...
    start_angle=0,                 # toroidal start angle in radians
    rotation_angle=2 * 3.14159,    # toroidal extent in radians
    mesh_resolution=(100, 100), # number of mesh bins in (r, z)
    grid_density=500,              # points per dimension in the (a, alpha) grid
)
my_source = make_source.source

The plasma volume and total fusion power are returned separately:

print(make_source.plasma_volume)  # plasma volume in m^3
print(make_source.fusion_power)   # total fusion power in MW

For a more complete example check out the example script.

out out

Ring Source

Create a ring source with temperature distribution of a 2000 eV plasma.

from openmc_plasma_source import fusion_ring_source

my_source = fusion_ring_source(
    radius=700,
    start_angle=0.0,            # toroidal start angle in radians
    rotation_angle=2 * math.pi, # toroidal extent in radians (360deg source)
    temperature=20000.0,
    fuel={"D": 0.5, "T": 0.5},
)

Point Source

Create a point source with temperature distribution of a 2000 eV plasma.

from openmc_plasma_source import fusion_point_source

my_source = fusion_point_source(
    coordinate=(0, 0, 0),
    temperature=20000.0,
    fuel={"D": 0.09, "T": 0.91},  # note this is mainly tritium fuel so that TT reactions are more likely
)

Testing

To run the tests, simply run

pytest tests

Metadata

Release files for openmc-plasma-source 0.9.1

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

Source distribution (sdist)

Source distribution for openmc-plasma-source 0.9.1
File Size Uploaded
openmc_plasma_source-0.9.1.tar.gz 31.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openmc-plasma-source 0.9.1
File Interpreter ABI Platform
openmc_plasma_source-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 47.2 kB

Release files / openmc_plasma_source-0.9.1.tar.gz

Download URL openmc_plasma_source-0.9.1.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
84614e8a4769e4e73f23b50b1519b2a00a02e057aea48b14a5a6ce5307ec0cf7
BLAKE2b-256 checksum
How to use checksums
0d50b375e6e79cee18b01331f9c884655c56b0fbf1d134494e432fa80d4e5b33
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 9, 2026.

Transparency log

Release files / openmc_plasma_source-0.9.1-py3-none-any.whl

Download URL openmc_plasma_source-0.9.1-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88c29ea5788452a03ee53d67ba756c2411a2da9629f31a028bf278c634d1b4c1
BLAKE2b-256 checksum
How to use checksums
2992b88feccc165af16b1756e46a5db3990c5f16c097b7ef511426c29d54966a
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 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

2 release files

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