Add Python bindings for global num_realizations. Fix active rate.

This commit is contained in:
Paul Romano 2017-11-17 11:22:48 -06:00
parent 7b5f2bb821
commit 402b09ee3d
3 changed files with 9 additions and 3 deletions

View file

@ -22,6 +22,7 @@ Functions
openmc.capi.keff
openmc.capi.load_nuclide
openmc.capi.next_batch
openmc.capi.num_realizations
openmc.capi.plot_geometry
openmc.capi.reset
openmc.capi.run

View file

@ -13,7 +13,7 @@ from .error import _error_handler, AllocationError, InvalidIDError
from .filter import _get_filter
__all__ = ['Tally', 'tallies', 'global_tallies']
__all__ = ['Tally', 'tallies', 'global_tallies', 'num_realizations']
# Tally functions
_dll.openmc_extend_tallies.argtypes = [c_int32, POINTER(c_int32), POINTER(c_int32)]
@ -89,7 +89,7 @@ def global_tallies():
# Get sum, sum-of-squares, and number of realizations
sum_ = array[:, 1]
sum_sq = array[:, 2]
n = c_int32.in_dll(_dll, 'n_realizations').value
n = num_realizations()
# Determine mean
mean = sum_ / n
@ -102,6 +102,11 @@ def global_tallies():
return list(zip(mean, stdev))
def num_realizations():
"""Number of realizations of global tallies."""
return c_int32.in_dll(_dll, 'n_realizations').value
class Tally(_FortranObjectWithID):
"""Tally stored internally.

View file

@ -570,7 +570,7 @@ contains
write(ou,100) "Total time elapsed", time_total % elapsed
! Calculate particle rate in active/inactive batches
n_active = n_batches - n_inactive
n_active = current_batch - n_inactive
if (restart_run) then
if (restart_batch < n_inactive) then
speed_inactive = real(n_particles * (n_inactive - restart_batch) * &