source: LMDZ6/trunk/libf/phylmd/ecrad/driver/test_random_number_generator.F90 @ 4773

Last change on this file since 4773 was 4773, checked in by idelkadi, 6 months ago
  • Update of Ecrad in LMDZ The same organization of the Ecrad offline version is retained in order to facilitate the updating of Ecrad in LMDZ and the comparison between online and offline results. version 1.6.1 of Ecrad (https://github.com/lguez/ecrad.git)
  • Implementation of the double call of Ecrad in LMDZ


File size: 1.3 KB
Line 
1program test_random_number_generator
2
3  ! This program tests the radiation random number generator - the
4  ! Minstd generator should produce the same results whether or not
5  ! working floating-point precision (jprb) is single precision (4) or
6  ! double (8)
7 
8  use parkind1, only : jprb, jpim, jpib
9  use radiation_random_numbers, only : rng_type, IRngMinstdVector, IRngNative
10
11  integer(jpim), parameter :: streammax = 512
12
13  ! Choose between two types of random number generator
14  !integer(jpim), parameter :: IRngType = IRngNative
15  integer(jpim), parameter :: IRngType = IRngMinstdVector
16 
17  type(rng_type) :: random_number_generator
18  real(jprb)     :: vec(streammax)
19  integer :: jl
20
21  print *, 'working_fp_precision = ', jprb
22
23  if (IRngType == IRngNative) then
24    print *, "rng_type = 'native'"
25  else
26    print *, "rng_type = 'native'"
27  end if
28 
29  call random_number_generator%initialize(itype=IRngType, iseed=212075152, &
30       &                                  nmaxstreams=streammax)
31  do jl = 1,1
32    print *, 'initial_state = [ ', int(random_number_generator%istate(1:streammax),jpib), ' ]'
33    call random_number_generator%uniform_distribution(vec)
34    print *, 'uniform_deviates = [ ', vec, ' ]'
35    print *, 'final_state = [ ', int(random_number_generator%istate(1:streammax),jpib), ' ]'
36  end do
37
38end program test_random_number_generator
Note: See TracBrowser for help on using the repository browser.