Extract data and create plots of OpenMC particle sources
Project description
A Python package for plotting the locations, directions or energy distributions of OpenMC source particles
Installation
pip install openmc_source_plotter
temporary fix
For fixed source sources it is currently necessary to use openmc version 0.11
and also to point the openmc_exec
path to the openmc executable
This can be installed with:
conda install -c conda-forge openmc=0.11
Features
The package provides functions to:
- create the initial_source.h5 for a give openmc.source
- extract the locations, directions and energy of particles
- provides convenient plotting functions for
- 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,
number_of_particles=2000,
energy_bins=np.linspace(0, 20e6, 100),
openmc_exec="/home/jshim/miniconda3/envs/openmc_0_11_0/bin/openmc",
)
plot.show()
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,
number_of_particles=100,
openmc_exec="/home/jshim/miniconda3/envs/openmc_0_11_0/bin/openmc",
)
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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6169f4b024b7ab4d1894d4541a89738fb856206f531c8bc3d4563daf359d0dc7 |
|
MD5 | 996a7bb8da6304170182a32bbff278d4 |
|
BLAKE2b-256 | 61385a4cc09d3afb5db4ebde7f37ae25f5e733092e2d58339bc7333415c1d9ef |
Close
Hashes for openmc_source_plotter-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85aac3acd0c0aaa8770fe65230acc93d6b68699d077c8bfaf8f2167b8555b774 |
|
MD5 | d1144f7505d0b518c0a518686aa1577d |
|
BLAKE2b-256 | a7180f022f412eca227a324b0e3c810295e2b803487ef0e71926ba2969349178 |