Skip to content

Commit

Permalink
adding option to have same seed in both spatial MH_psi and gyro distr…
Browse files Browse the repository at this point in the history
…ibution
  • Loading branch information
mbeidler3 committed Apr 16, 2024
1 parent baf542e commit 2983f2a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
12 changes: 10 additions & 2 deletions src/korc_spatial_distribution.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ subroutine MH_psi(params,spp,F)
REAL(rp), DIMENSION(:), ALLOCATABLE :: PHI_samples
!! Azimuithal angle of all samples
REAL(rp), DIMENSION(:), ALLOCATABLE :: Z_samples
!! Vertical location of all samples
!! Vertical location of all samplesMH_psi

REAL(rp) :: min_R,max_R
REAL(rp) :: min_Z,max_Z
Expand Down Expand Up @@ -1427,7 +1427,15 @@ subroutine MH_psi(params,spp,F)
if (.not.params%SameRandSeed) then
call init_random_seed(params)
else
call random_seed(put=seed)
#ifdef PARALLEL_RANDOM
call initialize_random(seed(1))
call initialize_random_U(seed(1))
call initialize_random_N(seed(1))

! call initialize_random_mkl(seed(1))
#else
call random_seed(put=seed)
#endif
end if

write(output_unit_write,'("Begin burn: ",I10)')
Expand Down
13 changes: 10 additions & 3 deletions src/korc_velocity_distribution.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ MODULE korc_velocity_distribution
USE korc_hpc
use korc_fields
use korc_rnd_numbers
use korc_random
use korc_hammersley_generator
use korc_avalanche
use korc_experimental_pdf
Expand Down Expand Up @@ -413,9 +414,15 @@ subroutine gyro_distribution(params,F,spp)

! * * * * INITIALIZE VELOCITY * * * *

call init_random_seed(params)
call RANDOM_NUMBER(theta)
call finalize_random_seed
if (.not.params%SameRandSeed) then
call init_random_seed(params)
call RANDOM_NUMBER(theta)
call finalize_random_seed
else
do pp=1_idef,spp%ppp
theta(pp)=get_random_U()
enddo
endif
theta = 2.0_rp*C_PI*theta

if (spp%spatial_distribution.eq.'TRACER') theta=2.0*C_PI
Expand Down

0 comments on commit 2983f2a

Please sign in to comment.