mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Minor restructuring in source module, added copy_source_attributes subroutine. Moved count for total_weight into transport module.
This commit is contained in:
parent
d721072423
commit
b6bee4cc7a
4 changed files with 79 additions and 21 deletions
|
|
@ -4,24 +4,29 @@ module fixed_source
|
|||
use global
|
||||
use output, only: write_message, header
|
||||
use physics, only: transport
|
||||
use source, only: get_source_particle
|
||||
use random_lcg, only: set_particle_seed
|
||||
use source, only: initialize_particle, sample_external_source, &
|
||||
copy_source_attributes
|
||||
use string, only: to_str
|
||||
use tally, only: synchronize_tallies
|
||||
use timing, only: timer_start, timer_stop
|
||||
|
||||
type(Bank), pointer :: source_site => null()
|
||||
|
||||
contains
|
||||
|
||||
subroutine run_fixedsource()
|
||||
|
||||
integer(8) :: i ! index over histories in single cycle
|
||||
integer(8) :: i ! index over histories in single cycle
|
||||
|
||||
if (master) call header("BEGIN SIMULATION", level=1)
|
||||
|
||||
tallies_on = .true.
|
||||
call timer_start(time_inactive)
|
||||
|
||||
! Allocate particle
|
||||
! Allocate particle and dummy source site
|
||||
allocate(p)
|
||||
allocate(source_site)
|
||||
|
||||
! ==========================================================================
|
||||
! LOOP OVER BATCHES
|
||||
|
|
@ -36,8 +41,19 @@ contains
|
|||
! LOOP OVER PARTICLES
|
||||
PARTICLE_LOOP: do i = 1, work
|
||||
|
||||
! Set unique particle ID
|
||||
p % id = (current_batch - 1)*n_particles + bank_first + i - 1
|
||||
|
||||
! set particle trace
|
||||
trace = .false.
|
||||
if (current_batch == trace_batch .and. current_gen == trace_gen .and. &
|
||||
bank_first + i - 1 == trace_particle) trace = .true.
|
||||
|
||||
! set random number seed
|
||||
call set_particle_seed(p % id)
|
||||
|
||||
! grab source particle from bank
|
||||
call get_source_particle(i)
|
||||
call sample_source_particle()
|
||||
|
||||
! transport particle
|
||||
call transport()
|
||||
|
|
@ -76,4 +92,21 @@ contains
|
|||
|
||||
end subroutine initialize_batch
|
||||
|
||||
!===============================================================================
|
||||
! SAMPLE_SOURCE_PARTICLE
|
||||
!===============================================================================
|
||||
|
||||
subroutine sample_source_particle()
|
||||
|
||||
! Set particle
|
||||
call initialize_particle()
|
||||
|
||||
! Sample the external source distribution
|
||||
call sample_external_source(source_site)
|
||||
|
||||
! Copy source attributes to the particle
|
||||
call copy_source_attributes(source_site)
|
||||
|
||||
end subroutine sample_source_particle
|
||||
|
||||
end module fixed_source
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue