home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / oilfield / spe-16.lzh / PVT.FOR < prev   
Text File  |  1985-12-20  |  5KB  |  208 lines

  1. $DEBUG
  2. C
  3. C          PROGRAM TO CALCULATE OIL AND GAS PVT PROPERTIES
  4. C
  5. C
  6. C       TO FIND THE Z-FACTOR USIN THE HALL+YARBOTOUGH EQUATION
  7. C
  8. C
  9.         CHARACTER*1 CHAR
  10.         OPEN(UNIT=6,FILE='PVT.TAB',STATUS='NEW')
  11. 2001    WRITE(*,*)'ENTER OIL GRAVITY (DEG.API)'
  12.         READ(*,*)GO
  13.         WRITE(*,*)'ENTER THE GAS GRAVITY (AIR=1.00) '
  14.         READ(*,*)GG
  15.         WRITE(*,*)'ENTER INITIAL RESERVOIR PRESSURE (PSI)'
  16.         READ(*,*)P
  17.         WRITE(*,*)'ENTER ABANDONMENT  RESERVOIR PRESSURE (PSI)'
  18.         READ(*,*)PA
  19.         WRITE(*,*)'ENTER PVT TABLE OUTPUT INCREMENT (PSI)'
  20.         READ(*,*)PINC
  21.         WRITE(*,*)'ENTER RESERVOIR TEMPERATURE (DEG.  RANNKIN)'
  22.         READ(*,*)RT
  23.         WRITE(*,*)'ENTER SEPARATOR PRESSURE (PSI)'
  24.         READ(*,*)SP
  25.         WRITE(*,*)'ENTER SEPARATOR TEMPERATURE (DEG. FAHRENHEIT)'
  26.         READ(*,*)ST
  27.         WRITE(*,*)'ENTER BUBLE POINT PRESSURE (PSI)'
  28.         WRITE(*,*)'AND/OR INITIAL GAS SOLUBILITY (SCF/STB)'
  29.         WRITE(*,*)'ENTER ZERO IF QUANTITY UNKNOWN'
  30.         READ(*,*)PB,RSI
  31. C
  32. C
  33. C
  34.         WRITE(*,100)GO,GG,P,PA,PINC,RT,SP,ST,PB,RSI
  35. C       write(*,*)
  36.         WRITE(*,*)'IS THE ABOVE DATA CORRECT  ENTER   Y/N'
  37.         READ(*,'(A1)')CHAR
  38.         IF(CHAR.NE.'Y')GO TO 2001
  39. C
  40.         LPRINT=0
  41.         LPAGE=0
  42.         INC=1
  43. C
  44. C
  45. C
  46. 1001    TC=169+314*GG
  47.         PC=708.75-57.5*GG
  48.         TT=TC/RT
  49.         PR=P/PC
  50.         Y=.0001
  51. 30      F=(-.06125)*PR*TT*EXP(-1.2*(1-TT)**2)
  52.      1+((Y+Y**2+Y**3-Y**4)/((1-Y)**3))
  53.      1-(14.76*TT-9.76*TT**2+4.58*TT**3)*Y**2
  54.      1+(90.7*TT-242.2*TT**2+42.4*TT**3)*Y**(
  55.      12.18+2.82*TT)
  56.         IF(ABS(F).LT.0.000001) GO TO 20
  57.         DF=((1+4*Y+4*Y**2-4*Y**3+Y**4
  58.      1)/((1-Y)**4))-(29.52*TT-19.52*TT**2+9.16*TT**3)*Y
  59.      1+(2.18+2.82*TT)*(90.7*TT-242.2*TT**2+42.4*TT**3)
  60.      1*Y**(1.18+2.82*TT)
  61.         Y=Y-F/DF
  62.         GO TO 30
  63. 20      Z=(.06125*PR*TT*EXP(-1.2*(1-TT)**2))/Y
  64. C
  65. C
  66. C
  67. C       TO FIND THE GAS FORMATION VOLUME FACTOR
  68. C
  69. C
  70. C
  71.         BG=RT*Z/(198.588*P)
  72. C
  73. C
  74. C
  75. C       TO FIND THE OIL FORMATION VOLUME FACTOR AND
  76. C       THE GAS SOLUBILITY USING VASQUEZ'S CORRELATIONS
  77. C
  78. C
  79. C
  80.         GGS=GG*(1.+(5.912E-05)*GO*ST*(ALOG10(SP/114.7)))
  81.         IF(GO.LE.30) GO TO 40
  82.         C1=.0178
  83.         C2=1.187
  84.         C3=23.931
  85.         GO TO 50
  86. 40      C1=.0362
  87.         C2=1.0937
  88.         C3=25.724
  89. 50      IF(PB.NE.0) GO TO 55
  90.         PB=(RSI/(C1*GGS*EXP(C3*GO/RT)))**(1/C2)
  91. 55      RSI=C1*GGS*(PB**C2)*EXP(C3*(GO/RT))
  92.         RS=RSI
  93.         IF(P.GT.PB) GO TO 60
  94.         RS=C1*GGS*(P**C2)*EXP(C3*(GO/RT))
  95. 60      IF(GO.LE.30) GO TO 70
  96.         C1=4.76E-04
  97.         C2=1.1E-05
  98.         C3=1.337E-09
  99.         GO TO 80
  100. 70      C1=4.677E-04
  101.         C2=1.751E-05
  102.         C3=-1.811E-08
  103. 80      BOB=1+C1*RSI+C2*(RT-520)*(GO/GGS)
  104.      1+C3*RSI*(RT-520)*(GO/GGS)
  105.         BO=1+C1*RS+C2*(RT-520)*(GO/GGS)
  106.      1+C3*RS*(RT-520)*(GO/GGS)
  107.         A1=-1433.
  108.         A2=5.0
  109.         A3=17.2
  110.         A4=-1180.
  111.         A5=12.61
  112.         A6=100000.
  113.         CO=(A1+A2*RS+A3*(RT-460)+A4*GGS+A5*GO)/(A6*P)
  114.         IF(P.LE.PB) GO TO 90
  115.         BO=BOB*EXP(CO*(PB-P))
  116.         BG=0.
  117. C
  118. C
  119. C
  120. C       TO CALCULATE THE OIL VISCOSITY USING
  121. C       BEGGS CORRELATION
  122. C
  123. C
  124. C
  125. 90      ZX=3.0324-.02023*GO
  126.         YX=10**ZX
  127.         XX=YX*(RT-460.)**(-1.163)
  128.         UD=(10**XX)-1.
  129.         AA=10.715*(RS+100.)**(-.515)
  130.         BB=5.44*(RS+150.)**(-.338)
  131.         UO=AA*UD**BB
  132. C
  133. C
  134. C
  135. C       TO CALCULATE THE GAS VISCOSITY
  136. C       USING LEE'S CORRELATION
  137. C
  138. C
  139. C
  140.         GM=GG*28.97
  141.         GD=P*GM/(RT*10.732*Z*62.428)
  142.         GK=((9.4+.02*GM)*RT**1.5)/(209+19*GM+RT)
  143.         GX=3.5+(986/RT)+.01*GM
  144.         GJ=2.4-.2*GX
  145.         UG=GK*1E-04*EXP(GX*GD**GJ)
  146. C
  147. C
  148. C
  149. C       TO CALCULATE THE WATER VISCOSITY USING
  150. C       BEGGS AND BRILL CORRELATION
  151. C
  152. C
  153. C
  154.         UW=EXP(1.003-1.479E-02*(RT-460.)+1.982E-05*(RT-460.)**2.)
  155. C
  156. C
  157. C
  158. C       TO CALCULATE THE OIL AND GAS DENSITIES
  159. C
  160. C
  161. C
  162.         GD=350.52*GD
  163.         GDS=GD*BG
  164. C
  165. C
  166. C
  167.         ODS=(141.5/(131.5+GO))*62.366*5.61458
  168.         OD=(ODS+RS*GDS)/BO
  169. C
  170.         IF(INC.EQ.1)THEN
  171.         WRITE(*,100)GO,GG,P,PA,PINC,RT,SP,ST,PB,RSI
  172.         WRITE(6,100)GO,GG,P,PA,PINC,RT,SP,ST,PB,RSI
  173.         END IF
  174.         INC=2
  175.         IF(LPRINT.EQ.LPAGE)WRITE(*,200)
  176.         IF(LPRINT.EQ.LPAGE)WRITE(6,200)
  177.         IF(LPRINT.EQ.LPAGE)LPAGE=LPAGE+60
  178.         LPRINT=LPRINT+1
  179.         WRITE(*,300)P,BO,BG,RS,UO,UG,UW,OD,GD
  180.         WRITE(6,300)P,BO,BG,RS,UO,UG,UW,OD,GD
  181. C  
  182.         P=P-PINC 
  183.         IF(P.LT.PA)GO TO 3001
  184.         GO TO 1001
  185. C
  186. 100     FORMAT(1X,///,2X,'OIL GRAVITY =',F8.4,' DEG. API',//,
  187.      &2X,'GAS GRAVITY=',F8.4,//,
  188.      &2X,'RESERVOIR PRESSURE=',F10.4,' PSI',//
  189.      &,2X,'ABANDONMENT PRESSURE=',F10.4,' PSI',//,2X,
  190.      &'PVT TABLE OUTPUT INCREMENT=',F8.4,//,2X,'RESERVOIR TEMPERATURE=',
  191.      &F8.4,' DEG. RANKIN',
  192.      &//,2X,'SEPARATOR PRESSURE=',F8.4,' PSI',//,2X,
  193.      &'SEPARATOR TEMPERATURE=',
  194.      &F8.4,' DEG. FAHRENHEIT',//,2X,'BUBLE POINT PRESSURE=',F10.4,
  195.      &' PSI',//,2X,'INITIAL GAS SOLUBILITY=',F12.4,' SCF/STB')
  196. C
  197. 200     FORMAT(/,7X,'P',7X,'BO',5X,'BG',10X,'RS',6X,'UO',6X,'UG',6X,'UW'
  198.      &,5X,'OD',6X,'GD',/,
  199.      &6X,'psi',4x,'rb/stb',2X,'rb/scf',4X,'scf/stb',4X,'cp',6x,'cp',6x,
  200.      &'cp',5x,'pcf',5x,'pcf')
  201. 300     FORMAT(/,2X,F8.2,2x,F6.4,2X,F7.6,2X,F9.2,2X,F6.4,2X,F6.4
  202.      &,2X,F6.4,2X,F6.2,2X,F6.2)
  203. C
  204. C
  205. C
  206. 3001    STOP
  207.         END
  208.