mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Changed some confusing names in module random_lcg
This commit is contained in:
parent
1f33f93e63
commit
bfcb1753b2
4 changed files with 21 additions and 20 deletions
|
|
@ -10,7 +10,7 @@ module cross_section
|
|||
use material_header, only: Material
|
||||
use nuclide_header
|
||||
use particle_header, only: Particle
|
||||
use random_lcg, only: prn, get_prn_ahead, prn_set_stream
|
||||
use random_lcg, only: prn, future_prn, prn_set_stream
|
||||
use sab_header, only: SAlphaBeta
|
||||
use search, only: binary_search
|
||||
|
||||
|
|
@ -392,7 +392,7 @@ contains
|
|||
! random number for the same nuclide at different temperatures, therefore
|
||||
! preserving correlation of temperature in probability tables.
|
||||
call prn_set_stream(STREAM_URR_PTABLE)
|
||||
r = get_prn_ahead(int(nuc_zaid_dict % get_key(nuc % zaid), 8))
|
||||
r = future_prn(int(nuc_zaid_dict % get_key(nuc % zaid), 8))
|
||||
call prn_set_stream(STREAM_TRACKING)
|
||||
|
||||
i_low = 1
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module eigenvalue
|
|||
use math, only: t_percentile
|
||||
use mesh, only: count_bank_sites
|
||||
use mesh_header, only: RegularMesh
|
||||
use random_lcg, only: prn, set_particle_seed, prn_skip
|
||||
use random_lcg, only: prn, set_particle_seed, advance_prn_seed
|
||||
use search, only: binary_search
|
||||
use string, only: to_str
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ contains
|
|||
|
||||
call set_particle_seed(int((current_batch - 1)*gen_per_batch + &
|
||||
current_gen,8))
|
||||
call prn_skip(start)
|
||||
call advance_prn_seed(start)
|
||||
|
||||
! Determine how many fission sites we need to sample from the source bank
|
||||
! and the probability for selecting a site.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ module physics
|
|||
use particle_header, only: Particle
|
||||
use particle_restart_write, only: write_particle_restart
|
||||
use physics_common
|
||||
use random_lcg, only: prn, prn_skip, prn_set_stream
|
||||
use random_lcg, only: prn, advance_prn_seed, prn_set_stream
|
||||
use search, only: binary_search
|
||||
use secondary_uncorrelated, only: UncorrelatedAngleEnergy
|
||||
use string, only: to_str
|
||||
|
|
@ -61,7 +61,7 @@ contains
|
|||
! Advance URR seed stream 'N' times after energy changes
|
||||
if (p % E /= p % last_E) then
|
||||
call prn_set_stream(STREAM_URR_PTABLE)
|
||||
call prn_skip(n_nuc_zaid_total)
|
||||
call advance_prn_seed(n_nuc_zaid_total)
|
||||
call prn_set_stream(STREAM_TRACKING)
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ module random_lcg
|
|||
!$omp threadprivate(prn_seed, stream)
|
||||
|
||||
public :: prn
|
||||
public :: get_prn_ahead
|
||||
public :: future_prn
|
||||
public :: initialize_prng
|
||||
public :: set_particle_seed
|
||||
public :: prn_skip
|
||||
public :: advance_prn_seed
|
||||
public :: prn_set_stream
|
||||
public :: STREAM_TRACKING, STREAM_TALLIES
|
||||
|
||||
|
|
@ -54,19 +54,19 @@ contains
|
|||
end function prn
|
||||
|
||||
!===============================================================================
|
||||
! GET_PRN_AHEAD generates a pseudo-random number which is 'n' times ahead from
|
||||
! FUTURE_PRN generates a pseudo-random number which is 'n' times ahead from the
|
||||
! current seed.
|
||||
!===============================================================================
|
||||
|
||||
function get_prn_ahead(n) result(pseudo_rn)
|
||||
function future_prn(n) result(pseudo_rn)
|
||||
|
||||
integer(8), intent(in) :: n ! number of prns to skip
|
||||
|
||||
real(8) :: pseudo_rn
|
||||
|
||||
pseudo_rn = prn_skip_ahead(n, prn_seed(stream)) * prn_norm
|
||||
pseudo_rn = future_seed(n, prn_seed(stream)) * prn_norm
|
||||
|
||||
end function get_prn_ahead
|
||||
end function future_prn
|
||||
|
||||
!===============================================================================
|
||||
! INITIALIZE_PRNG sets up the random number generator, determining the seed and
|
||||
|
|
@ -106,31 +106,32 @@ contains
|
|||
integer :: i
|
||||
|
||||
do i = 1, N_STREAMS
|
||||
prn_seed(i) = prn_skip_ahead(id*prn_stride, prn_seed0 + i - 1)
|
||||
prn_seed(i) = future_seed(id*prn_stride, prn_seed0 + i - 1)
|
||||
end do
|
||||
|
||||
end subroutine set_particle_seed
|
||||
|
||||
!===============================================================================
|
||||
! PRN_SKIP advances the random number seed 'n' times from the current seed
|
||||
! ADVANCE_PRN_SEED advances the random number seed 'n' times from the current
|
||||
! seed.
|
||||
!===============================================================================
|
||||
|
||||
subroutine prn_skip(n)
|
||||
subroutine advance_prn_seed(n)
|
||||
|
||||
integer(8), intent(in) :: n ! number of seeds to skip
|
||||
|
||||
prn_seed(stream) = prn_skip_ahead(n, prn_seed(stream))
|
||||
prn_seed(stream) = future_seed(n, prn_seed(stream))
|
||||
|
||||
end subroutine prn_skip
|
||||
end subroutine advance_prn_seed
|
||||
|
||||
!===============================================================================
|
||||
! PRN_SKIP_AHEAD advances the random number seed 'skip' times. This is usually
|
||||
! FUTURE_SEED advances the random number seed 'skip' times. This is usually
|
||||
! used to skip a fixed number of random numbers (the stride) so that a given
|
||||
! particle always has the same starting seed regardless of how many processors
|
||||
! are used
|
||||
!===============================================================================
|
||||
|
||||
function prn_skip_ahead(n, seed) result(new_seed)
|
||||
function future_seed(n, seed) result(new_seed)
|
||||
|
||||
integer(8), intent(in) :: n ! number of seeds to skip
|
||||
integer(8), intent(in) :: seed ! original seed
|
||||
|
|
@ -182,7 +183,7 @@ contains
|
|||
! With G and C, we can now find the new seed
|
||||
new_seed = iand(g_new*seed + c_new, prn_mask)
|
||||
|
||||
end function prn_skip_ahead
|
||||
end function future_seed
|
||||
|
||||
!===============================================================================
|
||||
! PRN_SET_STREAM changes the random number stream. If random numbers are needed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue