40 private :: random_reset
46 logical,
private :: random_fix = .false.
48 integer,
private,
allocatable :: random_seedvar(:)
59 namelist / param_random / &
62 integer :: nseeds, ierr
66 log_info(
"RANDOM_setup",*)
'Setup' 72 log_info(
"RANDOM_setup",*)
'Not found namelist. Default used.' 73 elseif( ierr > 0 )
then 74 log_error(
"RANDOM_setup",*)
'Not appropriate names in namelist PARAM_RANDOM. Check!' 80 call random_seed(size=nseeds)
82 allocate( random_seedvar(nseeds))
85 log_info(
"RANDOM_setup",*)
'Array size for random seed:', nseeds
86 if ( random_fix )
then 87 log_info(
"RANDOM_setup",*)
'random seed is fixed.' 97 subroutine random_reset
106 if ( random_fix )
then 118 call date_and_time(values=time1)
123 + ( time1(1) - 1970 ) * 32140800 &
124 + time1(2) * 2678400 &
132 call random_seed(put=random_seedvar)
135 end subroutine random_reset
142 real(RP),
intent(out) :: var(:,:,:)
145 call random_number(var)
154 real(RP),
intent(out) :: var(:,:,:)
158 call get_normal( n, var(:,:,:) )
165 subroutine get_normal( n, var )
169 integer,
intent(in) :: n
170 real(RP),
intent(out) :: var(n)
178 call random_number(rnd)
183 fact = sqrt(-2.0_rp * log( rnd(i*2-1) ) )
184 theta = 2.0_rp * pi * rnd(i*2)
185 var(i*2-1) = fact * cos(theta)
186 var(i*2 ) = fact * sin(theta)
188 if ( mod(n,2) == 1 )
then 189 fact = sqrt(-2.0_rp * log( rnd(n) ) )
190 theta = 2.0_rp * pi * rnd(n+1)
191 var(n) = fact * cos(theta)
195 end subroutine get_normal
subroutine, public random_setup
Setup.
integer, public io_fid_conf
Config file ID.
integer, public prc_myrank
process num in local communicator
subroutine, public prc_abort
Abort Process.
subroutine, public random_normal(var)
Get normal random number.
real(rp), public const_pi
pi
subroutine, public random_uniform(var)
Get uniform random number.