Hi,
I am trying to create a executable of the following program, but wen I try to run it, appears the error 94 - Unit has neither been opened or preconnected, at the call READ(,) H1 and I don't andurstand why? Can anyone tell me why this happens?
Thanks for the help!
* PROGRAM ROUTING
C Declaration of variables
INTEGER N,I,T1,DT
INTEGER T(250)
REAL A,K,H,H1,ST
REAL Q(250),QT(250),HD(250)
CHARACTER*12 NAMEIN,NAMOUT
CHARACTER*1 NO,AAA
C Input of data
WRITE (*,'(A)') ' ***** Flood routing calculation *****'
WRITE (*,*)
WRITE (*,'(A)') ' Give the name of input data file: '
READ (*,'(A12)') NAMEIN
OPEN (1,FILE=NAMEIN,STATUS='OLD',ACCESS='SEQUENTIAL')
READ (1,*) N
C N is the total number of input discharge observations (N ⇐ 250) READ (1,) T1 C T1 is zero time READ (1,) DT C DT is the time increment
WRITE (*,*)
WRITE (*,'(A)') ' Input hydrograph: '
DO 60 I=1,N
T(I)=T1+(I-1)*DT
READ (1,*) Q(I)
C Read discharge at each time. Time increment is constant. WRITE (,) ' Time= ',T(I), ' Discharge= ',Q(I) 60 CONTINUE
READ (1,*) A
C A is the surface area of the reservoir READ (1,) K C K is the const. in O=KH^(3/2), the ouflow rate in spillway READ (1,*) H C H is the inicial head over the crest of spillway
CLOSE (1)
OPEN (2,FILE='Result.dat',STATUS='NEW')
C Help in manual plot of graph O*dt/2+S as a function of H
WRITE (*,*)
WRITE (*,'(A)') ' Manual plot graph O*dt/2+S function of H'
WRITE (*,*)
WRITE (*,*) ' Initial head over the spillway is = ', H
WRITE (*,*)
69 WRITE (,'(A)') ' Enter head over crest, H1 ' WRITE (,'(A)') ' (enter NEGATIVE number when complete) :' READ (,) H1
IF (H1.LT.0.0) THEN
GOTO 100
ENDIF
ST=A*H1+DT*K*H1**(3./2.)/2
WRITE (*,'(A)') ' Please plot the point: '
WRITE (*,*) 'H= ',H1, ' O*dt/2+S= ',ST
GOTO 69
100 WRITE (,'(A)') ' Is the graphic complete? (Y/N): ' READ (,'(A)') NO IF (NO.EQ. 'N') THEN GOTO 69 ENDIF
DO 37 I = 1,N-1
WRITE (*,*) ' Time increment No. : ', I
WRITE (*,*) ' Head at time: ', I, ' is equal to:'
READ (*,*) H
D= K*H**(3./2.)
S=A*H
DS=(Q(I)+Q(I+1))*DT/2-D*DT/2+S
WRITE (*,*) ' O*dt/2+S= ', DS
QT(I)=D
HD(I)=H
WRITE (*,*)
WRITE (*,'(A)') ' From graph det. H at end time increment.'
WRITE (*,'(A)') ' When ready press RETURN and enter H.'
READ (*,'(A)') AAA
IF (I.EQ.N-1) THEN
WRITE (*,'(A)') ' Head in the last increment is: '
READ (*,*) H
D= K*H**(3./2.)
QT(I)=D
HD(I)=H
ENDIF
37 CONTINUE
C Writing final results in the terminal and in output data file
WRITE (*,'(A)') ' Time Inflow Outflow Head '
WRITE (2,'(A)') ' Time Inflow Outflow Head '
DO 600 I=1,N
WRITE (*,50) T(I), Q(I), QT(I), HD(I)
WRITE (2,50) T(I), Q(I), QT(I), HD(I)
600 CONTINUE
50 FORMAT (I5,3F8.2) CLOSE (2) WRITE(*,'(A)') ' ******** END of program ROUTING.FOR ******** ' END