Skip to main content

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()

openmc particle source energy plot

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()

openmc particle source direction plot

Usage

See the examples folder for example usage scripts.

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_source_plotter-0.1.0.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

openmc_source_plotter-0.1.0-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page