No such file or directory error

April 12, 2010 at 12:59:55
Specs: UNIX
Hi! I am trying to write a fortran program for a history match of some petroleum data. I have a comma delimited file named 4.txt that I would like to call to get the data from. However I get the "no such file or directory error". I have my file 4.txt in the same directory as the program I am running and the same linux shell directory I am running fortran in. Below is a copy of my code.

WRITE(*,598)
598 FORMAT(1X,'4.txt')
READ(*,599)DUMMYF
599 FORMAT(A6)
OPEN(5,FILE=DUMMYF,STATUS='OLD')

I am using fortran77. Any help in how to resolve this would be appreciated.


See More: No such file or directory error

Report •


#1
April 12, 2010 at 13:01:12
I can supply the rest of the code if needed...it was just kind of long.

Report •

#2
April 12, 2010 at 14:13:30
I haven't done fortran for ages, but aren't you writing the string
'4.txt' to standard output and then trying to read it back in from
standard input?

Report •

#3
April 12, 2010 at 14:16:42
Umm....I don't know. I don't really know fortran all that well. how would I change the code to make it work? I'll put up the rest of the code too so you can see what its doing.

CHARACTER*6 DUMMYF
REAL K1,K2,KRO(60),N,NGP(60),NOP(60),NP(60)
REAL BG(60),BO(60),BT(60),TOP(60),TGP(60),DT(60),DMB(100),R(60),RP(60),RS(60),QO(60)
REAL VG(60),VO(60),P(60),TOT(60),AO(10),A1(10),SGL(10),SGU(10)
REAL C0(10),C1(10),GASL(10),GASU(10)

DATA PI,DP,PHI,SW,ACRE/620.,5.,.215,.37,40./
DATA DOP,RW,RE,EPS,PW/1.E-4,.25,660.,1E-5,25.0/

WRITE(*,598)
598 FORMAT(1X,'4.txt')
READ(*,599)DUMMYF
599 FORMAT(A6)
OPEN(5,FILE=DUMMYF,STATUS='OLD')

READ(5,600)NKGKO
600 FORMAT(I5)
DO 4 I=1,NKGKO
! DO 4 I=1,4 ! manually
READ(5,605),SGL(I),SGU(I),AO(I),A1(I)
4 CONTINUE
605 FORMAT(5F10.0)

READ(5,600)NKRO
DO 41 I=1,NKRO
! DO 41 I=1,7 ! manually
READ(5,605),GASL(I),GASU(I),C0(I),C1(I)
41 CONTINUE
READ(5,605), H1,H2
READ(5,605), K1,K2
CLOSE(5)

OPEN(6,FILE='MATCH')

DO 10 I=1,60
P(I)=PI-DP*(I-1)
IF(P(I).LT.200.) GOTO 11
VO(I)=2.354-.001134*P(I)
VG(I)=.009684+.3267E-5*P(I)+.1116E-9*P(I)**2
RS(I)=52.45+.2475*P(I)-.2097E-4*P(I)**2
BO(I)=1.062+.9257E-4*P(I)
BG(I)=7.446+.3625*P(I)+.4532E-4*P(I)**2
BG(I)=1./BG(I)
GO TO 10
11 VO(I)=2.670-.004566*P(I)+.9461E-5*P(I)**2
VG(I)=.007580+.2497E-4*P(I)-.5622E-7*P(I)**2
RS(I)=16.99+.6565*P(I)-.001198*P(I)**2
BO(I)=1.033+.3829E-3*P(I)-.7262E-6*P(I)**2
BG(I)=8.874+.3676*P(I)
BG(I)=1./BG(I)
10 CONTINUE

NP(1)=0
R(1)=RS(1)
BT(1)=BO(1)
NOP(1)=0
NGP(1)=0
TOT(1)=0
DO 20 I=2,60
BT(I)=BO(I)+(RS(1)-RS(I))*BG(I)
TOP(1)=NOP(I-1)
DMB(1)=.01
TOP(2)=TOP(1)+DOP
DO 30 J=2,100
SG=(1-(1-TOP(J))*BO(I)/BO(1))*(1-SW)
IF(SG.LT.0.0)SG=0.0

DO 50 KK=1,NKGKO
IF(SG.GT.SGU(KK)) GOTO 50
A=AO(KK)
B=A1(KK)
GO TO 55
50 CONTINUE
55 CONTINUE

DO 42 KI=1,NKRO
IF(SG.GT.GASU(KI)) GO TO 42
AZ=C0(KI)
BZ=C1(KI)
GO TO 43
42 CONTINUE
43 CONTINUE
KRO(I)=AZ+BZ*SG
IF(KRO(I).LT.0.0) KRO(I)=0.0
IF(KRO(I).GT.1.0) KRO(I)=1.0
RKGKO=10.**(A+B*SG)
R(I)=RS(I)+VO(I)*BO(I)/VG(I)/BG(I)*RKGKO
RAV=(R(I-1)+R(I))/2.
DGP=DOP*RAV
TGP(J)=NGP(I-1)+DGP
RP(I)=TGP(J)/TOP(J)
DMB(J)=TOP(J)*(BT(I)+BG(I)*(RP(I)-RS(1)))/(BT(I)-BT(1))-1.
IF(ABS(DMB(J)).GT.EPS) GOTO 35
NOP(I)=TOP(J)
NGP(I)=TOP(J)*RP(I)
GOTO 20
35 DOP=TOP(J+1)-NOP(I-1)
30 CONTINUE
20 CONTINUE

WRITE(6,101)
WRITE(6,102)P(1),NOP(1),R(1)
DO 202 I=2,40,2
WRITE(6,102)P(I),NOP(I),R(I)
202 CONTINUE

HTOT=H1+H2
CAPAC=H1*K1+H2*K2
N=7758.*ACRE*HTOT*PHI*(1.-SW)/BO(1)
WRITE(6,501)
501 FORMAT('1',3X,' THE HISTORY MATCH FOR WELL1')
WRITE(6,502)
502 FORMAT(//,1X,' PRESSURE,PSIA ',2X,'OIL PROD.RATE, BPD',2X, 'INSTANT. GOR, SCF/STB',2X,'TOTAL TIME, YEARS')

DO 40 I=2,40
NP(I)=NOP(I)*N
QO(I)=.00708/BO(I)/VO(I)/(ALOG(RE/RW)-.75)*(P(I)-PW)*KRO(I)*CAPAC
DT(I)=(NP(I)-NP(I-1))/QO(I)/365.
TOT(I)=TOT(I-1)+DT(I)
!IF(MOD(I,2).EQ.O)THEN

WRITE(6,503) P(I),QO(I),R(I),TOT(I)
503 FORMAT(1X,F18.6,2X,F18.6,2X,F20.6,2X,F16.6)
!ENDIF
40 CONTINUE
101 FORMAT('1',5X,'PRESSURE',10X,'NP/N',10X,'INTSTANT.GOR')
102 FORMAT(8X,F5.0,10X,F7.6,12X,F6.0)
CLOSE(6)
STOP
END


Report •

Related Solutions

#4
April 12, 2010 at 17:13:47
I really don't remember Fortran, it was so long ago, but can't you
just do DUMMYF='4.txt' instead of write&read?

Report •

#5
April 13, 2010 at 00:33:31
me neither (25 years, one course... you get the idea)
but i would just eliminate everything except the file access and create a program to open the file for read-access, then see what happens.
f/e, based on channel 6 syntax:
OPEN(5,FILE='4.txt')
if it opens, read and echo data. i think it's something to do with all that gummy-stuff at the start.

Report •

Ask Question