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

current_batch

Return the current batch of the simulation.

export_properties

Export physical properties.

export_weight_windows

Export weight windows.

import_weight_windows

Import weight windows.

finalize

Finalize simulation and free memory

find_cell

Find the cell at a given point

find_material

Find the material at a given point

global_bounding_box

Calculate a global bounding box for the model

global_tallies

Mean and standard deviation of the mean for each global tally.

hard_reset

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

id_map

Generate a 2-D map of cell and material IDs.

import_properties

Import physical properties.

init

Initialize OpenMC

is_statepoint_batch

Return whether statepoint will be written in current batch or not.

iter_batches

Iterator over batches.

keff

Return the calculated k-eigenvalue and its standard deviation.

load_nuclide

Load cross section data for a nuclide.

master

Return whether processor is master processor or not.

next_batch

Run next batch.

num_realizations

Number of realizations of global tallies.

plot_geometry

Plot geometry

property_map

Generate a 2-D map of cell temperatures and material densities.

reset

Reset tally results

reset_timers

Reset timers.

run

Run simulation

run_in_memory

Provides context manager for calling OpenMC shared library functions.

sample_external_source

Sample external source

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.

CylindricalMesh

CylindricalMesh stored internally.

EnergyFilter

MaterialFilter

Material

Material stored internally.

MeshFilter

MeshSurfaceFilter

Nuclide

Nuclide stored internally.

RectilinearMesh

RectilinearMesh stored internally.

RegularMesh

RegularMesh stored internally.

SphericalMesh

SphericalMesh stored internally.

Tally

Tally stored internally.