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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e292c8bb7675d49e9e60d3357701acf2b3872a6e1f1576ce8d0c2b5a1013d788 |
|
MD5 | ef96227edb86630b511feb692fc9450e |
|
BLAKE2b-256 | 51397bbebad4ca197d22c318568a636e63134231ca77731bb100a26c3ff28bb5 |
Close
Hashes for openmc_source_plotter-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a12b456842f1479da534af299fa416229e4bf5887d5422a733e9128b1189b6f |
|
MD5 | b9d8aed57f0d3dc8c799238b6fed4e9b |
|
BLAKE2b-256 | f610a3bab1c947d2e60a6056eb738fd702828ccd85a72607cdf74556a4b22b53 |