Modeling Golzapour’s synthetic oil

In [1]:
c = """METHANE
PROPANE
n-PENTANE
n-DECANE
n-HEXADECANE"""
In [2]:
f = """0.8232
0.0871
0.0505
0.0198
0.0194
"""
In [3]:
from sur import Mixture, EosSetup, setup_database
setup_database()
In [4]:
m = Mixture()
In [5]:
m.add_many(c, f)
In [6]:
m.sort()
m
Out[6]:
[(<Compound: METHANE>, Decimal('0.8232')), (<Compound: PROPANE>, Decimal('0.0871')), (<Compound: n-PENTANE>, Decimal('0.0505')), (<Compound: n-DECANE>, Decimal('0.0198')), (<Compound: n-HEXADECANE>, Decimal('0.0194'))]
In [7]:
from itertools import combinations
In [8]:
setup = EosSetup.objects.create(eos='RKPR', kij_mode=EosSetup.T_DEP, lij_mode=EosSetup.CONSTANTS)
In [9]:
for c1, c2 in combinations(m.compounds, 2):
    t = c1.tc if c1.weight < c2.weight else c2.tc
    setup.set_interaction('tstar', c1, c2, t)
In [10]:
setup.tstar(m)
Out[10]:
array([[   0.   ,  190.564,  190.564,  190.564,  190.564],
       [ 190.564,    0.   ,  369.83 ,  369.83 ,  369.83 ],
       [ 190.564,  369.83 ,    0.   ,  469.7  ,  469.7  ],
       [ 190.564,  369.83 ,  469.7  ,    0.   ,  617.7  ],
       [ 190.564,  369.83 ,  469.7  ,  617.7  ,    0.   ]])
In [11]:
setup.set_interaction('k0', 'methane', 'propane', 0.0572)
setup.set_interaction('k0', 'methane', 'n-pentane', 0.05616)
setup.set_interaction('k0', 'methane', 'n-decane', 0.06891)
setup.set_interaction('k0', 'methane', 'n-hexadecane', 0.14031);
In [12]:
setup.k0(m)
Out[12]:
array([[ 0.     ,  0.0572 ,  0.05616,  0.06891,  0.14031],
       [ 0.0572 ,  0.     ,  0.     ,  0.     ,  0.     ],
       [ 0.05616,  0.     ,  0.     ,  0.     ,  0.     ],
       [ 0.06891,  0.     ,  0.     ,  0.     ,  0.     ],
       [ 0.14031,  0.     ,  0.     ,  0.     ,  0.     ]])
In [13]:
setup.set_interaction('lij', 'methane', 'propane', -0.00272)
setup.set_interaction('lij', 'methane', 'n-pentane', -0.06603)
setup.set_interaction('lij', 'methane', 'n-decane', -0.09227)
setup.set_interaction('lij', 'methane', 'n-hexadecane', -0.12441);
In [14]:
setup.lij(m)
Out[14]:
array([[ 0.      , -0.00272 , -0.06603 , -0.09227 , -0.12441 ],
       [-0.00272 ,  0.      , -0.010835, -0.032481, -0.023269],
       [-0.06603 , -0.010835,  0.      , -0.02353 , -0.012501],
       [-0.09227 , -0.032481, -0.02353 ,  0.      ,  0.049878],
       [-0.12441 , -0.023269, -0.012501,  0.049878,  0.      ]])
In [15]:
envelope = m.get_envelope(setup)
In [17]:
%matplotlib inline
In [19]:
envelope.plot();
../_images/examples_Gozalpour_rkpr_17_0.png

Debug attributes

There is possible to see the raw input and output data that sur interchange with the EnvelopeSur.exe fortran program.

In [21]:
print(envelope.input_txt)
5               NC
0.8232  0.0871  0.0505  0.0198  0.0194                  z1,z2...zNC
3                               NMODEL (1:SRK / 2:PR / 3:RKPR)
0  1                    ncomb, nTdep
METHANE(1)
190.564  45.99 0.0115478  0.116530154855 1.16          tc, pc, ohm, vc, zrat
2.30376807604   0.0304337956072   0.5   1.54083758839           ac, b, delta1, k
PROPANE(2)
369.83  42.48 0.152291  0.233012170918 1.16          tc, pc, ohm, vc, zrat
9.80216972295   0.0598748909487   1.663687   1.9574557212               ac, b, delta1, k
0.0572          k0
190.564       tstar
-0.00272                lij
n-PENTANE(3)
469.7  33.7 0.251506  0.366506659349 1.16          tc, pc, ohm, vc, zrat
20.2236971345   0.0936309815449   1.957315   2.28798764446              ac, b, delta1, k
0.05616   0.0          k0
190.564   369.83       tstar
-0.06603   -0.010835            lij
n-DECANE(4)
617.7  21.1 0.492328  0.756468369911 1.16          tc, pc, ohm, vc, zrat
56.6610724692   0.192140038284   2.239538   3.11337933794               ac, b, delta1, k
0.06891   0.0   0.0          k0
190.564   369.83   469.7       tstar
-0.09227   -0.032481   -0.02353                 lij
n-HEXADECANE(5)
723.0  14.0 0.717404  1.34252502769 1.16          tc, pc, ohm, vc, zrat
116.426356444   0.341676477137   2.14291   3.90352446586                ac, b, delta1, k
0.14031   0.0   0.0   0.0          k0
190.564   369.83   469.7   617.7       tstar
-0.12441   -0.023269   -0.012501   0.049878             lij


In [22]:
print(envelope.output_txt)
METHANE(1)
Tc= 190.5640   Pc =  45.9900   Vc =  0.1005   OM = 0.0115
Zc=   0.2916 Zcrat=   1.1600 Zceos=  0.3382 Vceos= 0.1165
ac=   2.3038    b =   0.0304  del1=  0.5000    k = 1.5408
PROPANE(2)
Tc= 369.8300   Pc =  42.4800   Vc =  0.2009   OM = 0.1523
Zc=   0.2775 Zcrat=   1.1600 Zceos=  0.3219 Vceos= 0.2330
ac=   9.8022    b =   0.0599  del1=  1.6637    k = 1.9575
n-PENTANE(3)
Tc= 469.7000   Pc =  33.7000   Vc =  0.3160   OM = 0.2515
Zc=   0.2726 Zcrat=   1.1600 Zceos=  0.3163 Vceos= 0.3665
ac=  20.2237    b =   0.0936  del1=  1.9573    k = 2.2880
n-DECANE(4)
Tc= 617.7000   Pc =  21.1000   Vc =  0.6521   OM = 0.4923
Zc=   0.2679 Zcrat=   1.1600 Zceos=  0.3108 Vceos= 0.7565
ac=  56.6611    b =   0.1921  del1=  2.2395    k = 3.1134
n-HEXADECANE(5)
Tc= 723.0000   Pc =  14.0000   Vc =  1.1573   OM = 0.7174
Zc=   0.2695 Zcrat=   1.1600 Zceos=  0.3127 Vceos= 1.3425
ac= 116.4264    b =   0.3417  del1=  2.1429    k = 3.9035

 Tc, Pc and Vc are given in K, bar and L/mol respectively

   K0ij MATRIX
METHANE(1)
PROPANE(2)           0.05720
n-PENTANE(3)         0.05616   0.00000
n-DECANE(4)          0.06891   0.00000   0.00000
n-HEXADECANE(5)      0.14031   0.00000   0.00000   0.00000

   T* MATRIX
METHANE(1)
PROPANE(2)         190.56400
n-PENTANE(3)       190.56400 369.83000
n-DECANE(4)        190.56400 369.83000 469.70000
n-HEXADECANE(5)    190.56400 369.83000 469.70000 617.70000

   LIJ MATRIX
METHANE(1)
PROPANE(2)          -0.00272
n-PENTANE(3)        -0.06603  -0.01083
n-DECANE(4)         -0.09227  -0.03248  -0.02353
n-HEXADECANE(5)     -0.12441  -0.02327  -0.01250   0.04988

  Combining rules:
  0: Classical or van der Waals

Molar fractions:  0.823 0.087 0.051 0.020 0.019
  x    0.8232E+00  0.8710E-01  0.5050E-01  0.1980E-01  0.1940E-01
  y    0.8083E+00  0.9037E-01  0.5408E-01  0.2300E-01  0.2427E-01
  x    0.8232E+00  0.8710E-01  0.5050E-01  0.1980E-01  0.1940E-01
  y    0.8106E+00  0.8992E-01  0.5354E-01  0.2249E-01  0.2347E-01
  x    0.8232E+00  0.8710E-01  0.5050E-01  0.1980E-01  0.1940E-01
  y    0.8129E+00  0.8946E-01  0.5300E-01  0.2198E-01  0.2270E-01
  x    0.8232E+00  0.8710E-01  0.5050E-01  0.1980E-01  0.1940E-01
  y    0.8132E+00  0.8939E-01  0.5290E-01  0.2190E-01  0.2258E-01
  x    0.8232E+00  0.8710E-01  0.5050E-01  0.1980E-01  0.1940E-01
  y    0.8132E+00  0.8939E-01  0.5290E-01  0.2189E-01  0.2257E-01

    T(K)        P(bar)        D(mol/L)
    310.0000    0.2472E-03    0.9591E-05
    312.0835    0.3052E-03    0.1176E-04
    314.9521    0.4056E-03    0.1549E-04
    317.8332    0.5364E-03    0.2030E-04
    320.7258    0.7057E-03    0.2647E-04
    323.6288    0.9239E-03    0.3434E-04
    326.5410    0.1203E-02    0.4433E-04
    329.4613    0.1560E-02    0.5694E-04
    332.3882    0.2011E-02    0.7278E-04
    335.3203    0.2580E-02    0.9255E-04
    338.2562    0.3294E-02    0.1171E-03
    341.1944    0.4183E-02    0.1475E-03
    344.1330    0.5286E-02    0.1848E-03
    347.0704    0.6646E-02    0.2303E-03
    350.0046    0.8314E-02    0.2857E-03
    352.9337    0.1035E-01    0.3527E-03
    355.8556    0.1282E-01    0.4332E-03
    358.7683    0.1579E-01    0.5294E-03
    361.6694    0.1936E-01    0.6438E-03
    364.5565    0.2361E-01    0.7790E-03
    367.4272    0.2865E-01    0.9380E-03
    370.2788    0.3459E-01    0.1124E-02
    373.1088    0.4156E-01    0.1340E-02
    375.9142    0.4967E-01    0.1590E-02
    378.6923    0.5907E-01    0.1876E-02
    381.4399    0.6989E-01    0.2204E-02
    384.1540    0.8227E-01    0.2576E-02
    386.8314    0.9636E-01    0.2997E-02
    389.4689    0.1123E+00    0.3469E-02
    392.0630    0.1302E+00    0.3995E-02
    394.6103    0.1502E+00    0.4578E-02
    397.1074    0.1723E+00    0.5221E-02
    399.5507    0.1968E+00    0.5926E-02
    401.9367    0.2235E+00    0.6692E-02
    404.2616    0.2526E+00    0.7520E-02
    406.5220    0.2841E+00    0.8409E-02
    408.7141    0.3178E+00    0.9357E-02
    410.8344    0.3537E+00    0.1036E-01
    412.8793    0.3917E+00    0.1142E-01
    414.9101    0.4329E+00    0.1256E-01
    416.9662    0.4784E+00    0.1381E-01
    419.0479    0.5287E+00    0.1519E-01
    421.1556    0.5843E+00    0.1670E-01
    423.2897    0.6457E+00    0.1837E-01
    425.4506    0.7137E+00    0.2020E-01
    427.6385    0.7887E+00    0.2221E-01
    429.8540    0.8717E+00    0.2442E-01
    435.2429    0.1106E+01    0.3061E-01
    440.6600    0.1396E+01    0.3816E-01
    446.0967    0.1751E+01    0.4732E-01
    451.5439    0.2185E+01    0.5835E-01
    456.9909    0.2711E+01    0.7157E-01
    462.4262    0.3345E+01    0.8732E-01
    467.8367    0.4105E+01    0.1060E+00
    473.2085    0.5011E+01    0.1280E+00
    478.5263    0.6083E+01    0.1537E+00
    483.7736    0.7347E+01    0.1838E+00
    488.9328    0.8827E+01    0.2186E+00
    493.9850    0.1055E+02    0.2589E+00
    498.9102    0.1255E+02    0.3052E+00
    503.6871    0.1486E+02    0.3581E+00
    508.2933    0.1750E+02    0.4185E+00
    512.7048    0.2053E+02    0.4871E+00
    516.8961    0.2397E+02    0.5647E+00
    520.8398    0.2787E+02    0.6524E+00
    524.5063    0.3228E+02    0.7510E+00
    527.8631    0.3724E+02    0.8617E+00
    531.8966    0.4504E+02    0.1036E+01
    535.3488    0.5475E+02    0.1252E+01
    537.9048    0.6687E+02    0.1523E+01
    539.1107    0.8209E+02    0.1866E+01
    538.2987    0.1013E+03    0.2305E+01
    534.4547    0.1255E+03    0.2874E+01
    525.9621    0.1564E+03    0.3625E+01
    522.0429    0.1675E+03    0.3905E+01
    517.8064    0.1783E+03    0.4182E+01
    513.2952    0.1887E+03    0.4458E+01
    508.5464    0.1989E+03    0.4732E+01
    503.5934    0.2087E+03    0.5004E+01
    498.4657    0.2181E+03    0.5272E+01
    493.1902    0.2272E+03    0.5538E+01
    487.7914    0.2358E+03    0.5801E+01
    482.2913    0.2441E+03    0.6061E+01
    476.7103    0.2521E+03    0.6317E+01
    471.0667    0.2596E+03    0.6569E+01
    465.3775    0.2667E+03    0.6818E+01
    459.6579    0.2734E+03    0.7063E+01
    453.9218    0.2797E+03    0.7303E+01
    448.1818    0.2856E+03    0.7540E+01
    442.4494    0.2911E+03    0.7772E+01
    436.7347    0.2962E+03    0.7999E+01
    431.0469    0.3010E+03    0.8223E+01
    425.3940    0.3053E+03    0.8442E+01
    419.7833    0.3093E+03    0.8656E+01
    414.2209    0.3129E+03    0.8866E+01
    408.7122    0.3161E+03    0.9072E+01
    403.2617    0.3191E+03    0.9273E+01
    397.8733    0.3216E+03    0.9470E+01
    392.5500    0.3239E+03    0.9663E+01
    387.2942    0.3258E+03    0.9852E+01
    382.0379    0.3274E+03    0.1004E+02
    376.7143    0.3288E+03    0.1023E+02
    371.3183    0.3299E+03    0.1042E+02
    365.8427    0.3307E+03    0.1061E+02
    360.2784    0.3311E+03    0.1080E+02
    354.6136    0.3313E+03    0.1099E+02
    348.8328    0.3311E+03    0.1119E+02
    342.9153    0.3306E+03    0.1139E+02
    336.8332    0.3296E+03    0.1159E+02
    330.5478    0.3282E+03    0.1180E+02
    324.0036    0.3263E+03    0.1202E+02
    317.1145    0.3238E+03    0.1224E+02
    309.7443    0.3206E+03    0.1249E+02
    301.6363    0.3164E+03    0.1275E+02
    292.2243    0.3108E+03    0.1306E+02
    284.4179    0.3054E+03    0.1331E+02
    272.0585    0.2961E+03    0.1371E+02
    265.9509    0.2911E+03    0.1391E+02
    265.6858    0.2909E+03    0.1392E+02

  Number of critical points found:            0
    T(K)        P(bar)        D(mol/L)