mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Add Python bindings for global num_realizations. Fix active rate.
This commit is contained in:
parent
7b5f2bb821
commit
402b09ee3d
3 changed files with 9 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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) * &
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue