openmc.lib.iter_batches

openmc.lib.iter_batches()[source]

Iterator over batches.

This function returns a generator-iterator that allows Python code to be run between batches in an OpenMC simulation. It should be used in conjunction with openmc.lib.simulation_init() and openmc.lib.simulation_finalize(). For example:

with openmc.lib.run_in_memory():
    openmc.lib.simulation_init()
    for _ in openmc.lib.iter_batches():
        # Look at convergence of tallies, for example
        ...
    openmc.lib.simulation_finalize()