mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Added initialize/finalize routines in criticality module.
This commit is contained in:
parent
3ffbd80efd
commit
66b06a3bda
1 changed files with 66 additions and 42 deletions
|
|
@ -47,29 +47,20 @@ contains
|
|||
! LOOP OVER BATCHES
|
||||
BATCH_LOOP: do current_batch = 1, n_batches
|
||||
|
||||
message = "Simulating batch " // trim(to_str(current_batch)) // "..."
|
||||
call write_message(8)
|
||||
|
||||
! Reset total starting weight
|
||||
total_weight = ZERO
|
||||
call initialize_batch()
|
||||
|
||||
! =======================================================================
|
||||
! LOOP OVER GENERATIONS
|
||||
GENERATION_LOOP: do current_gen = 1, gen_per_batch
|
||||
|
||||
! Set all tallies to zero
|
||||
n_bank = 0
|
||||
|
||||
! Count source sites if using uniform fission source weighting
|
||||
if (ufs) call count_source_for_ufs()
|
||||
|
||||
! ====================================================================
|
||||
! LOOP OVER HISTORIES
|
||||
call initialize_generation()
|
||||
|
||||
! Start timer for transport
|
||||
call timer_start(time_transport)
|
||||
|
||||
HISTORY_LOOP: do i = 1, work
|
||||
! ====================================================================
|
||||
! LOOP OVER PARTICLES
|
||||
PARTICLE_LOOP: do i = 1, work
|
||||
|
||||
! grab source particle from bank
|
||||
call get_source_particle(i)
|
||||
|
|
@ -77,44 +68,19 @@ contains
|
|||
! transport particle
|
||||
call transport()
|
||||
|
||||
end do HISTORY_LOOP
|
||||
end do PARTICLE_LOOP
|
||||
|
||||
! Accumulate time for transport
|
||||
call timer_stop(time_transport)
|
||||
|
||||
! ====================================================================
|
||||
! WRAP UP FISSION BANK AND COMPUTE TALLIES, KEFF, ETC
|
||||
|
||||
! Start timer for inter-cycle synchronization
|
||||
call timer_start(time_intercycle)
|
||||
|
||||
! Distribute fission bank across processors evenly
|
||||
call timer_start(time_intercycle)
|
||||
call synchronize_bank()
|
||||
|
||||
! Stop timer for inter-cycle synchronization
|
||||
call timer_stop(time_intercycle)
|
||||
|
||||
end do GENERATION_LOOP
|
||||
|
||||
! Collect tallies
|
||||
if (tallies_on) then
|
||||
call timer_start(time_ic_tallies)
|
||||
call synchronize_tallies()
|
||||
call timer_stop(time_ic_tallies)
|
||||
end if
|
||||
|
||||
! Calculate shannon entropy
|
||||
if (entropy_on) call shannon_entropy()
|
||||
|
||||
! Collect results and statistics
|
||||
call calculate_keff()
|
||||
|
||||
! Turn tallies on once inactive cycles are complete
|
||||
if (current_batch == n_inactive) then
|
||||
tallies_on = .true.
|
||||
call timer_stop(time_inactive)
|
||||
call timer_start(time_active)
|
||||
end if
|
||||
call finalize_batch()
|
||||
|
||||
end do BATCH_LOOP
|
||||
|
||||
|
|
@ -127,4 +93,62 @@ contains
|
|||
|
||||
end subroutine run_criticality
|
||||
|
||||
!===============================================================================
|
||||
! INITIALIZE_BATCH
|
||||
!===============================================================================
|
||||
|
||||
subroutine initialize_batch()
|
||||
|
||||
message = "Simulating batch " // trim(to_str(current_batch)) // "..."
|
||||
call write_message(8)
|
||||
|
||||
! Reset total starting particle weight used for normalizing tallies
|
||||
total_weight = ZERO
|
||||
|
||||
end subroutine initialize_batch
|
||||
|
||||
!===============================================================================
|
||||
! INITIALIZE_GENERATION
|
||||
!===============================================================================
|
||||
|
||||
subroutine initialize_generation()
|
||||
|
||||
! Reset number of fission bank sites
|
||||
n_bank = 0
|
||||
|
||||
! Count source sites if using uniform fission source weighting
|
||||
if (ufs) call count_source_for_ufs()
|
||||
|
||||
end subroutine initialize_generation
|
||||
|
||||
!===============================================================================
|
||||
! FINALIZE_BATCH handles synchronization and accumulation of tallies,
|
||||
! calculation of Shannon entropy, getting single-batch estimate of keff, and
|
||||
! turning on tallies when appropriate
|
||||
!===============================================================================
|
||||
|
||||
subroutine finalize_batch()
|
||||
|
||||
! Collect tallies
|
||||
if (tallies_on) then
|
||||
call timer_start(time_ic_tallies)
|
||||
call synchronize_tallies()
|
||||
call timer_stop(time_ic_tallies)
|
||||
end if
|
||||
|
||||
! Calculate shannon entropy
|
||||
if (entropy_on) call shannon_entropy()
|
||||
|
||||
! Collect results and statistics
|
||||
call calculate_keff()
|
||||
|
||||
! Turn tallies on once inactive cycles are complete
|
||||
if (current_batch == n_inactive) then
|
||||
tallies_on = .true.
|
||||
call timer_stop(time_inactive)
|
||||
call timer_start(time_active)
|
||||
end if
|
||||
|
||||
end subroutine finalize_batch
|
||||
|
||||
end module criticality
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue