Extract data and create plots of OpenMC particle sources
Project description
A Python package for plotting the locations, directions or energy distributions of OpenMC sources.
Installation
pip install openmc_source_plotter
Features
The package provides functions to:
- extract the locations, directions and energy of particles
- visualise an
openmc.Source
with respect to:- direction
- energy
- location
Example plots
Plot of energy distribution of the source
import openmc_source_plotter as osp
import openmc
import numpy as np
# initialises a new source object
my_source = openmc.Source()
# sets the energy distribution to a Muir distribution neutrons for DT fusion neutrons
my_source.energy = openmc.stats.Muir(e0=14080000.0, m_rat=5.0, kt=20000.0)
# plots the particle energy distribution
plot = osp.plot_source_energy(
source=my_source,
n_samples=2000,
)
plot.show()
Plot of energy distribution of two sources
import openmc_source_plotter as osp
import openmc
import numpy as np
# initialises a new source object
my_dt_source = openmc.Source()
# sets the energy distribution to a Muir distribution DT neutrons
my_dt_source.energy = openmc.stats.Muir(e0=14080000.0, m_rat=5.0, kt=20000.0)
# initialises a new source object
my_dd_source = openmc.Source()
# sets the energy distribution to a Muir distribution DD neutrons
my_dd_source.energy = openmc.stats.Muir(e0=2080000.0, m_rat=2.0, kt=20000.0)
# plots the particle energy distribution
plot = osp.plot_source_energy(
source=[my_dt_source, my_dd_source],
n_samples=10000,
)
plot.show()
Plot direction of particles
import openmc_source_plotter as osp
import openmc
# initializes a new source object
my_source = openmc.Source()
# sets the direction to isotropic
my_source.angle = openmc.stats.Isotropic()
# plots the particle energy distribution
plot = osp.plot_source_direction(
source=my_source,
n_samples=100,
)
plot.show()
Plot position of particles
import openmc_source_plotter as osp
import openmc
# initialises a new source object
my_source = openmc.Source()
# the distribution of radius is just a single value
radius = openmc.stats.Discrete([10], [1])
# the distribution of source z values is just a single value
z_values = openmc.stats.Discrete([0], [1])
# the distribution of source azimuthal angles values is a uniform distribution between 0 and 2 Pi
angle = openmc.stats.Uniform(a=0.0, b=2 * 3.14159265359)
# this makes the ring source using the three distributions and a radius
my_source.space = openmc.stats.CylindricalIndependent(
r=radius, phi=angle, z=z_values, origin=(0.0, 0.0, 0.0)
)
# plots the particle energy distribution
plot = osp.plot_source_position(source=my_source)
plot.show()
Usage
See the examples folder for example usage scripts.
Project details
Release history Release notifications | RSS feed
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
Close
Hashes for openmc_source_plotter-0.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11f993d5b07296308457a9f629faea7445f91c3e58fed958210cee6f9f69902e |
|
MD5 | 8e8c18705809618339417fa206a15805 |
|
BLAKE2b-256 | 425818275ee5af45c0aa59d9a7dad1a607d14c2d515b9049478b284de0ddb05a |
Close
Hashes for openmc_source_plotter-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4a843c766ddfa6ec839959cc040af97600989685d2a998a120c59786e9e184f |
|
MD5 | 725ee3d368faf5cdea251445a85090fa |
|
BLAKE2b-256 | 05c9be48399091928f0a717e6255f77f703b1f3f33c7b8dc9087ef9c112f138b |