Convert OpenMC tallies into user friendly units
Project description
This Python package aims to help convert OpenMC tallies to user specified units.
Installation
pip install openmc_tally_unit_converter
Usage
OpenMC tally results are save into a statepoint h5 file without units.
This package ascertains the base units of common tallies by inspecting their tally filters and scores.
import openmc_tally_unit_converter as otuc
import openmc
# loads up tally from an openmc statepoint output file
statepoint = openmc.StatePoint(filepath="statepoint.2.h5")
my_tally = statepoint.get_tally(name="my_cell_heating_tally")
# gets the base units of the tally
tally = otuc.process_tally(tally=my_tally)
print(tally)
>>> eV per source_particle
The package then allows users to scale the base tally units to different units. For example the package can easily convert cm to meters or electron volts to joules.
converted_tally = otuc.process_tally(
tally=my_tally,
required_units = Joules / source_particle
)
print(converted_tally)
>>> 2.4e-12 Joules per source_particle
Additional inputs can be applied to normalize the the tallies and convert the units further:
-
The source strength of the source in particles per second can be specified with the
strength_strength
argument. This allows the tally results to be converted from the units of score per simulated particle to score per second. -
The volume of the cell in cm3 can also be specified with the
volume
argument. This allows the tally result to be converted from the base units to base units per unit volume.
:point_right: Further examples
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
Hashes for openmc_tally_unit_converter-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31c40376b58013d1168601c446354dd9c1053e378e934f8f20d4948d42cdc7d7 |
|
MD5 | 5e85b593b6a1fc29c38e25a3185a535a |
|
BLAKE2b-256 | 22f1cb07de243ad5e05aa25852438b9220566549e2a4a4a39117dfc12e8a8ab8 |
Hashes for openmc_tally_unit_converter-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 105669ffaf674f838833f2ceb614a1a1e16560c949e8601cb4ff7ba8ca21aae3 |
|
MD5 | 7f079a0a7eb79e575f83eed42bdde5b7 |
|
BLAKE2b-256 | 0caac47ab09e70c40642d4eeb8939af0e293879e47286a07c714b3889f9f992b |