Skip to main content

Creates tokamak and fusion point sources for OpenMC

Project description

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 a single openmc.MeshSource backed by a CylindricalMesh. The plasma cross-section is discretised onto the mesh and each mesh voxel is assigned its own neutron source strength (the probability that a neutron spawns in that voxel) and energy distribution based on the local ion temperature.

The equations implemented here are taken from this paper.

from openmc_plasma_source import tokamak_source

my_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},
)

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:

my_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, 1, 100), # number of mesh bins in (r, phi, z)
    grid_density=500,              # points per dimension in the (a, alpha) grid
)

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

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

openmc_plasma_source-0.6.0.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openmc_plasma_source-0.6.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file openmc_plasma_source-0.6.0.tar.gz.

File metadata

  • Download URL: openmc_plasma_source-0.6.0.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openmc_plasma_source-0.6.0.tar.gz
Algorithm Hash digest
SHA256 30ee1ca3a4a1f032707940c2d1d94ad60d0e99b82cf9972cd1612a3f24cab443
MD5 6b4c01819576c34590040f6bc2661f8e
BLAKE2b-256 bd43f55c53b65e5a3d6bff8feaa866878c1fba475b7a21d9b37bc4333fe939dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for openmc_plasma_source-0.6.0.tar.gz:

Publisher: python-publish.yml on fusion-energy/openmc-plasma-source

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openmc_plasma_source-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openmc_plasma_source-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10bbd4ac6b010ed6fd51178c916ba3ce3b51257436f42567eb74f76483154dd9
MD5 e91efb3f846c88e16e5d1a45f88a7b98
BLAKE2b-256 b9c51a60ed3ac15117d0d5f5720f0047fc9a08d0a2ef3fcd7dcf229cf3cb22ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for openmc_plasma_source-0.6.0-py3-none-any.whl:

Publisher: python-publish.yml on fusion-energy/openmc-plasma-source

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