Chromatography Object¶
You can define a Chromatography object by providing a tabulated data indexed by pressure.
In [1]:
Copied!
from pvtpy.compositional import Chromatography, properties_df, Component
from pvtpy.units import Pressure, Temperature
import numpy as np
import pandas as pd
from pvtpy.compositional import Chromatography, properties_df, Component
from pvtpy.units import Pressure, Temperature
import numpy as np
import pandas as pd
Pvtpy has built-in a dataframe with 64 components and its critical values. You can display the properties values with the properties_df
object which is a simple dataframe.
In [2]:
Copied!
print(properties_df.tail(20))
print(properties_df.tail(20))
id iupac_key \ name ammonia 53 QGZKDVFQNNGYKY-UHFFFAOYSA-N hydrogen 54 UFHFLCQGNIYNRP-UHFFFAOYSA-N oxygen 55 MYMOFIZGZYHOMD-UHFFFAOYSA-N nitrogen 56 IJGRMHOSHXDMSA-UHFFFAOYSA-N chlorine 57 KZBUYRJDOAKODT-UHFFFAOYSA-N water 58 XLYOFNOQVPJJNP-UHFFFAOYSA-N n-undecane 59 RSJKGSCJYJTIGS-UHFFFAOYSA-N n-dodecane 60 SNRUBQQJIBEYMU-UHFFFAOYSA-N n-tridecane 61 IIYFAKIEWZDVMP-UHFFFAOYSA-N n-tetradecane 62 BGHCVCJVXZWKCC-UHFFFAOYSA-N n-pentadecane 63 YCOZIPAWZNQLMR-UHFFFAOYSA-N n-hexadecane 64 DCAYPVUWAIABOU-UHFFFAOYSA-N n-heptadecane 65 NDJKXXJCMXVBJW-UHFFFAOYSA-N n-octadecane 66 RZJRJXONCZWCBN-UHFFFAOYSA-N n-nonadecane 67 LQERIDTXQFOHKA-UHFFFAOYSA-N n-eicosane 68 CBFCDTFDPHXCNY-UHFFFAOYSA-N n-heneicosane 69 FNAZRRHPUDJQCJ-UHFFFAOYSA-N n-docosane 70 HOWGUJZVBDQJKV-UHFFFAOYSA-N n-tricosane 71 FIGVVZUWCLSUEI-UHFFFAOYSA-N n-tetracosane 72 POOSGDOYLQNASK-UHFFFAOYSA-N iupac cas \ name ammonia 1S/H3N/h1H3 7664-41-7 hydrogen 1S/H2/h1H 1333-74-0 oxygen 1S/O2/c1-2 7782-44-7 nitrogen 1S/N2/c1-2 7727-37-9 chlorine 1S/Cl2/c1-2 7782-50-5 water 1S/H2O/h1H2 7732-18-5 n-undecane 1S/C11H24/c1-3-5-7-9-11-10-8-6-4-2/h3-11H2;1-2H3 1120-21-4 n-dodecane 1S/C12H26/c1-3-5-7-9-11-12-10-8-6-4-2/h3-12H2;... 112-40-3 n-tridecane 1S/C13H28/c1-3-5-7-9-11-13-12-10-8-6-4-2/h3-13... 629-50-5 n-tetradecane 1S/C14H30/c1-3-5-7-9-11-13-14-12-10-8-6-4-2/h3... 629-59-4 n-pentadecane 1S/C15H32/c1-3-5-7-9-11-13-15-14-12-10-8-6-4-2... 629-62-9 n-hexadecane 1S/C16H34/c1-3-5-7-9-11-13-15-16-14-12-10-8-6-... 544-76-3 n-heptadecane 1S/C17H36/c1-3-5-7-9-11-13-15-17-16-14-12-10-8... 629-78-7 n-octadecane 1S/C18H38/c1-3-5-7-9-11-13-15-17-18-16-14-12-1... 593-45-3 n-nonadecane 1S/C19H40/c1-3-5-7-9-11-13-15-17-19-18-16-14-1... 629-92-5 n-eicosane 1S/C20H42/c1-3-5-7-9-11-13-15-17-19-20-18-16-1... 112-95-8 n-heneicosane 1S/C21H44/c1-3-5-7-9-11-13-15-17-19-21-20-18-1... 629-94-7 n-docosane 1S/C22H46/c1-3-5-7-9-11-13-15-17-19-21-22-20-1... 629-97-0 n-tricosane 1S/C23H48/c1-3-5-7-9-11-13-15-17-19-21-23-22-2... 638-67-5 n-tetracosane 1S/C24H50/c1-3-5-7-9-11-13-15-17-19-21-23-24-2... 646-31-1 acentric_factor formula molecular_weight critical_pressure \ name ammonia NaN NH3 17.0305 1646.0 hydrogen -0.2150 H2 2.0159 188.1 oxygen 0.0218 O2 31.9988 731.4 nitrogen 0.0403 N2 28.0134 493.1 chlorine NaN CL2 70.9060 1157.0 water 0.3449 H2O 18.0153 3198.8 n-undecane 0.5303 C11H24 146.3120 1949.0 n-dodecane 0.5764 C12H26 170.3380 1820.0 n-tridecane 0.6174 C13H28 184.3650 1680.0 n-tetradecane 0.6430 C14H30 198.3920 1570.0 n-pentadecane 0.6863 C15H32 212.4190 1480.0 n-hexadecane 0.7174 C16H34 226.4460 1400.0 n-heptadecane 0.7697 C17H36 240.4730 1340.0 n-octadecane 0.8114 C18H38 254.5000 1270.0 n-nonadecane 0.8522 C19H40 268.5270 1210.0 n-eicosane 0.9069 C20H42 282.5530 1160.0 n-heneicosane 0.9220 C21H44 296.5800 1147.0 n-docosane 0.9550 C22H46 310.6100 1101.0 n-tricosane 0.9890 C23H48 324.6300 1059.0 n-tetracosane 1.0190 C24H50 338.6800 1019.0 critical_pressure_unit critical_temperature \ name ammonia psi 270.20 hydrogen psi -399.90 oxygen psi -181.43 nitrogen psi -232.51 chlorine psi 290.75 water psi 705.16 n-undecane kpa 639.00 n-dodecane kpa 658.00 n-tridecane kpa 675.00 n-tetradecane kpa 693.00 n-pentadecane kpa 708.00 n-hexadecane kpa 723.00 n-heptadecane kpa 736.00 n-octadecane kpa 747.00 n-nonadecane kpa 758.00 n-eicosane kpa 768.00 n-heneicosane kpa 781.70 n-docosane kpa 791.80 n-tricosane kpa 801.30 n-tetracosane kpa 810.40 critical_temperature_unit antoine_a antoine_b antoine_c name ammonia farenheit 4.868860 113.928 -10.409 hydrogen farenheit 3.543140 99.395 7.726 oxygen farenheit 3.952300 340.024 -4.144 nitrogen farenheit 3.736200 264.651 -6.788 chlorine farenheit 4.288140 969.992 -12.791 water farenheit 5.402210 1838.675 -31.737 n-undecane kelvin 4.101640 1572.477 -85.128 n-dodecane kelvin 4.105490 1625.928 -92.839 n-tridecane kelvin 4.128290 1689.093 -98.866 n-tetradecane kelvin 4.137350 1739.623 -105.616 n-pentadecane kelvin 4.149350 1789.658 -111.859 n-hexadecane kelvin 4.173120 1845.672 -117.054 n-heptadecane kelvin 3.927300 1718.004 -138.126 n-octadecane kelvin 4.332090 2068.963 -111.927 n-nonadecane kelvin 30.428160 28197.488 452.785 n-eicosane kelvin NaN NaN NaN n-heneicosane kelvin 5.920730 3571.218 -19.953 n-docosane kelvin NaN NaN NaN n-tricosane kelvin 6.557006 4200.069 1.864 n-tetracosane kelvin 5.738300 3464.273 -55.121
Having the properties table, you can build a custom Chromatography table by providing the componets id, name or symbol and the mole fraction
Construct by its name
In [3]:
Copied!
d = {
'comp': ['methane','ethane','propane','isobutane'],
'mole_fraction':[0.90,0.07,0.02,0.06]
}
cc = pd.DataFrame(d)
ch = Chromatography()
ch.from_df(cc,name='comp')
d = {
'comp': ['methane','ethane','propane','isobutane'],
'mole_fraction':[0.90,0.07,0.02,0.06]
}
cc = pd.DataFrame(d)
ch = Chromatography()
ch.from_df(cc,name='comp')
In [4]:
Copied!
ch.df()
ch.df()
Out[4]:
acentric_factor | cas | critical_pressure | critical_temperature | formula | id | iupac | iupac_key | mole_fraction | molecular_weight | peng_robinson | redlich_kwong | soave_redlich_kwong | van_der_walls | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
methane | 0.0115 | 74-82-8 | 666.4 | -116.67 | CH4 | 1.0 | 1S/CH4/h1H4 | VNWKTOKETHGBQD-UHFFFAOYSA-N | 0.857143 | 16.0425 | {} | {} | {} | {} |
ethane | 0.0995 | 74-84-0 | 706.5 | 89.92 | C2H6 | 2.0 | 1S/C2H6/c1-2/h1-2H3 | OTMSDBZUPAUEDD-UHFFFAOYSA-N | 0.066667 | 30.0700 | {} | {} | {} | {} |
propane | 0.1523 | 74-98-6 | 616.0 | 206.06 | C3H8 | 3.0 | 1S/C3H8/c1-3-2/h3H2;1-2H3 | ATUOYWHBWRKTHZ-UHFFFAOYSA-N | 0.019048 | 44.0970 | {} | {} | {} | {} |
isobutane | 0.1770 | 75-28-5 | 527.9 | 274.46 | C4H10 | 4.0 | 1S/C4H10/c1-4(2)3/h4H;1-3H3 | NNPPMTNAJDCUHE-UHFFFAOYSA-N | 0.057143 | 58.1230 | {} | {} | {} | {} |
In [5]:
Copied!
ch.components[3].df()
ch.components[3].df()
Out[5]:
formula C4H10 iupac_key NNPPMTNAJDCUHE-UHFFFAOYSA-N iupac 1S/C4H10/c1-4(2)3/h4H;1-3H3 cas 75-28-5 molecular_weight 58.123 van_der_walls {} redlich_kwong {} soave_redlich_kwong {} peng_robinson {} mole_fraction 0.06 critical_pressure 527.9 critical_temperature 274.46 id 4.0 acentric_factor 0.177 Name: isobutane, dtype: object
By default, the mole_fraction provided is normalized to sum 1.
In [6]:
Copied!
ch.apparent_molecular_weight()
ch.apparent_molecular_weight()
Out[6]:
19.916638095238095
Example 5-1 - Ahmed Tarek, Equation of State and PVT Analysis¶
In [7]:
Copied!
d1 = {
'comp': ['propane','isobutane','butane','isopentane','pentane','n-hexane'],
'mole_fraction':[0.2,0.1,0.1,0.2,0.2,0.2]
}
ch1 = Chromatography()
ch1.from_df(pd.DataFrame(d1),name='comp')
d1 = {
'comp': ['propane','isobutane','butane','isopentane','pentane','n-hexane'],
'mole_fraction':[0.2,0.1,0.1,0.2,0.2,0.2]
}
ch1 = Chromatography()
ch1.from_df(pd.DataFrame(d1),name='comp')
In [8]:
Copied!
ch1.vapor_pressure(Temperature(value=100, unit='farenheit'))
ch1.vapor_pressure(Temperature(value=100, unit='farenheit'))
Out[8]:
vapor_pressure | vapor_pressure_unit | |
---|---|---|
propane | 188.735859 | psi |
isobutane | 72.316273 | psi |
butane | 51.405353 | psi |
isopentane | 20.704631 | psi |
pentane | 15.573256 | psi |
n-hexane | 4.955708 | psi |
In [9]:
Copied!
p1 = Pressure(value=50, unit='psi')
t1 = Temperature(value=100, unit='farenheit')
flash_df,moles = ch1.flash_calculations(p1,t1, k_method='ideal')
flash_df
p1 = Pressure(value=50, unit='psi')
t1 = Temperature(value=100, unit='farenheit')
flash_df,moles = ch1.flash_calculations(p1,t1, k_method='ideal')
flash_df
Out[9]:
mole_fraction | xi | yi | k | |
---|---|---|---|---|
propane | 0.2 | 0.154158 | 0.581903 | 3.774717 |
isobutane | 0.1 | 0.095435 | 0.138030 | 1.446325 |
butane | 0.1 | 0.099700 | 0.102502 | 1.028107 |
isopentane | 0.2 | 0.213400 | 0.088367 | 0.414093 |
pentane | 0.2 | 0.215934 | 0.067256 | 0.311465 |
n-hexane | 0.2 | 0.221373 | 0.021941 | 0.099114 |
In [10]:
Copied!
flash_df[['xi','yi']].sum()
flash_df[['xi','yi']].sum()
Out[10]:
xi 1.0 yi 1.0 dtype: float64
Equilibrium ratio correlation¶
Component Class¶
Pvtpy provides a class for each Component storing their attritutes and applying some methods.
Example 5-2 - Ahmed Tarek, Equation of State and PVT Analysis¶
In [11]:
Copied!
d2 = {
'comp': ['carbon-dioxide','nitrogen','methane','ethane','propane','isobutane','butane','isopentane','pentane','n-hexane'],
'mole_fraction':[0.009,0.003,0.535,0.115,0.088,0.023,0.023,0.015,0.015,0.015]
}
c7_plus = Component(
name = 'C7+',
molecular_weight=150.0,
specific_gravity = 0.78,
critical_temperature = 1139.4,
critical_temperature_unit = 'rankine',
critical_pressure = 320.3,
critical_pressure_unit = 'psi',
mole_fraction=0.005,
params = {'acentric_factor':0.5067}
)
ch2 = Chromatography()
ch2.from_df(pd.DataFrame(d2),name='comp')
ch2.plus_fraction = c7_plus
d2 = {
'comp': ['carbon-dioxide','nitrogen','methane','ethane','propane','isobutane','butane','isopentane','pentane','n-hexane'],
'mole_fraction':[0.009,0.003,0.535,0.115,0.088,0.023,0.023,0.015,0.015,0.015]
}
c7_plus = Component(
name = 'C7+',
molecular_weight=150.0,
specific_gravity = 0.78,
critical_temperature = 1139.4,
critical_temperature_unit = 'rankine',
critical_pressure = 320.3,
critical_pressure_unit = 'psi',
mole_fraction=0.005,
params = {'acentric_factor':0.5067}
)
ch2 = Chromatography()
ch2.from_df(pd.DataFrame(d2),name='comp')
ch2.plus_fraction = c7_plus
In [12]:
Copied!
ch2.df(temperature_unit='rankine')
ch2.df(temperature_unit='rankine')
Out[12]:
acentric_factor | cas | critical_pressure | critical_temperature | formula | id | iupac | iupac_key | mole_fraction | molecular_weight | peng_robinson | redlich_kwong | soave_redlich_kwong | van_der_walls | specific_gravity | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
carbon-dioxide | 0.2276 | 124-38-9 | 1071.0 | 547.58 | CO2 | 50.0 | 1S/CO2/c2-1-3 | CURLTUGMZLYLDI-UHFFFAOYSA-N | 0.010638 | 44.0100 | {} | {} | {} | {} | NaN |
nitrogen | 0.0403 | 7727-37-9 | 493.1 | 227.16 | N2 | 56.0 | 1S/N2/c1-2 | IJGRMHOSHXDMSA-UHFFFAOYSA-N | 0.003546 | 28.0134 | {} | {} | {} | {} | NaN |
methane | 0.0115 | 74-82-8 | 666.4 | 343.00 | CH4 | 1.0 | 1S/CH4/h1H4 | VNWKTOKETHGBQD-UHFFFAOYSA-N | 0.632388 | 16.0425 | {} | {} | {} | {} | NaN |
ethane | 0.0995 | 74-84-0 | 706.5 | 549.59 | C2H6 | 2.0 | 1S/C2H6/c1-2/h1-2H3 | OTMSDBZUPAUEDD-UHFFFAOYSA-N | 0.135934 | 30.0700 | {} | {} | {} | {} | NaN |
propane | 0.1523 | 74-98-6 | 616.0 | 665.73 | C3H8 | 3.0 | 1S/C3H8/c1-3-2/h3H2;1-2H3 | ATUOYWHBWRKTHZ-UHFFFAOYSA-N | 0.104019 | 44.0970 | {} | {} | {} | {} | NaN |
isobutane | 0.1770 | 75-28-5 | 527.9 | 734.13 | C4H10 | 4.0 | 1S/C4H10/c1-4(2)3/h4H;1-3H3 | NNPPMTNAJDCUHE-UHFFFAOYSA-N | 0.027187 | 58.1230 | {} | {} | {} | {} | NaN |
butane | 0.2002 | 106-97-8 | 550.6 | 765.29 | C4H10 | 5.0 | 1S/C4H10/c1-3-4-2/h3-4H2;1-2H3 | IJDNQMDRQITEOD-UHFFFAOYSA-N | 0.027187 | 58.1230 | {} | {} | {} | {} | NaN |
isopentane | 0.2275 | 78-78-4 | 490.4 | 828.77 | C5H12 | 6.0 | 1S/C5H12/c1-4-5(2)3/h5H;4H2;1-3H3 | QWTDNUCVQCZILF-UHFFFAOYSA-N | 0.017730 | 72.1500 | {} | {} | {} | {} | NaN |
pentane | 0.2515 | 109-66-0 | 488.6 | 845.47 | C5H12 | 7.0 | 1S/C5H12/c1-3-5-4-2/h3-5H2;1-2H3 | OFBQJSOFQDEBGM-UHFFFAOYSA-N | 0.017730 | 73.1500 | {} | {} | {} | {} | NaN |
n-hexane | 0.3013 | 110-54-3 | 436.9 | 913.27 | C6H14 | 9.0 | 1S/C6H14/c1-3-5-6-4-2/h3-6H2;1-2H3 | VLKZOEOYAKHREP-UHFFFAOYSA-N | 0.017730 | 86.1770 | {} | {} | {} | {} | NaN |
C7+ | 0.5067 | NaN | 320.3 | 1139.40 | NaN | NaN | NaN | NaN | 0.005910 | 150.0000 | {} | {} | {} | {} | 0.78 |
In [13]:
Copied!
t2 = Temperature(value=150, unit='farenheit')
p2 = Pressure(value=1000, unit='psi')
t2 = Temperature(value=150, unit='farenheit')
p2 = Pressure(value=1000, unit='psi')
In [14]:
Copied!
ch2.equilibrium_ratios(p2,t2)
ch2.equilibrium_ratios(p2,t2)
Out[14]:
carbon-dioxide 2.095845 nitrogen 16.410130 methane 7.170587 ethane 1.264162 propane 0.348719 isobutane 0.145274 butane 0.106260 isopentane 0.045894 pentane 0.036316 n-hexane 0.013462 C7+ 0.000283 Name: k, dtype: float64
In [15]:
Copied!
f2 = ch2.flash_calculations(p2,t2,k_method='wilson')
f2
f2 = ch2.flash_calculations(p2,t2,k_method='wilson')
f2
Out[15]:
( mole_fraction xi yi k carbon-dioxide 0.010638 0.005513 0.011554 2.095845 nitrogen 0.003546 0.000252 0.004135 16.410130 methane 0.632388 0.101424 0.727270 7.170587 ethane 0.135934 0.111047 0.140381 1.264162 propane 0.104019 0.232467 0.081065 0.348719 isobutane 0.027187 0.098913 0.014369 0.145274 butane 0.027187 0.112455 0.011949 0.106260 isopentane 0.017730 0.093053 0.004271 0.045894 pentane 0.017730 0.097198 0.003530 0.036316 n-hexane 0.017730 0.108758 0.001464 0.013462 C7+ 0.005910 0.038922 0.000011 0.000283, {'liquid_moles': 0.1516065503028332, 'gas_moles': 0.8483934496971668})
Convergence Pressure¶
In [16]:
Copied!
ch2.convergence_pressure(t2.convert_to('rankine'), method='rzasa')
ch2.convergence_pressure(t2.convert_to('rankine'), method='rzasa')
Out[16]:
6340.447020009115
In [17]:
Copied!
ch2.equilibrium_ratios(p2,t2,method='whitson', pk_method='rzasa')
ch2.equilibrium_ratios(p2,t2,method='whitson', pk_method='rzasa')
Out[17]:
carbon-dioxide 2.840011 nitrogen 12.640159 methane 6.932466 ethane 1.968014 propane 0.773084 isobutane 0.409564 butane 0.326424 isopentane 0.177522 pentane 0.149794 n-hexane 0.072913 C7+ 0.004429 Name: k, dtype: float64
Dew point example¶
Example 5-4 - Ahmed Tarek, Equation of State and PVT Analysis
In [18]:
Copied!
d3 = {
'comp': ['methane','ethane','propane','isobutane','butane','isopentane','pentane','n-hexane'],
'mole_fraction':[0.8,0.05,0.04,0.03,0.02,0.03,0.02,0.005]
}
c7_plus1 = Component(
name = 'C7+',
molecular_weight=140.0,
specific_gravity = 0.8,
mole_fraction=0.005,
)
ch3 = Chromatography()
ch3.from_df(pd.DataFrame(d3),name='comp')
ch3.plus_fraction = c7_plus1
ch3.df()['mole_fraction']
d3 = {
'comp': ['methane','ethane','propane','isobutane','butane','isopentane','pentane','n-hexane'],
'mole_fraction':[0.8,0.05,0.04,0.03,0.02,0.03,0.02,0.005]
}
c7_plus1 = Component(
name = 'C7+',
molecular_weight=140.0,
specific_gravity = 0.8,
mole_fraction=0.005,
)
ch3 = Chromatography()
ch3.from_df(pd.DataFrame(d3),name='comp')
ch3.plus_fraction = c7_plus1
ch3.df()['mole_fraction']
Out[18]:
methane 0.800 ethane 0.050 propane 0.040 isobutane 0.030 butane 0.020 isopentane 0.030 pentane 0.020 n-hexane 0.005 C7+ 0.005 Name: mole_fraction, dtype: float64
In [19]:
Copied!
t3 = Temperature(value=250, unit='farenheit')
t3 = Temperature(value=250, unit='farenheit')
In [20]:
Copied!
ch3.vapor_pressure(t3)
ch3.vapor_pressure(t3)
Out[20]:
vapor_pressure | vapor_pressure_unit | |
---|---|---|
methane | 10614.307094 | psi |
ethane | 2250.990986 | psi |
propane | 904.175597 | psi |
isobutane | 421.487433 | psi |
butane | 330.951526 | psi |
isopentane | 166.827670 | psi |
pentane | 133.257353 | psi |
n-hexane | 59.305130 | psi |
In [21]:
Copied!
ch3.convergence_pressure(t3, method='rzasa')
ch3.convergence_pressure(t3, method='rzasa')
Out[21]:
5036.176515953768
In [22]:
Copied!
ch2.dew_point(t3)
ch2.dew_point(t3)
Out[22]:
295.0081247904794
Bubble Point Example¶
Example 5-4 - Ahmed Tarek, Equation of State and PVT Analysis
In [23]:
Copied!
d4 = {
'comp': ['methane','ethane','propane','isobutane','butane','isopentane','pentane','n-hexane'],
'mole_fraction':[0.8,0.05,0.04,0.03,0.02,0.03,0.02,0.005]
}
c7_plus4 = Component(
name = 'C7+',
molecular_weight=216.0,
specific_gravity = 0.8605,
mole_fraction=0.005,
critical_pressure=140,
critical_pressure_unit='psi',
critical_temperature=1279.8,
critical_temperature_unit='rankine',
params = {'acentric_factor':0.6353}
)
ch4 = Chromatography()
ch4.from_df(pd.DataFrame(d4),name='comp')
ch4.plus_fraction = c7_plus4
ch4.df()['mole_fraction']
d4 = {
'comp': ['methane','ethane','propane','isobutane','butane','isopentane','pentane','n-hexane'],
'mole_fraction':[0.8,0.05,0.04,0.03,0.02,0.03,0.02,0.005]
}
c7_plus4 = Component(
name = 'C7+',
molecular_weight=216.0,
specific_gravity = 0.8605,
mole_fraction=0.005,
critical_pressure=140,
critical_pressure_unit='psi',
critical_temperature=1279.8,
critical_temperature_unit='rankine',
params = {'acentric_factor':0.6353}
)
ch4 = Chromatography()
ch4.from_df(pd.DataFrame(d4),name='comp')
ch4.plus_fraction = c7_plus4
ch4.df()['mole_fraction']
Out[23]:
methane 0.800 ethane 0.050 propane 0.040 isobutane 0.030 butane 0.020 isopentane 0.030 pentane 0.020 n-hexane 0.005 C7+ 0.005 Name: mole_fraction, dtype: float64
In [24]:
Copied!
t4 = Temperature(value=200, unit='farenheit')
t4 = Temperature(value=200, unit='farenheit')
In [25]:
Copied!
ch4.convergence_pressure(t4)
ch4.convergence_pressure(t4)
Out[25]:
8760.0
In [26]:
Copied!
ch4.bubble_point(t4, k_method='wilson', pk_method='rzasa', method='brentq',bracket=[10,10100])
ch4.bubble_point(t4, k_method='wilson', pk_method='rzasa', method='brentq',bracket=[10,10100])
guesss 7096.641782999256 10.0 10100.0 10096.287548921608 6353.178998245239 7740.9031051774045 7417.157990169664 7365.207328418204 7365.571197067084 7365.568666338099 7365.568666213941 7365.568666213945
Out[26]:
7365.568666213941
In [27]:
Copied!
df4 = ch4.df()
df4['k'] = ch4.equilibrium_ratios(
Pressure(value=7365.58783690, unit='psi'),
Temperature(value=200, unit='farenheit'),
method='whitson',
pk_method='rzasa'
)
df4['k']
df4 = ch4.df()
df4['k'] = ch4.equilibrium_ratios(
Pressure(value=7365.58783690, unit='psi'),
Temperature(value=200, unit='farenheit'),
method='whitson',
pk_method='rzasa'
)
df4['k']
Out[27]:
methane 1.319077 ethane 0.986706 propane 0.792710 isobutane 0.681919 butane 0.647810 isopentane 0.561147 pentane 0.540007 n-hexane 0.456459 C7+ 0.131417 Name: k, dtype: float64
In [28]:
Copied!
np.sum(df4['mole_fraction']*df4['k'])-1
np.sum(df4['mole_fraction']*df4['k'])-1
Out[28]:
0.20029267184443644
In [ ]:
Copied!
In [ ]:
Copied!