source: LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/driver/test_random_number_generator.F90 @ 4728

Last change on this file since 4728 was 4728, checked in by idelkadi, 10 months ago

Update of ecrad in the LMDZ_ECRad branch of LMDZ:

  • version 1.6.1 of ecrad
  • files are no longer grouped in the same ecrad directory.
  • the structure of ecrad offline is preserved to facilitate updating in LMDZ
  • cfg.bld modified to take into account the new added subdirectories.
  • the interface routines and those added in ecrad are moved to the phylmd directory
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.