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.

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.

import_weight_windows

Import weight windows.

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_finalize

Finalize simulation

simulation_init

Initialize simulation

source_bank

Return source bank as NumPy array

statepoint_write

Write a statepoint file.

Classes

AzimuthalFilter

Cell

Cell stored internally.

CellFilter

CellInstanceFilter

CellbornFilter

CellfromFilter

CollisionFilter

CylindricalMesh

CylindricalMesh stored internally.

DelayedGroupFilter

DistribcellFilter

EnergyFilter

EnergyFunctionFilter

EnergyoutFilter

Filter

LegendreFilter

Material

Material stored internally.

MaterialFilter

MaterialFromFilter

Mesh

Base class to represent mesh objects

MeshFilter

Mesh filter stored internally.

MeshBornFilter

MeshBorn filter stored internally.

MeshSurfaceFilter

MeshSurface filter stored internally.

MuFilter

Nuclide

Nuclide stored internally.

ParticleFilter

PolarFilter

RectilinearMesh

RectilinearMesh stored internally.

RegularMesh

RegularMesh stored internally.

SpatialLegendreFilter

SphericalHarmonicsFilter

SphericalMesh

SphericalMesh stored internally.

SurfaceFilter

Tally

Tally stored internally.

UniverseFilter

UnstructuredMesh

WeightWindows

WeightWindows stored internally.

ZernikeFilter

ZernikeRadialFilter

Data

openmc.lib.cells

Mapping of cell ID to openmc.lib.Cell instances.

Type

dict

openmc.lib.filters

Mapping of filter ID to openmc.lib.Filter instances.

Type

dict

openmc.lib.materials

Mapping of material ID to openmc.lib.Material instances.

Type

dict

openmc.lib.meshes

Mapping of mesh ID to openmc.lib.Mesh instances.

Type

dict

openmc.lib.nuclides

Mapping of nuclide name to openmc.lib.Nuclide instances.

Type

dict

openmc.lib.tallies

Mapping of tally ID to openmc.lib.Tally instances.

Type

dict

openmc.lib.weight_windows

Mapping of weight window ID to openmc.lib.WeightWindows instances.

Type

dict