home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
oilfield
/
spe-46-2.lzh
/
BLOCK6.FOR
< prev
next >
Wrap
Text File
|
1988-07-14
|
40KB
|
1,090 lines
$DO66
C.................................................................TABLE
SUBROUTINE TABLE(IOCODE,II,JJ,KK)
C MACHINE DEPENDENT INCLUDE STATEMENT
$INCLUDE:'PARAMS.FOR'
C READ ROCK AND PVT DATA
REAL KROT,KROGT,KRWT,KRGT,MUOT,MUWT,MUGT,KX,KY,KZ
COMMON /BUBBLE/ PBO,VSLOPE(LP8),BSLOPE(LP8),RSLOPE(LP8),PMAXT,
& IREPRS,MPGT(LP8),
& RHOSCO(LP8),RHOSCW(LP8),RHOSCG(LP8),MSAT(LP7),MPOT(LP8),
& MPWT(LP8),PBOT(LP1,LP2,LP3),PBOTN(LP1,LP2,LP3)
COMMON /SPARM/ KX(LP1,LP2,LP3),KY(LP1,LP2,LP3),KZ(LP1,LP2,LP3),
& EL(LP1,LP2,LP3),TX(LP4,LP2,LP3),TY(LP1,LP5,LP3),TZ(LP1,LP2,LP6),
& PDAT(LP1,LP2,LP3),PDATUM,GRAD
COMMON /SPVT/ SAT(LP7,LP9),KROT(LP7,LP9),KRWT(LP7,LP9),
& BGT(LP7,LP9),
& KRGT(LP7,LP9),ITHREE(LP7),RSOT(LP7,LP9),BWPT(LP7,LP9),
& PCOWT(LP7,LP9),PCGOT(LP7,LP9),KROGT(LP7,LP9),SWR(LP7),
& POT(LP7,LP9),MUOT(LP7,LP9),BOT(LP7,LP9),BOPT(LP7,LP9),
& RSOPT(LP7,LP9),PWT(LP7,LP9),MUWT(LP7,LP9),BWT(LP7,LP9),
& RSWT(LP7,LP9),RSWPT(LP7,LP9),PGT(LP7,LP9),MUGT(LP7,LP9),
& BGPT(LP7,LP9),CRT(LP7,LP9),IPVT(LP1,LP2,LP3),IROCK(LP1,LP2,LP3),
& NROCK,NPVT,PSIT(LP7,LP9),PRT(LP7,LP9),WOROCK(LP7),GOROCK(LP7)
COMMON /TSTDAT/ IFATAL,IWARN
WRITE(IOCODE,111)
READ(20,1)
READ(20,*) NROCK,NPVT
WRITE(IOCODE,1050) NROCK,NPVT
1050 FORMAT(//,T15,'*** NUMBER OF REGIONS ***',/,
& T20,'ROCK',T30,I5,/,
& T20,'PVT',T30,I5,//)
IF(NROCK.LE.1) GO TO 2000
READ(20,1)
READ(20,*) NUMROK
IF(NUMROK.EQ.0) GO TO 1500
WRITE(IOCODE,1100)
DO 1200 L=1,NUMROK
READ(20,*) I1,I2,J1,J2,K1,K2,IVAL
WRITE(IOCODE,1150) I1,I2,J1,J2,K1,K2,IVAL
DO 1200 K=K1,K2
DO 1200 J=J1,J2
DO 1200 I=I1,I2
IROCK(I,J,K)=IVAL
1200 CONTINUE
1500 WRITE(IOCODE,1600)
DO 1700 K=1,KK
WRITE(IOCODE,1650) K
DO 1700 J=1,JJ
IF(NUMROK.EQ.0) READ(20,*) (IROCK(I,J,K),I=1,II)
WRITE(IOCODE,1675) (IROCK(I,J,K),I=1,II)
1700 CONTINUE
2000 CONTINUE
IF(NPVT.LE.1) GO TO 3000
READ(20,1)
READ(20,*) NUMPVT
IF(NUMPVT.EQ.0) GO TO 2500
WRITE(IOCODE,2100)
DO 2200 L=1,NUMPVT
READ(20,*) I1,I2,J1,J2,K1,K2,IVAL
WRITE(IOCODE,1150) I1,I2,J1,J2,K1,K2,IVAL
DO 2200 K=K1,K2
DO 2200 J=J1,J2
DO 2200 I=I1,I2
IPVT(I,J,K)=IVAL
2200 CONTINUE
2500 WRITE(IOCODE,2600)
DO 2700 K=1,KK
WRITE(IOCODE,1650) K
DO 2700 J=1,JJ
IF(NUMPVT.EQ.0) READ(20,*) (IPVT(I,J,K),I=1,II)
WRITE(IOCODE,1675) (IPVT(I,J,K),I=1,II)
2700 CONTINUE
3000 CONTINUE
1100 FORMAT(//T15,'***** ROCK REGION MODIFICATIONS *****',
& //T15,' I1 I2 J1 J2 K1 K2 IROCK')
1150 FORMAT(15X,6I4,3X,I3)
1600 FORMAT(//T15,'***** ROCK REGION DISTRIBUTION *****',/)
1650 FORMAT(/1X,'K =',I4/)
1675 FORMAT(1X,20I6)
2100 FORMAT(//T15,'***** PVT REGION MODIFICATIONS *****',
& //T15,' I1 I2 J1 J2 K1 K2 IPVT')
2600 FORMAT(//T15,'***** PVT REGION DISTRIBUTION *****',/)
C**** RELATIVE PERMEABILITY & CAPILLARY PRESSURE TABLE
DO 10 NR=1,NROCK
READ(20,1)
WRITE(IOCODE,7) NR
DO 5 I=1, 25
READ(20,*) SAT(NR,I),KROT(NR,I),KRWT(NR,I),KRGT(NR,I),
& KROGT(NR,I),PCOWT(NR,I),PCGOT(NR,I)
WRITE(IOCODE,21)SAT(NR,I),KROT(NR,I),KRWT(NR,I),KRGT(NR,I),
& KROGT(NR,I),PCOWT(NR,I),PCGOT(NR,I)
IF(SAT(NR,I).GE.1.0001)GO TO 9
5 CONTINUE
9 MSAT(NR)=I
READ(20,1)
READ(20,*) ITHREE(NR),SWR(NR)
IF(ITHREE(NR).EQ.0) WRITE(IOCODE,92) SWR(NR)
IF(ITHREE(NR).GT.0) WRITE(IOCODE,94) SWR(NR)
92 FORMAT(//,10X,'THE THREE-PHASE REL. PERM. CALC. IS NOT USED.',
& /,10X,'IRREDUCIBLE WATER SATURATION IS ',F6.4)
94 FORMAT(//,10X,'THE THREE-PHASE REL. PERM. CALC. IS USED.',
& /,10X,'IRREDUCIBLE WATER SATURATION IS ',F6.4)
10 CONTINUE
C SAT DEPENDENT DATA CHECK
DO 4200 NR=1,NROCK
DO 4200 I=1,MSAT(NR)
IF(SAT(NR,I).GE.-0.1.AND.SAT(NR,I).LE.1.1) GO TO 4020
IFATAL=IFATAL+1
WRITE(IOCODE,4010) NR,I
4010 FORMAT(/5X,5('-'),'SAT ERROR FOR ROCK REGION',I5,
& ' AND ENTRY # ',I5)
4020 IF(KROT(NR,I).GE.0.0.AND.KROT(NR,I).LE.1.0) GO TO 4040
IFATAL=IFATAL+1
WRITE(IOCODE,4030) NR,I
4030 FORMAT(/5X,5('-'),'KROW ERROR FOR ROCK REGION',I5,
& ' AND ENTRY # ',I5)
4040 IF(KRWT(NR,I).GE.0.0.AND.KRWT(NR,I).LE.1.0) GO TO 4060
IFATAL=IFATAL+1
WRITE(IOCODE,4050) NR,I
4050 FORMAT(/5X,5('-'),'KRW ERROR FOR ROCK REGION',I5,
& ' AND ENTRY # ',I5)
4060 IF(KRGT(NR,I).GE.0.0.AND.KRGT(NR,I).LE.1.0) GO TO 4080
IFATAL=IFATAL+1
WRITE(IOCODE,4070) NR,I
4070 FORMAT(/5X,5('-'),'KRG ERROR FOR ROCK REGION',I5,
& ' AND ENTRY # ',I5)
4080 IF(KROGT(NR,I).GE.0.0.AND.KROGT(NR,I).LE.1.0) GO TO 4100
IFATAL=IFATAL+1
WRITE(IOCODE,4090) NR,I
4090 FORMAT(/5X,5('-'),'KROG ERROR FOR ROCK REGION',I5,
& ' AND ENTRY # ',I5)
4100 IF(PCOWT(NR,I).GE.0.0) GO TO 4120
IFATAL=IFATAL+1
WRITE(IOCODE,4110) NR,I
4110 FORMAT(/5X,5('-'),'PCOW ERROR FOR ROCK REGION',I5,
& ' AND ENTRY # ',I5)
4120 IF(PCGOT(NR,I).GE.0.0) GO TO 4200
IFATAL=IFATAL+1
WRITE(IOCODE,4130) NR,I
4130 FORMAT(/5X,5('-'),'PCGO ERROR FOR ROCK REGION',I5,
& ' AND ENTRY # ',I5)
4200 CONTINUE
DO 4300 NR=1,NROCK
IF(SAT(NR,1).LT.0.0) GO TO 4220
IFATAL=IFATAL+1
WRITE(IOCODE,4210) NR
4210 FORMAT(/5X,5('-'),'FIRST SAT ENTRY FOR ROCK REGION',
& I5,' SHOULD EQUAL -0.10.',/10X,
& 'ADJUST REL PERM AND CAP PRESS CURVES ALSO.',/)
4220 IF(SAT(NR,MSAT(NR)).GE.1.05) GO TO 4240
IFATAL=IFATAL+1
WRITE(IOCODE,4230) NR
4230 FORMAT(/5X,5('-'),'LAST SAT ENTRY FOR ROCK REGION',
& I5,' SHOULD EQUAL 1.10.',/10X,
& 'ADJUST REL PERM AND CAP PRESS CURVES ALSO.',/)
C CHECK 3-PHASE SWR DATA
4240 IF(SWR(NR).GE.0.0.AND.SWR(NR).LE.1.0) GO TO 4300
IFATAL=IFATAL+1
WRITE(IOCODE,4250) NR
4250 FORMAT(/5X,5('-'),'3-PHASE SWR ERROR FOR ROCK REGION',I5)
4300 CONTINUE
C**** BUBBLE POINT & MAXIMUM PRESSURES
DO 400 NP=1,NPVT
C INITIALIZE BUBBLE POINT PRESSURE ARRAY.
READ(20,1)
READ(20,*) PBO,PBODAT,PBGRAD
WRITE(IOCODE,3100) NP,PBO,PBODAT,PBGRAD
3100 FORMAT(1H1/T15,'PVT REGION # ',I5,//,
& //T10,'BUBBLE POINT PARAMETERS:',
& /,T5,'BUBBLE POINT PRESSURE (PSI)',T35,F10.3,
& /,T5,'BUBBLE POINT DEPTH (FT)',T35,F10.3,
& /,T5,'BUBBLE POINT GRADIENT (PSI/FT)',T35,F10.3)
DO 3500 K=1,KK
DO 3500 J=1,JJ
DO 3500 I=1,II
IF(IPVT(I,J,K).NE.NP) GO TO 3500
PBOT(I,J,K)=PBO+(PBODAT-EL(I,J,K))*PBGRAD
PBOTN(I,J,K)=PBOT(I,J,K)
C CHECK BUBBLE POINT PRESSURE DATA
IF(PBOT(I,J,K).GE.0.0) GO TO 3500
IFATAL=IFATAL+1
WRITE(IOCODE,3300) I,J,K
3300 FORMAT(/5X,5('-'),'BUBBLE POINT PRESSURE ERROR IN',
& ' GRID BLOCK IJK = ',3I5)
3500 CONTINUE
C**** OIL DATA TABLE
READ(20,1)
WRITE(IOCODE,8)
READ(20,*) VSLOPE(NP),BSLOPE(NP),RSLOPE(NP),PMAXT,IREPRS
WRITE(IOCODE,31)VSLOPE(NP),BSLOPE(NP),RSLOPE(NP),PMAXT,IREPRS
C CHECK UNDERSATURATED SLOPES
IF(VSLOPE(NP).GE.0.0) GO TO 3520
IWARN=IWARN+1
WRITE(IOCODE,3510) NP
3510 FORMAT(/5X,5('-'),'VSLOPE FOR PVT REGION',I5,
& ' IS NEGATIVE')
3520 IF(BSLOPE(NP).LE.0.0) GO TO 3540
IWARN=IWARN+1
WRITE(IOCODE,3530) NP
3530 FORMAT(/5X,5('-'),'BSLOPE FOR PVT REGION',I5,
& ' IS POSITIVE')
3540 IF(RSLOPE(NP).EQ.0.0) GO TO 3560
IWARN=IWARN+1
WRITE(IOCODE,3550) NP
3550 FORMAT(/5X,5('-'),'RSLOPE FOR PVT REGION',I5,
& 'IS NOT ZERO')
3560 CONTINUE
READ(20,1)
WRITE(IOCODE,12)
DO 15 I=1, 25
READ(20,*) POT(NP,I),MUOT(NP,I),BOT(NP,I),RSOT(NP,I)
WRITE(IOCODE,23)POT(NP,I),MUOT(NP,I),BOT(NP,I),RSOT(NP,I)
RSOT(NP,I)=0.17809*RSOT(NP,I)
IF(POT(NP,I).GE.PMAXT)GO TO 20
15 CONTINUE
20 MPOT(NP)=I
C POT DEPENDENT DATA CHECK
DO 5200 I=1,MPOT(NP)
IF(I.GT.1) GO TO 5105
IF(POT(NP,1).GE.0.0.AND.POT(NP,1).LE.PMAXT) GO TO 5120
IFATAL=IFATAL+1
WRITE(IOCODE,5110) NP,I
GO TO 5120
5105 IF(POT(NP,I).GE.POT(NP,I-1).AND.POT(NP,I).LE.PMAXT) GO TO 5120
IFATAL=IFATAL+1
WRITE(IOCODE,5110) NP,I
5110 FORMAT(/5X,5('-'),'POT ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5120 IF(MUOT(NP,I).GE.0.0) GO TO 5151
IFATAL=IFATAL+1
WRITE(IOCODE,5130) NP,I
5130 FORMAT(/5X,5('-'),'MUO ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5151 IF(BOT(NP,I).GE.0.0) GO TO 5160
IFATAL=IFATAL+1
WRITE(IOCODE,5150) NP,I
5150 FORMAT(/5X,5('-'),'BO ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5160 IF(RSOT(NP,I).GE.0.0) GO TO 5200
IFATAL=IFATAL+1
WRITE(IOCODE,5170) NP,I
5170 FORMAT(/5X,5('-'),'RSO ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5200 CONTINUE
C**** WATER DATA TABLE
READ(20,1)
WRITE(IOCODE,13)
DO 25 I=1, 25
READ(20,*) PWT(NP,I),MUWT(NP,I),BWT(NP,I),RSWT(NP,I)
WRITE(IOCODE,23)PWT(NP,I),MUWT(NP,I),BWT(NP,I),RSWT(NP,I)
RSWT(NP,I)=0.17809*RSWT(NP,I)
IF(PWT(NP,I).GE.PMAXT)GO TO 30
25 CONTINUE
30 MPWT(NP)=I
C PWT DEPENDENT DATA CHECK
DO 5400 I=1,MPWT(NP)
IF(I.GT.1) GO TO 5305
IF(PWT(NP,1).GE.0.0.AND.PWT(NP,1).LE.PMAXT) GO TO 5320
IFATAL=IFATAL+1
WRITE(IOCODE,5310) NP,I
GO TO 5320
5305 IF(PWT(NP,I).GE.PWT(NP,I-1).AND.PWT(NP,I).LE.PMAXT) GO TO 5320
IFATAL=IFATAL+1
WRITE(IOCODE,5310) NP,I
5310 FORMAT(/5X,5('-'),'PWT ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5320 IF(MUWT(NP,I).GE.0.0) GO TO 5353
IFATAL=IFATAL+1
WRITE(IOCODE,5330) NP,I
5330 FORMAT(/5X,5('-'),'MUW ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5353 IF(BWT(NP,I).GE.0.0) GO TO 5360
IFATAL=IFATAL+1
WRITE(IOCODE,5350) NP,I
5350 FORMAT(/5X,5('-'),'BW ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5360 IF(RSWT(NP,I).GE.0.0) GO TO 5400
IFATAL=IFATAL+1
WRITE(IOCODE,5370) NP,I
5370 FORMAT(/5X,5('-'),'RSW ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5400 CONTINUE
C**** GAS & ROCK DATA TABLE
READ(20,1)
READ(20,*) KGCOR
READ(20,1)
IF(KGCOR.EQ.1) GO TO 50
WRITE(IOCODE,14)
DO 35 I=1,999
READ(20,*) PGT(NP,I),MUGT(NP,I),BGT(NP,I),PSIT(NP,I),CRT(NP,I)
WRITE(IOCODE,24)PGT(NP,I),MUGT(NP,I),BGT(NP,I),PSIT(NP,I),
& CRT(NP,I)
PRT(NP,I)=PGT(NP,I)
IF(PGT(NP,I).GE.PMAXT)GO TO 40
35 CONTINUE
40 MPGT(NP)=I
GO TO 99
50 CONTINUE
NPHASE=NP
CALL PSEUDO(NPHASE,IFATAL,IOCODE)
WRITE(IOCODE,51)
51 FORMAT(//,T6,2X,'**** ROCK COMPRESSIBILITY ****',
& /T5,1X,'PRESSURE',4X,'ROCK COMP.',
& /T5,2X,'(PSI)',6X,'(1/PSI)',/)
READ(20,1)
DO 55 IG=1,MPGT(NP)
IF(IG.GT.1.AND.PRT(NP,1).EQ.PMAXT) GO TO 53
READ(20,*) PRT(NP,IG),CRT(NP,IG)
WRITE(IOCODE,52) PRT(NP,IG),CRT(NP,IG)
52 FORMAT(3X,F10.1,2X,E10.3)
GO TO 55
53 CONTINUE
PRT(NP,IG)=PGT(NP,IG)
CRT(NP,IG)=CRT(NP,1)
IF(IG.EQ.MPGT(NP)) PRT(NP,1)=PGT(NP,1)
55 CONTINUE
99 CONTINUE
C PGT DEPENDENT DATA CHECK
DO 5600 I=1,MPGT(NP)
IF(I.GT.1) GO TO 5505
IF(PGT(NP,1).GE.0.0.AND.PGT(NP,1).LE.PMAXT) GO TO 5520
IFATAL=IFATAL+1
WRITE(IOCODE,5510) NP,I
GO TO 5520
5505 IF(PGT(NP,I).GE.PGT(NP,I-1).AND.
& (PGT(NP,I)-PMAXT).LE.0.1) GO TO 5520
IFATAL=IFATAL+1
WRITE(IOCODE,5510) NP,I
5510 FORMAT(/5X,5('-'),'PGT ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5520 IF(MUGT(NP,I).GE.0.0) GO TO 5555
IFATAL=IFATAL+1
WRITE(IOCODE,5530) NP,I
5530 FORMAT(/5X,5('-'),'MUG ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5555 IF(BGT(NP,I).GE.0.0) GO TO 5560
IFATAL=IFATAL+1
WRITE(IOCODE,5550) NP,I
5550 FORMAT(/5X,5('-'),'BG ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5560 IF(CRT(NP,I).GE.0.0) GO TO 5580
IFATAL=IFATAL+1
WRITE(IOCODE,5570) NP,I
5570 FORMAT(/5X,5('-'),'CR ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5580 IF(PRT(NP,I).GE.0.0.AND.(PRT(NP,I)-PMAXT).LE.0.1) GO TO 5590
IFATAL=IFATAL+1
WRITE(IOCODE,5585) NP,I
5585 FORMAT(/5X,5('-'),'ROCK PRES ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5590 IF(PSIT(NP,I).GE.0.0) GO TO 5596
IFATAL=IFATAL+1
WRITE(IOCODE,5595) NP,I
5595 FORMAT(/5X,5('-'),'PSEUDO-PRES ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5596 IF(I.EQ.1) GO TO 5600
IF(PRT(NP,I).GE.PRT(NP,I-1).AND.(PRT(NP,I)-PMAXT).LE.0.1)
& GO TO 5600
IFATAL=IFATAL+1
WRITE(IOCODE,5585) NP,I
5600 CONTINUE
C**** OIL, WATER, & GAS DENSITIES AT STOCK TANK CONDITIONS
READ(20,1)
WRITE(IOCODE,6)
READ(20,*)RHOSCO(NP),RHOSCW(NP),RHOSCG(NP)
WRITE(IOCODE,4)RHOSCO(NP),RHOSCW(NP),RHOSCG(NP)
C CHECK DENSITY DATA
IF(RHOSCO(NP).GT.0.0) GO TO 5720
IFATAL=IFATAL+1
WRITE(IOCODE,5710) NP
5710 FORMAT(/5X,5('-'),'OIL DENSITY FOR PVT REGION',I5,
& ' IN ERROR')
5720 IF(RHOSCW(NP).GT.0.0) GO TO 5740
IFATAL=IFATAL+1
WRITE(IOCODE,5730) NP
5730 FORMAT(/5X,5('-'),'WATER DENSITY FOR PVT REGION',I5,
& ' IN ERROR')
5740 IF(RHOSCG(NP).GT.0.0) GO TO 5760
IFATAL=IFATAL+1
WRITE(IOCODE,5750) NP
5750 FORMAT(/5X,5('-'),'GAS DENSITY FOR PVT REGION',I5,
& ' IN ERROR')
5760 CONTINUE
C**** CALCULATE SLOPES DBO/DP, DRSO/DP, DBW/DP, DRSW/DP, DBG/DP
C**** NOTE: SLOPE AT POINT "I" IS BASED ON POINTS "I" AND "I-1"
WRITE(IOCODE,222)
WRITE(IOCODE,223)
DO 100 I=2,MPOT(NP)
DIV=1.0/(POT(NP,I)-POT(NP,I-1))
BOPT(NP,I)=(BOT(NP,I)-BOT(NP,I-1))*DIV
RSOPT(NP,I)=(RSOT(NP,I)-RSOT(NP,I-1))*DIV
100 WRITE(IOCODE,224)POT(NP,I),BOT(NP,I),BOPT(NP,I),RSOT(NP,I)
& ,RSOPT(NP,I)
WRITE(IOCODE,333)
DO 200 I=2,MPWT(NP)
DIV=1.0/(PWT(NP,I)-PWT(NP,I-1))
BWPT(NP,I)=(BWT(NP,I)-BWT(NP,I-1))*DIV
RSWPT(NP,I)=(RSWT(NP,I)-RSWT(NP,I-1))*DIV
200 WRITE(IOCODE,224)PWT(NP,I),BWT(NP,I),BWPT(NP,I),RSWT(NP,I)
& ,RSWPT(NP,I)
WRITE(IOCODE,444)
DO 300 I=2,MPGT(NP)
BGPT(NP,I)=(BGT(NP,I)-BGT(NP,I-1))/(PGT(NP,I)-PGT(NP,I-1))
300 WRITE(IOCODE,445)PGT(NP,I),BGT(NP,I),BGPT(NP,I)
C CHECK FLUID COMPRESSIBILITIES
DO 5820 I=2,MPOT(NP)
PP=POT(NP,I)
IPVTR=NP
CALL INTERP(IPVTR,PGT,BGT,MPGT(IPVTR),PP,BBG)
CALL INTCOM(IPVTR,POT,BOPT,MPOT(IPVTR),PP,BODER)
CALL INTCOM(IPVTR,POT,RSOPT,MPOT(IPVTR),PP,RSODER)
COTST=-(BODER-BBG*RSODER)
IF(COTST.GE.0.0) GO TO 5820
IFATAL=IFATAL+1
WRITE(IOCODE,5810) NP,I
5810 FORMAT(/5X,5('-'),'OIL COMP ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5820 CONTINUE
DO 5840 I=2,MPWT(NP)
PP=PWT(NP,I)
IPVTR=NP
CALL INTERP(IPVTR,PGT,BGT,MPGT(IPVTR),PP,BBG)
CALL INTCOM(IPVTR,PWT,BWPT,MPWT(IPVTR),PP,BWDER)
CALL INTCOM(IPVTR,PWT,RSWPT,MPWT(IPVTR),PP,RSWDER)
CWTST=-(BWDER-BBG*RSWDER)
IF(CWTST.GE.0.0) GO TO 5840
IFATAL=IFATAL+1
WRITE(IOCODE,5830) NP,I
5830 FORMAT(/5X,5('-'),'WATER COMP ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5840 CONTINUE
DO 5900 I=2,MPGT(NP)
PP=PGT(NP,I)
IPVTR=NP
CALL INTCOM(IPVTR,PGT,BGPT,MPGT(IPVTR),PP,BGDER)
CGTST=-BGDER
IF(CGTST.GE.0.0) GO TO 5900
IFATAL=IFATAL+1
WRITE(IOCODE,5850) NP,I
5850 FORMAT(/5X,5('-'),'GAS COMP ERROR FOR PVT REGION',I5,
& ' AND ENTRY # ',I5)
5900 CONTINUE
400 CONTINUE
1 FORMAT(40A2)
4 FORMAT(9X,8F10.4)
6 FORMAT(//,T8,'*** DENSITIES AT STD. CONDITIONS ***',/,
& 14X,'OIL',6X,'WATER',6X,'GAS',/,
& 10X,3(1X,'(LBM/SCF)'),/)
7 FORMAT(1H1/T15,'ROCK REGION # ',I5,//,
& 2X,'SATURATION',4X,'KROT',6X,'KRW',7X,'KRG',
& 8X,'KROG',5X,'PCOW',6X,'PCGO',/,
& T57,'(PSI)',T67,'(PSI)',/)
8 FORMAT(//,3X,'VSLOPE',5X,'BSLOPE',7X,'RSLOPE',
& 5X,'PMAX',2X,'REPRS',/,
& 2X,'(CP/PSI)',1X,'(RB/STB/PSI)',4X,
& '(1/PSI)',3X,'(PSI)',/)
21 FORMAT(1X,7F10.4)
23 FORMAT(3X,F10.1,1X,F8.4,2X,F8.4,2X,F8.2)
24 FORMAT(3X,F10.1,1X,F8.4,2X,E10.4,2X,E10.4,2X,E10.3)
12 FORMAT(//,T5,1X,'**** SATURATED OIL PVT PROPERTIES ****',
& /,T5,1X,'PRESSURE',2X,'VISCOSITY',4X,'FVF',4X,'SOLN. GAS',
& /,T5,2X,'(PSI)',7X,'(CP)',4X,'(RB/STB)',2X,'(SCF/STB)',/)
13 FORMAT(//,T5,5X,'**** WATER PVT PROPERTIES ***',
& /,T5,1X,'PRESSURE',2X,'VISCOSITY',4X,'FVF',4X,'SOLN. GAS',
& /,T5,2X,'(PSI)',7X,'(CP)',4X,'(RB/STB)',2X,'(SCF/STB)',/)
14 FORMAT(//,T6,2X,'**** GAS PVT AND ROCK COMP. ****',
& /,T5,1X,'PRESSURE',2X,'VISCOSITY',4X,'FVF',5X,'PSEUDO-PRS',
& 2X,'ROCK COMP.',
& /,T5,2X,'(PSI)',7X,'(CP)',3X,'(RCF/SCF)',' (PSIA**2/CP)',
& 2X,'(1/PSI)',/)
111 FORMAT(1H1/T15,'***** EMPIRICAL DATA TABLES *****')
31 FORMAT(1X,E10.3,1X,E10.3,1X,2F10.2,1X,I5)
222 FORMAT(//T15,'***** SLOPES FOR COMPRESSIBILITY CALCULATIONS',
&' ****')
223 FORMAT(//T12,'PRESSURE',T25,'BO',T34,'DBO/DP',T47,'RSO',
& T55,'DRSO/DP'/,
& T13,'(PSI)',T22,'(RB/STB)',T31,'(RB/STB/PSI)',T45,
& '(CF/CF)',T55,'(1/PSI)',/)
445 FORMAT(10X,F9.1,1X,2E15.4)
333 FORMAT(//T12,'PRESSURE',T25,'BW',T34,'DBW/DP',T47,'RSW',
& T55,'DRSW/DP'/,
& T13,'(PSI)',T22,'(RB/STB)',T31,'(RB/STB/PSI)',T45,
& '(CF/CF)',T55,'(1/PSI)',/)
224 FORMAT( T12,F7.1,F10.4,2X,E11.4,F9.1,2X,E11.4)
444 FORMAT(//12X,'PRESSURE',9X,'BG',12X,'DBG/DP',/,
& T14,'(PSI)',T27,'(RCF/SCF)',T40,'(RCF/SCF/PSI)',/)
RETURN
END
C........................................................................TRANS
SUBROUTINE TRANS(II,JJ,KK)
C MACHINE DEPENDENT INCLUDE STATEMENT
$INCLUDE:'PARAMS.FOR'
C TRANSMISSIBILITY CALC
REAL KX,KY,KZ
COMMON /TSTDAT/ IFATAL,IWARN
COMMON /SARRAY/ PN(LP1,LP2,LP3),IOCODE,IDMAX,
& SON(LP1,LP2,LP3),SWN(LP1,LP2,LP3),SGN(LP1,LP2,LP3),
& A1(LP1,LP2,LP3),A2(LP1,LP2,LP3),A3(LP1,LP2,LP3),
& SUM(LP1,LP2,LP3),GAM(LP1,LP2,LP3),QS(LP1,LP2,LP3)
COMMON /SPARM/ KX(LP1,LP2,LP3),KY(LP1,LP2,LP3),KZ(LP1,LP2,LP3),
& EL(LP1,LP2,LP3),TX(LP4,LP2,LP3),TY(LP1,LP5,LP3),TZ(LP1,LP2,LP6),
& PDAT(LP1,LP2,LP3),PDATUM,GRAD
COMMON /SSOLN/ BO(LP1,LP2,LP3),BW(LP1,LP2,LP3),BG(LP1,LP2,LP3),
& QO(LP1,LP2,LP3),QW(LP1,LP2,LP3),QG(LP1,LP2,LP3),
& GOWT(LP1,LP2,LP3),GWWT(LP1,LP2,LP3),GGWT(LP1,LP2,LP3),
& OW(LP4,LP2,LP3),OE(LP4,LP2,LP3),WW(LP4,LP2,LP3),WE(LP4,LP2,LP3),
& OS(LP1,LP5,LP3),ON(LP1,LP5,LP3),WS(LP1,LP5,LP3),WN(LP1,LP5,LP3),
& OT(LP1,LP2,LP6),OB(LP1,LP2,LP6),WT(LP1,LP2,LP6),WB(LP1,LP2,LP6),
& QOWG(LP1,LP2,LP3),VP(LP1,LP2,LP3),CT(LP1,LP2,LP3)
COMMON /VECTOR/ DX(LP1,LP2,LP3),DY(LP1,LP2,LP3),DZ(LP1,LP2,LP3),
& DZNET(LP1,LP2,LP3),IQN1(LP11),IQN2(LP11),IQN3(LP11),IHEDIN(80)
DO 30 K=1,KK
DO 30 J=1,JJ
DO 30 I=1,II
FACX=1.0
FACY=1.0
FACZ=1.0
IF(I.EQ.1.OR.I.EQ.II) GO TO 20
XDENOM=2.*DX(I,J,K)+DX(I+1,J,K)+DX(I-1,J,K)
IF(XDENOM.GT.0.0) FACX=4.*DX(I,J,K)/XDENOM
20 IF(J.EQ.1.OR.J.EQ.JJ) GO TO 24
YDENOM=2.*DY(I,J,K)+DY(I,J+1,K)+DY(I,J-1,K)
IF(YDENOM.GT.0.0) FACY=4.*DY(I,J,K)/YDENOM
24 IF(K.EQ.1.OR.K.EQ.KK) GO TO 28
ZDENOM=2.*DZNET(I,J,K)+DZNET(I,J,K+1)+DZNET(I,J,K-1)
IF(ZDENOM.GT.0.0) FACZ=4.*DZNET(I,J,K)/ZDENOM
28 CONTINUE
A1(I,J,K)=FACX*KX(I,J,K)*DY(I,J,K)*DZNET(I,J,K)
A2(I,J,K)=FACY*KY(I,J,K)*DX(I,J,K)*DZNET(I,J,K)
A3(I,J,K)=FACZ*KZ(I,J,K)*DX(I,J,K)*DY(I,J,K)
30 CONTINUE
IF(II.EQ.1)GO TO 501
DO 50 K=1,KK
DO 50 J=1,JJ
DO 50 I=2,II
XDENOM=DX(I-1,J,K)*A1(I,J,K)+DX(I,J,K)*A1(I-1,J,K)
IF(XDENOM.EQ.0.0) GO TO 50
TX(I,J,K)=.012656*A1(I-1,J,K)*A1(I,J,K)/XDENOM
50 CONTINUE
501 CONTINUE
IF(JJ.EQ.1)GO TO 551
DO 55 K=1,KK
DO 55 J=2,JJ
DO 55 I=1,II
YDENOM=DY(I,J-1,K)*A2(I,J,K)+DY(I,J,K)*A2(I,J-1,K)
IF(YDENOM.EQ.0.0) GO TO 55
TY(I,J,K)=.012656*A2(I,J-1,K)*A2(I,J,K)/YDENOM
55 CONTINUE
551 CONTINUE
IF(KK.EQ.1)GO TO 601
DO 60 K=2,KK
DO 60 J=1,JJ
DO 60 I=1,II
ZDENOM=DZNET(I,J,K-1)*A3(I,J,K)+DZNET(I,J,K)*A3(I,J,K-1)
IF(ZDENOM.EQ.0.0) GO TO 60
TZ(I,J,K)=.012656*A3(I,J,K-1)*A3(I,J,K)/ZDENOM
60 CONTINUE
601 CONTINUE
C** COMPUTE BLOCK PV
DO 62 K=1,KK
DO 62 J=1,JJ
DO 62 I=1,II
VP(I,J,K)=VP(I,J,K)*DX(I,J,K)*DY(I,J,K)*DZNET(I,J,K)
62 CONTINUE
C** DEFINE 0 TRANS. FOR ALL BOUNDARIES OF 0 PV BLOCK.
DO 68 K=1,KK
DO 68 J=1,JJ
DO 68 I=1,II
IF(VP(I,J,K).GT.0.) GO TO 68
TX(I,J,K)=0.
TX(I+1,J,K)=0.
TY(I,J,K)=0.
TY(I,J+1,K)=0.
TZ(I,J,K)=0.
TZ(I,J,K+1)=0.
68 CONTINUE
C****** TRANSMISSIBILITY MODIFICATIONS
READ(20,69)
69 FORMAT(40A2)
READ(20,*) NUMTX,NUMTY,NUMTZ,ITCODE
IF(NUMTX.EQ.0) GO TO 100
WRITE(IOCODE,31)
31 FORMAT(//T15,'**********TRANSMISSIBILITY (TX) NODE MODIFICATIONS',
& '**********',//T15,
& ' I1 I2 J1 J2 K1 K2 NEW TX VALUE')
DO 275 L=1,NUMTX
READ(20,*) I1,I2,J1,J2,K1,K2,REGVAL
WRITE(IOCODE,32) I1,I2,J1,J2,K1,K2,REGVAL
DO 275 K=K1,K2
DO 275 J=J1,J2
DO 275 I=I1,I2
IF(VP(I,J,K).GT.0.) TX(I,J,K)=REGVAL
275 CONTINUE
32 FORMAT(15X,6I4,2X,E10.4)
100 IF(ITCODE.NE.1)GO TO 8531
WRITE(IOCODE,44)
44 FORMAT(//T15,'**********TRANSMISSIBILITY (TX) DISTRIBUTION'
& ,'**********'/)
DO 853 K=1,KK
WRITE(IOCODE,38)K
38 FORMAT(/1X,'K =',I2/)
DO 854 J=1,JJ
854 WRITE(IOCODE,72)(TX(I,J,K),I=1,II)
72 FORMAT(1X,15F8.1)
853 CONTINUE
8531 CONTINUE
IF(NUMTY.EQ.0) GO TO 110
WRITE(IOCODE,34)
34 FORMAT(//T15,'**********TRANSMISSIBILITY (TY) NODE MODIFICATIONS',
& '**********',//T15,
& ' I1 I2 J1 J2 K1 K2 NEW TY VALUE')
DO 276 L=1,NUMTY
READ(20,*) I1,I2,J1,J2,K1,K2,REGVAL
WRITE(IOCODE,32) I1,I2,J1,J2,K1,K2,REGVAL
DO 276 K=K1,K2
DO 276 J=J1,J2
DO 276 I=I1,I2
IF(VP(I,J,K).GT.0.) TY(I,J,K)=REGVAL
276 CONTINUE
110 IF(ITCODE.NE.1) GO TO 8551
WRITE(IOCODE,47)
47 FORMAT(//T15,'**********TRANSMISSIBILITY (TY) DISTRIBUTION'
& ,'**********'/)
DO 855 K=1,KK
WRITE(IOCODE,38)K
DO 856 J=1,JJ
856 WRITE(IOCODE,72)(TY(I,J,K),I=1,II)
855 CONTINUE
8551 CONTINUE
IF(NUMTZ.EQ.0) GO TO 120
WRITE(IOCODE,37)
37 FORMAT(//T15,'**********TRANSMISSIBILITY (TZ) NODE MODIFICATIONS',
& '**********',//T15,
& ' I1 I2 J1 J2 K1 K2 NEW TZ VALUE')
DO 277 L=1,NUMTZ
READ(20,*) I1,I2,J1,J2,K1,K2,REGVAL
WRITE(IOCODE,32) I1,I2,J1,J2,K1,K2,REGVAL
DO 277 K=K1,K2
DO 277 J=J1,J2
DO 277 I=I1,I2
IF(VP(I,J,K).GT.0.) TZ(I,J,K)=REGVAL
277 CONTINUE
120 IF(ITCODE.NE.1) GO TO 8571
WRITE(IOCODE,48)
48 FORMAT(//T15,'**********TRANSMISSIBILITY (TZ) DISTRIBUTION'
& ,'**********'/)
DO 857 K=1,KK
WRITE(IOCODE,38)K
DO 858 J=1,JJ
858 WRITE(IOCODE,72)(TZ(I,J,K),I=1,II)
857 CONTINUE
8571 CONTINUE
C TRANSMISSIBILITY ARRAY CHECK
DO 900 K=1,KK
DO 900 J=1,JJ
DO 900 I=1,II
IF(TX(I,J,K).GE.0.0) GO TO 894
IFATAL=IFATAL+1
WRITE(IOCODE,893) I,J,K
893 FORMAT(/,5X,5('-'),'GRID BLOCK TX ERROR AT IJK =',3I5)
894 IF(TY(I,J,K).GE.0.0) GO TO 896
IFATAL=IFATAL+1
WRITE(IOCODE,895) I,J,K
895 FORMAT(/,5X,5('-'),'GRID BLOCK TY ERROR AT IJK =',3I5)
896 IF(TZ(I,J,K).GE.0.0) GO TO 900
IFATAL=IFATAL+1
WRITE(IOCODE,897) I,J,K
897 FORMAT(/,5X,5('-'),'GRID BLOCK TZ ERROR AT IJK =',3I5)
900 CONTINUE
RETURN
END
C........................................................................TRIKR
SUBROUTINE TRIKRO(IREG,SO,SW,RKRO)
C MACHINE DEPENDENT INCLUDE STATEMENT
$INCLUDE:'PARAMS.FOR'
C 3-PHASE REL PERM CALC
REAL KROT,KROGT,KROW,KROG,KROWR,KRG,KRW,KRGT,KRWT
REAL MUOT,MUGT,MUWT
COMMON /BUBBLE/ PBO,VSLOPE(LP8),BSLOPE(LP8),RSLOPE(LP8),PMAXT,
& IREPRS,MPGT(LP8),
& RHOSCO(LP8),RHOSCW(LP8),RHOSCG(LP8),MSAT(LP7),MPOT(LP8),
& MPWT(LP8),PBOT(LP1,LP2,LP3),PBOTN(LP1,LP2,LP3)
COMMON /SARRAY/ PN(LP1,LP2,LP3),IOCODE,IDMAX,
& SON(LP1,LP2,LP3),SWN(LP1,LP2,LP3),SGN(LP1,LP2,LP3),
& A1(LP1,LP2,LP3),A2(LP1,LP2,LP3),A3(LP1,LP2,LP3),
& SUM(LP1,LP2,LP3),GAM(LP1,LP2,LP3),QS(LP1,LP2,LP3)
COMMON /SPVT/ SAT(LP7,LP9),KROT(LP7,LP9),KRWT(LP7,LP9),
& BGT(LP7,LP9),
& KRGT(LP7,LP9),ITHREE(LP7),RSOT(LP7,LP9),BWPT(LP7,LP9),
& PCOWT(LP7,LP9),PCGOT(LP7,LP9),KROGT(LP7,LP9),SWR(LP7),
& POT(LP7,LP9),MUOT(LP7,LP9),BOT(LP7,LP9),BOPT(LP7,LP9),
& RSOPT(LP7,LP9),PWT(LP7,LP9),MUWT(LP7,LP9),BWT(LP7,LP9),
& RSWT(LP7,LP9),RSWPT(LP7,LP9),PGT(LP7,LP9),MUGT(LP7,LP9),
& BGPT(LP7,LP9),CRT(LP7,LP9),IPVT(LP1,LP2,LP3),IROCK(LP1,LP2,LP3),
& NROCK,NPVT,PSIT(LP7,LP9),PRT(LP7,LP9),WOROCK(LP7),GOROCK(LP7)
SOWR=1.0-SWR(IREG)
SL=SO+SW
SG=1.-SL
IF(SG.LE.0.001) GO TO 10
CALL INTERP(IREG,SAT,KROT,MSAT(IREG),1.-SW,KROW)
CALL INTERP(IREG,SAT,KROGT,MSAT(IREG),SL,KROG)
CALL INTERP(IREG,SAT,KROT,MSAT(IREG),SOWR,KROWR)
CALL INTERP(IREG,SAT,KRWT,MSAT(IREG),SW,KRW)
CALL INTERP(IREG,SAT,KRGT,MSAT(IREG),SG,KRG)
RKRO=((KROW+KRW)*(KROG+KRG))/KROWR
& -(KRW+KRG)
C WRITE(IOCODE,5) KROWR,KROW,KROG,KRW,KRG,RKRO
C 3 FORMAT(5X,'KROWR,KROW,KROG,KRW,KRG,RKRO = ',5F10.4)
IF(RKRO.GT.1.0) RKRO=1.0
IF(RKRO.LT.0.0) RKRO=0.0
C WRITE(IOCODE,15) SOWR,SL,SG,SO,KROG,RKRO
RETURN
C NO FREE GAS IN THE BLOCK
10 CALL INTERP(IREG,SAT,KROT,MSAT(IREG),SO,RKRO)
C WRITE(IOCODE,15) SOWR,SL,SG,SO,KROG,RKRO
C 15 FORMAT(1X,'SOWR,SL,SG,SO,KROG,RKRO = ',6F10.4)
RETURN
END
C........................................................................UINIT
SUBROUTINE UINITL(KPI,II,JJ,KK,PI,ET0,CUMPO,MBEO,
&CUMPW,MBEW,CUMPG,MBEG,SOI,SWI,SGI,
&WOC,GOC,PGOC,CUMIW,CUMIG)
C MACHINE DEPENDENT INCLUDE STATEMENT
$INCLUDE:'PARAMS.FOR'
C P AND SAT INITIALIZATION
DIMENSION WOC(LP7),GOC(LP7)
REAL MBEO,MBEW,MBEG,KX,KY,KZ,KROT,KRWT,KRGT,KROGT,MUOT,MUWT,MUGT
COMMON /BUBBLE/ PBO,VSLOPE(LP8),BSLOPE(LP8),RSLOPE(LP8),PMAXT,
& IREPRS,MPGT(LP8),
& RHOSCO(LP8),RHOSCW(LP8),RHOSCG(LP8),MSAT(LP7),MPOT(LP8),
& MPWT(LP8),PBOT(LP1,LP2,LP3),PBOTN(LP1,LP2,LP3)
COMMON /SARRAY/ PN(LP1,LP2,LP3),IOCODE,IDMAX,
& SON(LP1,LP2,LP3),SWN(LP1,LP2,LP3),SGN(LP1,LP2,LP3),
& A1(LP1,LP2,LP3),A2(LP1,LP2,LP3),A3(LP1,LP2,LP3),
& SUM(LP1,LP2,LP3),GAM(LP1,LP2,LP3),QS(LP1,LP2,LP3)
COMMON /SPARM/ KX(LP1,LP2,LP3),KY(LP1,LP2,LP3),KZ(LP1,LP2,LP3),
& EL(LP1,LP2,LP3),TX(LP4,LP2,LP3),TY(LP1,LP5,LP3),TZ(LP1,LP2,LP6),
& PDAT(LP1,LP2,LP3),PDATUM,GRAD
COMMON /SPRTPS/ P(LP1,LP2,LP3),SO(LP1,LP2,LP3),SW(LP1,LP2,LP3),
& SG(LP1,LP2,LP3)
COMMON /SPVT/ SAT(LP7,LP9),KROT(LP7,LP9),KRWT(LP7,LP9),
& BGT(LP7,LP9),
& KRGT(LP7,LP9),ITHREE(LP7),RSOT(LP7,LP9),BWPT(LP7,LP9),
& PCOWT(LP7,LP9),PCGOT(LP7,LP9),KROGT(LP7,LP9),SWR(LP7),
& POT(LP7,LP9),MUOT(LP7,LP9),BOT(LP7,LP9),BOPT(LP7,LP9),
& RSOPT(LP7,LP9),PWT(LP7,LP9),MUWT(LP7,LP9),BWT(LP7,LP9),
& RSWT(LP7,LP9),RSWPT(LP7,LP9),PGT(LP7,LP9),MUGT(LP7,LP9),
& BGPT(LP7,LP9),CRT(LP7,LP9),IPVT(LP1,LP2,LP3),IROCK(LP1,LP2,LP3),
& NROCK,NPVT,PSIT(LP7,LP9),PRT(LP7,LP9),WOROCK(LP7),GOROCK(LP7)
COMMON /SSOLN/ BO(LP1,LP2,LP3),BW(LP1,LP2,LP3),BG(LP1,LP2,LP3),
& QO(LP1,LP2,LP3),QW(LP1,LP2,LP3),QG(LP1,LP2,LP3),
& GOWT(LP1,LP2,LP3),GWWT(LP1,LP2,LP3),GGWT(LP1,LP2,LP3),
& OW(LP4,LP2,LP3),OE(LP4,LP2,LP3),WW(LP4,LP2,LP3),WE(LP4,LP2,LP3),
& OS(LP1,LP5,LP3),ON(LP1,LP5,LP3),WS(LP1,LP5,LP3),WN(LP1,LP5,LP3),
& OT(LP1,LP2,LP6),OB(LP1,LP2,LP6),WT(LP1,LP2,LP6),WB(LP1,LP2,LP6),
& QOWG(LP1,LP2,LP3),VP(LP1,LP2,LP3),CT(LP1,LP2,LP3)
COMMON /TSTDAT/ IFATAL,IWARN
ET0=0.0
CUMPO=0.0
CUMPW=0.0
CUMPG=0.0
CUMIW=0.0
CUMIG=0.0
MBEO=0.0
MBEW=0.0
MBEG=0.0
READ(20,69)
READ(20,*) KPI,KSI,PDATUM,GRAD
DO 250 NR=1,NROCK
IF(KPI.NE.0) GO TO 250
READ(20,*) PI,WOC(NR),PGOC,GOC(NR)
DO 200 K=1,KK
DO 200 J=1,JJ
DO 200 I=1,II
BPT=PBOT(I,J,K)
IPVTR=IPVT(I,J,K)
IF(IROCK(I,J,K).NE.NR) GO TO 200
IF(EL(I,J,K).LT.GOC(NR)) GO TO 175
IF(EL(I,J,K).GT.WOC(NR))GO TO 150
CALL INTPVT(IPVTR,BPT,BSLOPE(IPVTR),POT,BOT,MPOT(IPVTR),PI,BBO)
CALL INTPVT(IPVTR,BPT,RSLOPE(IPVTR),POT,RSOT,MPOT(IPVTR),PI,RSO)
RHOO=(RHOSCO(IPVTR)+RSO*RHOSCG(IPVTR))/BBO
PN(I,J,K)=PI+RHOO*(EL(I,J,K)-WOC(NR))/144.
GO TO 200
150 CALL INTERP(IPVTR,PWT,BWT,MPWT(IPVTR),PI,BBW)
CALL INTERP(IPVTR,PWT,RSWT,MPWT(IPVTR),PI,RSW)
RHOW=(RHOSCW(IPVTR)+RSW*RHOSCG(IPVTR))/BBW
PN(I,J,K)=PI+RHOW*(EL(I,J,K)-WOC(NR))/144.
GO TO 200
175 CALL INTERP(IPVTR,PGT,BGT,MPGT(IPVTR),PGOC,BBG)
RHOG=RHOSCG(IPVTR)/BBG
PN(I,J,K)=PGOC+RHOG*(EL(I,J,K)-GOC(NR))/144.
200 CONTINUE
250 CONTINUE
IF(KPI.EQ.0) GO TO 9010
DO 3010 K=1,KK
DO 3005 J=1,JJ
3005 READ(20,*)(PN(I,J,K),I=1,II)
3010 CONTINUE
9010 CONTINUE
C**** INITIALIZE N+1 PRESSURE ARRAY.
DO 3012 I=1,II
DO 3012 J=1,JJ
DO 3012 K=1,KK
3012 P(I,J,K)=PN(I,J,K)
IF(KSI.NE.0)GO TO 5600
DO 40 NR=1,NROCK
READ(20,*) SOI,SWI,SGI
DO 30 K=1,KK
DO 30 J=1,JJ
DO 30 I=1,II
IF(IROCK(I,J,K).NE.NR) GO TO 30
SON(I,J,K)=SOI
IF(EL(I,J,K).GT.WOC(NR)) SON(I,J,K)=0.
IF(EL(I,J,K).LT.GOC(NR)) SON(I,J,K)=0.
SWN(I,J,K)=SWI
IF(EL(I,J,K).GT.WOC(NR)) SWN(I,J,K)=1.
IF(EL(I,J,K).LT.GOC(NR)) SWN(I,J,K)=SWR(NR)
SGI=1.0-SOI-SWI
SGN(I,J,K)=SGI
SO(I,J,K)=SON(I,J,K)
SW(I,J,K)=SWN(I,J,K)
SG(I,J,K)=SGN(I,J,K)
IF(SG(I,J,K).LT.0.0) SG(I,J,K)=0.0
30 CONTINUE
40 CONTINUE
GO TO 4000
5600 DO 3011 K=1,KK
DO 3006 J=1,JJ
3006 READ(20,*)(SO(I,J,K),I=1,II)
3011 CONTINUE
DO 3020 K=1,KK
DO 3007 J=1,JJ
3007 READ(20,*)(SW(I,J,K),I=1,II)
3020 CONTINUE
DO 3030 K=1,KK
DO 3030 J=1,JJ
DO 3030 I=1,II
SG(I,J,K)=1.0-SO(I,J,K)-SW(I,J,K)
IF(SG(I,J,K).LT.0.0) SG(I,J,K)=0.0
SON(I,J,K)=SO(I,J,K)
SWN(I,J,K)=SW(I,J,K)
SGN(I,J,K)=SG(I,J,K)
3030 CONTINUE
69 FORMAT(40A2)
4000 CONTINUE
DO 4200 K=1,KK
DO 4200 J=1,JJ
DO 4200 I=1,II
IF(VP(I,J,K).GT.0.0) GO TO 4100
P(I,J,K)=0.0
SO(I,J,K)=0.0
SW(I,J,K)=0.0
SG(I,J,K)=0.0
PN(I,J,K)=0.0
SON(I,J,K)=0.0
SWN(I,J,K)=0.0
SGN(I,J,K)=0.0
4100 CONTINUE
C CHECK INITIAL ARRAYS
IF(VP(I,J,K).LE.0.) GO TO 4200
IF(P(I,J,K).GE.0.0) GO TO 4120
IFATAL=IFATAL+1
WRITE(IOCODE,4110) I,J,K
4110 FORMAT(/5X,5('-'),'INIT P ERROR AT GRID BLOCK IJK = ',3I5)
4120 IF(SO(I,J,K).GE.0.0.AND.SO(I,J,K).LE.1.0) GO TO 4140
IFATAL=IFATAL+1
WRITE(IOCODE,4130) I,J,K
4130 FORMAT(/5X,5('-'),'INIT SO ERROR AT GRID BLOCK IJK = ',3I5)
4140 IF(SW(I,J,K).GE.0.0.AND.SW(I,J,K).LE.1.0) GO TO 4160
IFATAL=IFATAL+1
WRITE(IOCODE,4150) I,J,K
4150 FORMAT(/5X,5('-'),'INIT SW ERROR AT GRID BLOCK IJK = ',3I5)
4160 IF(SG(I,J,K).GE.0.0.AND.SG(I,J,K).LE.1.0) GO TO 4180
IFATAL=IFATAL+1
WRITE(IOCODE,4170) I,J,K
4170 FORMAT(/5X,5('-'),'INIT SG ERROR AT GRID BLOCK IJK = ',3I5)
4180 SUMSAT=SO(I,J,K)+SW(I,J,K)+SG(I,J,K)
ERR=(1.0-SUMSAT)
IF(ABS(ERR).LE.0.0001) GO TO 4200
WRITE(IOCODE,10) SO(I,J,K) ,SW(I,J,K),SG(I,J,K)
10 FORMAT(/,5X,' SO=',F10.6,' SW=',F10.6,' SG=',F10.6)
IFATAL=IFATAL+1
WRITE(IOCODE,4190) I,J,K, SUMSAT
4190 FORMAT(/5X,5('-'),'INIT SAT SUM ERROR AT GRID BLOCK IJK = ',3I5,'
& SUMSAT = ',F10.5)
4200 CONTINUE
RETURN
END
C......................................................VISCY
SUBROUTINE VISCY(TEMPRD,PRSPRD,SPG,TEM,CNCH2S,CNCCO2,
& CNCN2,VISGR,VISG,IERR)
C MACHINE DEPENDENT INCLUDE STATEMENT
$INCLUDE:'PARAMS.FOR'
C CORRELATION GAS VISCOSITY
DIMENSION TEMTBL(13),PRSTBL(22),VISTBL(22,13),VISTB1(22,7),
& VISTB2(22,6)
EQUIVALENCE (VISTB1(1,1),VISTBL(1,1)),(VISTB2(1,1),VISTBL(1,8))
DATA TEMTBL/1.05,
&1.10,1.15,1.20,1.30,1.40,1.50,1.60,1.75,2.00,2.25,2.50,3.0/
DATA PRSTBL/0.1,
&0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2,
& 1.4, 1.6, 1.8, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 15.0, 20.0/
DATA VISTB1 /1.000
A,1.012,1.025,1.050,1.075,1.100,1.145,1.195,1.285,1.415,1.760,
B2.285,2.865,3.290,3.650,4.760,5.500,6.460,7.150,7.680,8.650,9.370,
C1.000,1.011,1.023,1.043,1.065,1.086,1.120,1.150,1.195,1.255,1.435,
D1.700,2.070,2.465,2.800,3.850,4.655,5.720,6.500,7.060,8.100,8.880,
E1.000,1.010,1.021,1.036,1.055,1.073,1.095,1.120,1.145,1.175,1.280,
F1.420,1.590,1.850,2.160,3.225,3.975,5.030,5.820,6.385,7.410,8.180,
G1.000,1.009,1.019,1.030,1.045,1.060,1.070,1.085,1.110,1.135,1.195,
H1.285,1.425,1.570,1.750,2.600,3.350,4.380,5.125,5.740,6.750,7.500,
I1.000,1.008,1.017,1.027,1.040,1.054,1.063,1.075,1.100,1.120,1.155,
J1.215,1.285,1.360,1.460,2.020,2.560,3.500,4.185,4.755,5.790,6.500,
K1.000,1.007,1.015,1.024,1.035,1.048,1.056,1.067,1.089,1.110,1.135,
L1.185,1.235,1.280,1.335,1.690,2.110,2.790,3.380,3.860,4.790,5.410,
M1.000,1.006,1.013,1.021,1.030,1.042,1.049,1.059,1.078,1.100,1.120,
N1.150,1.185,1.220,1.260,1.500,1.785,2.325,2.820,3.230,4.060,4.610/
DATA VISTB2 /1.000
A,1.005,1.011,1.018,1.025,1.036,1.042,1.051,1.067,1.070,1.095,
B1.120,1.150,1.180,1.215,1.385,1.595,2.030,2.425,2.770,3.490,4.025,
C1.000,1.004,1.009,1.015,1.021,1.030,1.035,1.043,1.056,1.065,1.090,
D1.110,1.125,1.145,1.165,1.280,1.435,1.770,2.095,2.375,2.990,3.500,
E1.000,1.003,1.007,1.012,1.017,1.024,1.028,1.035,1.045,1.055,1.060,
F1.070,1.080,1.095,1.110,1.205,1.290,1.500,1.725,1.955,2.480,2.925,
G1.000,1.002,1.005,1.009,1.013,1.018,1.021,1.027,1.034,1.040,1.045,
H1.055,1.065,1.075,1.085,1.145,1.210,1.340,1.485,1.665,2.085,2.460,
I1.000,1.001,1.003,1.006,1.009,1.012,1.015,1.019,1.023,1.025,1.030,
J1.040,1.050,1.060,1.065,1.105,1.155,1.245,1.360,1.485,1.830,2.150,
K1.000,1.000,1.001,1.003,1.005,1.007,1.009,1.011,1.013,1.015,1.020,
L1.025,1.030,1.035,1.040,1.060,1.085,1.140,1.205,1.265,1.495,1.750/
LOPRS = 2
IHIPRS = 21
LOTEM = 3
IHITEM = 11
IERR = 0
IF (TEMPRD .LT. 1.05 .OR. TEMPRD .GT. 3.00) GO TO 340
IF (PRSPRD .LT. 0.01 .OR. PRSPRD .GT. 20.00) GO TO 340
IF (SPG .LT. 0.55 .OR. SPG .GT. 1.50) GO TO 340
IF (TEM .LT. 40.0 .OR. TEM .GT. 400.0) GO TO 340
DO 100 J = LOTEM, IHITEM
IF (TEMTBL(J) .GE. TEMPRD) GO TO 120
100 CONTINUE
J = IHITEM + 1
120 IF (PRSTBL(LOPRS - 1) .LT. PRSPRD) GO TO 160
I = 1
ICALL = 1
GO TO 320
140 VISGR = 1.00 + (PRSPRD * (VISI - 1.0))
GO TO 300
160 IF(PRSTBL(IHIPRS+1).GT.PRSPRD) GO TO 200
I=IHIPRS+1
ICALL=2
GO TO 320
180 VISGR=VISI
GO TO 300
200 DO 220 I=LOPRS,IHIPRS
IF(PRSTBL(I).GE.PRSPRD) GO TO 240
220 CONTINUE
I=IHIPRS+1
240 ICALL=3
GO TO 320
260 VISJ=VISI
I=I-1
ICALL=4
GO TO 320
280 I=I+1
VISGR=VISI + (((PRSPRD-PRSTBL(I-1))/(PRSTBL(I)-PRSTBL(I-1)))
& *(VISJ-VISI))
300 VISGU=(0.126585E-01) - (0.611823E-02)*SPG + (0.164574E-02)*SPG
& *SPG + (0.164574E-04)*TEM - (0.719221E-06)*SPG*TEM
& - (0.609046E-06)*SPG*SPG*TEM
CORH2S=(0.000113*CNCH2S*SPG - 0.000038*CNCH2S + 0.000001)
& *(1./(1.+SPG)) + 0.000001
CORCO2=(0.000134*CNCCO2*SPG - 0.000004*CNCCO2 + 0.000004*SPG)
& *(1./(1.+SPG))-0.000003
CORN2=(0.000170*CNCN2*SPG + 0.000021*CNCN2 + 0.000010*SPG)
& *(1./(1.+SPG)) - 0.000006
VISGA=VISGU + CORH2S + CORCO2 + CORN2
VISG=VISGR*VISGA
GO TO 360
320 CALL XLGR4(TEMPRD,TEMTBL(J-2),TEMTBL(J-1),TEMTBL(J),
& TEMTBL(J+1),VISI,VISTBL(I,J-2),VISTBL(I,J-1),
& VISTBL(I,J),VISTBL(I,J+1))
GO TO (140,180,260,280),ICALL
340 IERR=1
VISGR=0.0
VISG=0.0
360 RETURN
END
C......................................................XLGR4
SUBROUTINE XLGR4(X,X1,X2,X3,X4,Y,Y1,Y2,Y3,Y4)
C MACHINE DEPENDENT INCLUDE STATEMENT
$INCLUDE:'PARAMS.FOR'
C LAGRANGIAN INTERP
A1=X1-X2
A2=X1-X3
A3=X1-X4
A4=X2-X3
A5=X2-X4
A6=X3-X4
B1=X-X1
B2=X-X2
B3=X-X3
B4=X-X4
Y= B2/A1 *B3/A2 *B4/A3* Y1 -
& B1/A1 *B3/A4 *B4/A5* Y2 +
& B1/A2 *B2/A4 *B4/A6 *Y3 -
& B1/A3 *B2/A5 *B3/A6* Y4
RETURN
END
C......................................................ZANDC
SUBROUTINE ZANDC(TEMP,TEMPC,PRS,PRSPC,CNCH2S,
& CNCCO2,ZED,CMPG,IERR)
C MACHINE DEPENDENT INCLUDE STATEMENT
$INCLUDE:'PARAMS.FOR'
C Z-FACTOR AND GAS COMP CALC USING CORRELATIONS
DIMENSION A(8)
DATA A/0.31506237,
&-1.04670990, -0.57832729, 0.53530771,
&-0.61232032, -0.10488813, 0.68157001, 0.68446549/
FRCA=(CNCH2S+CNCCO2)/100.
FRCB=CNCH2S/100.
EPS=120.*(FRCA**0.9 -FRCA**1.6) + 15.*(FRCB**0.5
& -FRCB**4.0)
TEMPCA=TEMPC-EPS
PRSPCA=PRSPC*TEMPCA/(TEMPC+FRCB*(1.-FRCB)*EPS)
TEMPRD=(TEMP+460.)/TEMPCA
PRSPRD=PRS/PRSPCA
IERR=0
IF(TEMPRD.LT.1.05.OR.TEMPRD.GT.3.0) GO TO 140
IF(PRSPRD.LT.0.0.OR.PRSPRD.GT.15.0) GO TO 140
IF(FRCA.LT.0.0.OR.FRCA.GT.0.85) GO TO 140
ITER=0
T1=A(1)*TEMPRD +A(2) +A(3)/(TEMPRD*TEMPRD)
T2=A(4)*TEMPRD + A(5)
T3=A(5)*A(6)
T4=A(7)/(TEMPRD*TEMPRD)
T5=A(8)
DENRD=1.0
DO 120 ITER=1,10
DENRD2=DENRD*DENRD
DENRD3=DENRD2*DENRD
DENRD4=DENRD2*DENRD2
DENRD5=DENRD2*DENRD3
P=(TEMPRD +T1*DENRD + T2*DENRD2 + T3*DENRD5)
& *DENRD + T4*DENRD3*(1. + T5*DENRD2)*
& EXP(-T5*DENRD2)
DP=TEMPRD + 2.*T1*DENRD + 3.*T2*DENRD2
& + 6.*T3*DENRD5 + T4*DENRD2*EXP
&(-T5*DENRD2)*(3. + 3.*T5*DENRD2
& - 2.*T5*T5*DENRD4)
DENRD1=DENRD-(P-0.270*PRSPRD)/DP
IF(DENRD1.GT.0.) GO TO 100
DENRD1=0.5*DENRD
100 IF(DENRD1.LT.2.2) GO TO 110
DENRD1=DENRD + 0.9*(2.2-DENRD)
110 IF(ABS(DENRD-DENRD1).LT.0.00001) GO TO 130
120 DENRD=DENRD1
130 ZED=0.270*PRSPRD/(DENRD1*TEMPRD)
DENRD=DENRD1
DENRD2=DENRD*DENRD
DENRD4=DENRD2*DENRD2
DZED=T1/TEMPRD + 2.*T2/TEMPRD*DENRD
& + 5.*T3*DENRD4/TEMPRD + (1.+T5*DENRD2
& - T5*T5*DENRD4) * 2.*T4/TEMPRD*DENRD
& *EXP(-T5*DENRD2)
CMPPRD=1./PRSPRD -0.270*DZED/(ZED*ZED*TEMPRD
& * (1.+DENRD/ZED*DZED))
CMPG=CMPPRD/PRSPCA
GO TO 150
140 IERR=1
ZED=0.
CMPG=0.
150 RETURN
END
C.........................................................FPTD
FUNCTION FPTD(A0,A1,A2,A3,X)
C CALC. DIM PRESSURE AT TIME N+1 FOR CARTER-TRACY
FPTD=A0+A1*X+A2*ALOG(X)+A3*ALOG(X)*ALOG(X)
RETURN
END
C..........................................................FDPTD
FUNCTION FDPTD(A1,A2,A3,X)
C CALC. DERIVATIVE OF DIM P WRT DIM TIME AT N+1
C FOR CARTER-TRACY
FDPTD=A1+(A2/X)+(2.*A3*ALOG(X)/X)
RETURN
END