openmc.capi.iter_batches

openmc.capi.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.capi.simulation_init() and openmc.capi.simulation_finalize(). For example:

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