How to fill bidimensional arrays in fortran90

87 views Asked by At

i have an issue about filling a bidimensional array in Fortran90. in my program I extract different sets of random numbers and check them as uncertainties to my measurements ustar and Tstar, and i get uerr and terr. Now I want to put uerr and terr in a two-dimensional array because then I have to repeat this procedure n times to get different dataset (the Monte Carlo method for the estimation of errors). How do I assign uerr and terr to my array? And how do I iterate the process n times each time you run the program? I tried giving my array "set" the indexes r and c but at compile I get:

Warning: Extension: REAL array index at (1)

i read ustar and tstar from an input file, the code is below:

program stimerr
 implicit none

 character(len=12) filein,fileout
 integer,dimension(1) :: seed = (/4/)
 real, dimension(2) :: num
 integer :: n,h,i
 real, dimension(24,2) :: set 
 real :: pi = 3.14159
 real :: g1,g2,ustar,tstar,uerr,terr

 write(*,'(2x,''File di input .......''/)')
 read(*,'(a12)') filein
 open(unit=120,File=filein)

 set = 0.

 call init_random_seed ()
  do n=1,24
  read(120,*) h,ustar,tstar
  call random_number(num)

  g1 =(sqrt(-2*log(num(1)))*(cos(2*pi*(num(2)))))/10.
  g2 =(sqrt(-2*log(num(1)))*(sin(2*pi*(num(2)))))/10.

  uerr = ustar + g1
  terr = tstar + g2

  write(*,*) set(uerr,terr)


  enddo


close(120)



end program stimerr
0

There are 0 answers