Advertisement
Guest User

Untitled

a guest
Mar 10th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program test
  2.           implicit none
  3.           REAL:: age, y, z, feh
  4.           REAL, dimension(10):: age1
  5.           real, dimension(3):: y1
  6.           real, dimension(9):: z1
  7.           real, dimension(6):: feh1
  8.           real, allocatable, dimension(2:,:)::array
  9.           integer i
  10.           OPEN(1,file='input.txt')
  11.           read(1,*) age, y, z
  12.           close(1)
  13.           feh = z/0.017
  14.           OPEN(2,file='result.txt',status='replace')
  15.           WRITE(2,*) "age=",age, "y=",y, "z=",z, "Fe/H=",feh
  16.           close(2)
  17.           DATA age1/9.7,9.75,9.8,9.85,9.9,9.95,10,10.05,10.1,10.15/
  18.           DATA y1/0.23,0.26,0.3/
  19.           DATA z1/0.0001,0.0004,0.002,0.002,0.004,0.008,0.017,0.04,0.07/
  20.           DATA feh1/0.00316,0.01,0.0316,0.1,0.316,1/
  21.           open(3,file='border.txt')
  22.           do i = 1, 10
  23.           if(age1(i).lt.age.and.age1(i+1).gt.age) then
  24.           write(3,*) "age1=", age1(i), "age2=", age1(i+1)
  25.           endif
  26.           enddo
  27.           do i=1,3
  28.           if(y1(i).lt.y.and.y1(i+1).gt.y) then
  29.           write(3,*) "y1=", y1(i), "y2=", y1(i+1)
  30.           end if
  31.           end do
  32.           do i=1,9
  33.           if(z1(i).lt.z.and.z1(i+1).gt.z) then
  34.           write(3,*) "z1=", z1(i), "z2=", z1(i+1)
  35.           end if
  36.           end do
  37.           do i=1,9
  38.           if(feh1(i).lt.feh.and.feh1(i+1).gt.feh) then
  39.           write(3,*) "feh1=", feh1(i), "feh2=", feh1(i+1)
  40.           end if
  41.           end do
  42.           close(3)
  43.           open(4, File='FLUXTREC.data')
  44.  
  45.       end program test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement