Remove functionality to handle restart batches, add comments for all CMFD instance variables and methods

This commit is contained in:
Shikhar Kumar 2018-09-06 19:42:02 -04:00
parent 7246266693
commit e8176efa36
5 changed files with 800 additions and 192 deletions

View file

@ -42,7 +42,7 @@ _dll.openmc_next_batch.errcheck = _error_handler
_dll.openmc_next_batch_before_cmfd_init.argtypes = []
_dll.openmc_next_batch_before_cmfd_init.restype = c_int
_dll.openmc_next_batch_before_cmfd_init.errcheck = _error_handler
_dll.openmc_next_batch_between_cmfd_init_execute.argtypes = [POINTER(c_int)]
_dll.openmc_next_batch_between_cmfd_init_execute.argtypes = []
_dll.openmc_next_batch_between_cmfd_init_execute.restype = c_int
_dll.openmc_next_batch_between_cmfd_init_execute.errcheck = _error_handler
_dll.openmc_next_batch_after_cmfd_execute.argtypes = [POINTER(c_int)]
@ -231,6 +231,23 @@ def keff():
return (mean, std_dev)
# TODO Remove
def keff_temp():
"""Return the calculated tracklength k-eigenvalue and its standard deviation.
Returns
-------
tuple
Mean k-eigenvalue and standard deviation of the mean
"""
n = openmc.capi.num_realizations()
mean = c_double.in_dll(_dll, 'openmc_keff').value
std_dev = c_double.in_dll(_dll, 'openmc_keff_std').value \
if n > 1 else np.inf
return (mean, std_dev)
def master():
"""Return whether processor is master processor or not.
@ -267,16 +284,8 @@ def next_batch_between_cmfd_init_execute():
"""Run everything in batch that occurs between CMFD
initialization and execution.
Returns
-------
int
Status after running block (0=batch is part of restart batch so don't
run CMFD, 3=normal execution, continue with CMFD solver)
"""
status = c_int()
_dll.openmc_next_batch_between_cmfd_init_execute(status)
return status.value
_dll.openmc_next_batch_between_cmfd_init_execute()
def next_batch_after_cmfd_execute():

View file

@ -22,8 +22,6 @@ class _Settings(object):
generations_per_batch = _DLLGlobal(c_int32, 'gen_per_batch')
inactive = _DLLGlobal(c_int32, 'n_inactive')
particles = _DLLGlobal(c_int64, 'n_particles')
restart_batch = _DLLGlobal(c_int, 'openmc_restart_batch')
restart_run = _DLLGlobal(c_bool, 'openmc_restart_run')
verbosity = _DLLGlobal(c_int, 'openmc_verbosity')
@property

File diff suppressed because it is too large Load diff

View file

@ -54,7 +54,6 @@ module simulation
integer(C_INT), parameter :: STATUS_EXIT_NORMAL = 0
integer(C_INT), parameter :: STATUS_EXIT_MAX_BATCH = 1
integer(C_INT), parameter :: STATUS_EXIT_ON_TRIGGER = 2
integer(C_INT), parameter :: STATUS_CONTINUE_BATCH = 3
contains
@ -157,8 +156,7 @@ contains
! OPENMC_NEXT_BATCH_BETWEEN_CMFD_INIT_EXECUTE
!===============================================================================
function openmc_next_batch_between_cmfd_init_execute(status) result(err) bind(C)
integer(C_INT), intent(out), optional :: status
function openmc_next_batch_between_cmfd_init_execute() result(err) bind(C)
integer(C_INT) :: err
type(Particle) :: p
@ -166,13 +164,6 @@ contains
err = 0
! Handle restart runs
if (restart_run .and. current_batch <= restart_batch) then
call replay_batch_history()
status = STATUS_EXIT_NORMAL
return
end if
! =======================================================================
! LOOP OVER GENERATIONS
GENERATION_LOOP: do current_gen = 1, gen_per_batch
@ -215,10 +206,6 @@ contains
n_realizations = 0
end if
if (present(status)) then
status = STATUS_CONTINUE_BATCH
end if
end function openmc_next_batch_between_cmfd_init_execute
!===============================================================================

View file

@ -65,7 +65,7 @@ module simulation_header
! ============================================================================
! MISCELLANEOUS VARIABLES
integer(C_INT), bind(C, name='openmc_restart_batch') :: restart_batch
integer :: restart_batch
! Flag for enabling cell overlap checking during transport
integer(8), allocatable :: overlap_check_cnt(:)