Gas Model¶
from pvtpy.pvt import PVT
import pvtpy.black_oil as bk
from pvtpy.fluids import Gas, InitialConditions
from pvtpy.pvt import PVT
from pvtpy.compositional import Chromatography
from pvtpy.units import Pressure, Temperature
import numpy as np
import pandas as pd
import seaborn as sns
Create a chromatography composition¶
composition_dict = {
'mole_fraction':[0.0194,0.004,0.9598,0.0023,0.0057,0.0062,0.0006,0.0003,0.0001,0.0005,0.001,0.0001],
'compound':['carbon-dioxide','nitrogen','methane','ethane','propane','isobutane','n-butane','isopentane','n-pentane','n-hexane','n-heptane','n-octane']
}
chr = Chromatography.from_df(pd.DataFrame(composition_dict), name='compound', mole_fraction='mole_fraction')
chr.df()
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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
carbon-dioxide | 0.2276 | 124-38-9 | 1071.0 | 87.91 | CO2 | 50.0 | 1S/CO2/c2-1-3 | CURLTUGMZLYLDI-UHFFFAOYSA-N | 0.019414 | 44.0100 | {} | {} | {} | {} |
nitrogen | 0.0403 | 7727-37-9 | 493.1 | -232.51 | N2 | 56.0 | 1S/N2/c1-2 | IJGRMHOSHXDMSA-UHFFFAOYSA-N | 0.004003 | 28.0134 | {} | {} | {} | {} |
methane | 0.0115 | 74-82-8 | 666.4 | -116.67 | CH4 | 1.0 | 1S/CH4/h1H4 | VNWKTOKETHGBQD-UHFFFAOYSA-N | 0.960472 | 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.002302 | 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.005704 | 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.006204 | 58.1230 | {} | {} | {} | {} |
isopentane | 0.2275 | 78-78-4 | 490.4 | 369.10 | C5H12 | 6.0 | 1S/C5H12/c1-4-5(2)3/h5H;4H2;1-3H3 | QWTDNUCVQCZILF-UHFFFAOYSA-N | 0.000300 | 72.1500 | {} | {} | {} | {} |
n-hexane | 0.3013 | 110-54-3 | 436.9 | 453.60 | C6H14 | 9.0 | 1S/C6H14/c1-3-5-6-4-2/h3-6H2;1-2H3 | VLKZOEOYAKHREP-UHFFFAOYSA-N | 0.000500 | 86.1770 | {} | {} | {} | {} |
n-heptane | 0.3495 | 142-82-5 | 396.8 | 512.70 | C7H16 | 14.0 | 1S/C7H16/c1-3-5-7-6-4-2/h3-7H2;1-2H3 | IMNFDUFMRHMDMM-UHFFFAOYSA-N | 0.001001 | 100.2040 | {} | {} | {} | {} |
n-octane | 0.3996 | 111-65-9 | 360.7 | 564.22 | C8H18 | 22.0 | 1S/C8H18/c1-3-5-7-8-6-4-2/h3-8H2;1-2H3 | TVMXDCGIABBOFY-UHFFFAOYSA-N | 0.000100 | 114.2310 | {} | {} | {} | {} |
Estimate some properties¶
Apparent Molecular Weigt¶
The apparent Molecular Weight (ma) is calculated by summing the product of molar fraction and molecular weight of each component in the chromatography
chr.apparent_molecular_weight()
17.23273911738217
Gas specific gravity¶
The Gas specific gravity is calculated by diving the ma by the specific gravity of the air
chr.gas_sg()
0.5950531463184451
Pseudo critical properties¶
The Pseudo critical properties are calulated by summing the product of mole fraction and critical properties (pressure and temperature). By default it corrects the properties by Non-hydrocarbon components with the wichert-aziz correlation.
chr.get_pseudo_critical_properties()
CriticalProperties(critical_pressure=Pressure(value=665.8662951011108, unit=<PressureUnits.psi: 'psi'>), critical_temperature=Temperature(value=-110.52626724778492, unit=<TemperatureUnits.farenheit: 'farenheit'>))
chr.get_pseudo_critical_properties(correct=False)
CriticalProperties(critical_pressure=Pressure(value=672.0385169618734, unit=<PressureUnits.psi: 'psi'>), critical_temperature=Temperature(value=352.38010707495243, unit=<TemperatureUnits.rankine: 'rankine'>))
chr.get_pseudo_critical_properties(correct_method='carr_kobayashi_burrows')
CriticalProperties(critical_pressure=Pressure(value=679.9000200140099, unit=<PressureUnits.psi: 'psi'>), critical_temperature=Temperature(value=-109.84368057640353, unit=<TemperatureUnits.farenheit: 'farenheit'>))
Get the compressibility factor of gas¶
Estimate the compressibility factor by estimating the critical properties and applying the default correlation method papay
chr.get_z(
pressure=Pressure(value = 1500, unit='psi'),
temperature=Temperature(value = 560, unit='farenheit'),
)
z | |
---|---|
pressure | |
1500.0 | 0.994968 |
p_range = np.linspace(1000,5000,10)
chr.get_z(pressure=Pressure(value=p_range), temperature=Temperature(value=180, unit='farenheit'))
z | |
---|---|
pressure | |
1000.000000 | 0.935595 |
1444.444444 | 0.919677 |
1888.888889 | 0.911579 |
2333.333333 | 0.911301 |
2777.777778 | 0.918843 |
3222.222222 | 0.934204 |
3666.666667 | 0.957385 |
4111.111111 | 0.988385 |
4555.555556 | 1.027205 |
5000.000000 | 1.073845 |
Get the gas density in lb/ft3¶
Estimate the gas density by estimating the ma, the z factor and finnaly applying the gas equation of state for real gases
chr.get_rhog(
pressure=Pressure(value=300, unit='psi'),
temperature=Temperature(value=180, unit='farenheit')
)
rhog | |
---|---|
pressure | |
300.0 | 0.771326 |
chr.get_rhog(
pressure=Pressure(value=1300, unit='psi'),
temperature=Temperature(value=180, unit='farenheit'),
rhog_method='ideal_gas')
rhog | |
---|---|
pressure | |
1300.0 | 3.263938 |
chr.get_rhog(
pressure=Pressure(value=np.linspace(1000,5000,10)),
temperature=Temperature(value=180, unit='farenheit'),
rhog_method='real_gas'
)
rhog | |
---|---|
pressure | |
1000.000000 | 2.683557 |
1444.444444 | 3.943338 |
1888.888889 | 5.202481 |
2333.333333 | 6.428556 |
2777.777778 | 7.590229 |
3222.222222 | 8.659890 |
3666.666667 | 9.615758 |
4111.111111 | 10.443151 |
4555.555556 | 11.134805 |
5000.000000 | 11.690333 |
Estimate the Specific volume of Gas.¶
Get the specific volume by estimate the inverse of the density
chr.get_sv(
pressure=Pressure(value=np.linspace(1000,5000,10)),
temperature=Temperature(value=180, unit='farenheit'),
rhog_method='real_gas'
)
pressure 1000.000000 0.372640 1444.444444 0.253592 1888.888889 0.192216 2333.333333 0.155556 2777.777778 0.131748 3222.222222 0.115475 3666.666667 0.103996 4111.111111 0.095757 4555.555556 0.089808 5000.000000 0.085541 Name: sv, dtype: float64
chr.get_sv( pressure=Pressure(value=np.linspace(1000,5000,10)),
temperature=Temperature(value=180, unit='farenheit'),
rhog_method='real_gas')
pressure 1000.000000 0.372640 1444.444444 0.253592 1888.888889 0.192216 2333.333333 0.155556 2777.777778 0.131748 3222.222222 0.115475 3666.666667 0.103996 4111.111111 0.095757 4555.555556 0.089808 5000.000000 0.085541 Name: sv, dtype: float64
chr.gas_sg()
0.5950531463184451
Create the Gas object¶
init = InitialConditions(pressure=Pressure(value=3600), temperature=Temperature(value=160))
gas1 = Gas.pvt_from_correlations(
initial_conditions=init,
gas_type='natural_gas',
sg=0.59,
chromatography=chr
)
gas1.pseudo_critical_properties()
CriticalProperties(critical_pressure=Pressure(value=672.79625, unit=<PressureUnits.psi: 'psi'>), critical_temperature=Temperature(value=355.39875, unit=<TemperatureUnits.rankine: 'rankine'>))
gas1.pvt.df()
z | rhog | bg | mug | cg | |
---|---|---|---|---|---|
pressure | |||||
20.000000 | 0.998092 | 0.051934 | 0.155550 | 0.013007 | 0.050000 |
282.105263 | 0.974719 | 0.750112 | 0.010770 | 0.013181 | 0.003545 |
544.210526 | 0.954374 | 1.477890 | 0.005466 | 0.013451 | 0.001838 |
806.315789 | 0.937058 | 2.230143 | 0.003622 | 0.013794 | 0.001240 |
1068.421053 | 0.922771 | 3.000839 | 0.002692 | 0.014201 | 0.000936 |
1330.526316 | 0.911512 | 3.783165 | 0.002135 | 0.014668 | 0.000752 |
1592.631579 | 0.903281 | 4.569686 | 0.001768 | 0.015189 | 0.000628 |
1854.736842 | 0.898079 | 5.352561 | 0.001509 | 0.015761 | 0.000539 |
2116.842105 | 0.895906 | 6.123788 | 0.001319 | 0.016375 | 0.000472 |
2378.947368 | 0.896761 | 6.875467 | 0.001175 | 0.017026 | 0.000420 |
2641.052632 | 0.900645 | 7.600071 | 0.001063 | 0.017702 | 0.000379 |
2903.157895 | 0.907557 | 8.290695 | 0.000974 | 0.018394 | 0.000344 |
3165.263158 | 0.917498 | 8.941267 | 0.000903 | 0.019091 | 0.000316 |
3427.368421 | 0.930467 | 9.546717 | 0.000846 | 0.019780 | 0.000292 |
3689.473684 | 0.946464 | 10.103091 | 0.000800 | 0.020449 | 0.000271 |
3951.578947 | 0.965491 | 10.607590 | 0.000762 | 0.021087 | 0.000253 |
4213.684211 | 0.987545 | 11.058572 | 0.000731 | 0.021684 | 0.000237 |
4475.789474 | 1.012629 | 11.455487 | 0.000705 | 0.022230 | 0.000223 |
4737.894737 | 1.040740 | 11.798779 | 0.000685 | 0.022719 | 0.000211 |
5000.000000 | 1.071881 | 12.089759 | 0.000668 | 0.023146 | 0.000200 |
print(gas1.to_ecl())
-- GAS PVT TABLE FOR LIVE OIL PVDG -- pres bg vic -- psi Rb/Mscf cP -- ---- ---- ---- 20.000 155.550 0.013 573.333 5.261 0.013 1126.667 2.568 0.014 1680.000 1.682 0.015 2233.333 1.255 0.017 2786.667 1.014 0.018 3340.000 0.865 0.020 3893.333 0.770 0.021 4446.667 0.708 0.022 5000.000 0.668 0.023/