openmc.lib – Python bindings to the C/C++ API

This module provides bindings to C/C++ functions defined by OpenMC shared library. When the openmc.lib package is imported, the OpenMC shared library is automatically loaded. Calls to the OpenMC library can then be via functions or objects in openmc.lib, for example:

openmc.lib.init()
openmc.lib.run()
openmc.lib.finalize()

Functions

calculate_volumes

Run stochastic volume calculation

finalize

Finalize simulation and free memory

find_cell

Find the cell at a given point

find_material

Find the material at a given point

hard_reset

Reset tallies, timers, and pseudo-random number generator state.

init

Initialize OpenMC

iter_batches

Iterator over batches.

keff

Return the calculated k-eigenvalue and its standard deviation.

load_nuclide

Load cross section data for a nuclide.

next_batch

Run next batch.

num_realizations

Number of realizations of global tallies.

plot_geometry

Plot geometry

reset

Reset tally results

run

Run simulation

run_in_memory

Provides context manager for calling OpenMC shared library functions.

simulation_init

Initialize simulation

simulation_finalize

Finalize simulation

source_bank

Return source bank as NumPy array

statepoint_write

Write a statepoint file.

Classes

Cell

Cell stored internally.

EnergyFilter

MaterialFilter

Material

Material stored internally.

MeshFilter

MeshSurfaceFilter

Nuclide

Nuclide stored internally.

RegularMesh

RegularMesh stored internally.

Tally

Tally stored internally.