polykin.thermo.eos¤
RedlichKwong ¤
Redlich-Kwong equation of state.
This EOS is based on the following \(P(v,T)\) relationship:
where \(P\) is the pressure, \(T\) is the temperature, \(v\) is the molar volume, \(a_m(T,y)\) and \(b_m(y)\) are the mixture EOS parameters, and \(y\) is the vector of mole fractions.
For a single component, the parameters \(a\) and \(b\) are given by:
where \(T_c\) is the critical temperature, \(P_c\) is the critical pressure, and \(T_r = T/T_c\) is the reduced temperature.
References
- RC Reid, JM Prausniz, and BE Poling. The properties of gases & liquids 4th edition, 1986, p. 37, 40, 80, 82.
PARAMETER | DESCRIPTION |
---|---|
Tc
|
Critical temperatures of all components. Unit = K.
TYPE:
|
Pc
|
Critical pressures of all components. Unit = Pa.
TYPE:
|
k
|
Binary interaction parameter matrix.
TYPE:
|
Source code in src/polykin/thermo/eos/cubic.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
Bm ¤
Bm(T: float, y: FloatVector) -> float
Calculate the second virial coefficient of the mixture.
References
- RC Reid, JM Prausniz, and BE Poling. The properties of gases & liquids 4th edition, 1986, p. 82.
PARAMETER | DESCRIPTION |
---|---|
T
|
Temperature. Unit = K.
TYPE:
|
y
|
Mole fractions of all components. Unit = mol/mol.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
float
|
Mixture second virial coefficient, \(B_m\). Unit = m³/mol. |
Source code in src/polykin/thermo/eos/cubic.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
P ¤
P(T: float, v: float, y: FloatVector) -> float
Calculate the pressure of the fluid.
PARAMETER | DESCRIPTION |
---|---|
T
|
Temperature. Unit = K.
TYPE:
|
v
|
Molar volume. Unit = m³/mol.
TYPE:
|
y
|
Mole fractions of all components. Unit = mol/mol.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
float
|
Pressure. Unit = Pa. |
Source code in src/polykin/thermo/eos/cubic.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
Z ¤
Z(T: float, P: float, y: FloatVector) -> FloatVector
Calculate the compressibility factors of the coexisting phases a fluid.
The calculation is handled by
Z_cubic_roots
.
PARAMETER | DESCRIPTION |
---|---|
T
|
Temperature. Unit = K.
TYPE:
|
P
|
Pressure. Unit = Pa.
TYPE:
|
y
|
Mole fractions of all components. Unit = mol/mol.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
FloatVector
|
Compressibility factor of the vapor and/or liquid phases. |
Source code in src/polykin/thermo/eos/cubic.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
a
cached
¤
a(T: float) -> FloatVector
Calculate the attractive parameters of the pure-components that make up the mixture.
PARAMETER | DESCRIPTION |
---|---|
T
|
Temperature. Unit = K.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
FloatVector
|
Attractive parameters of all components, \(a_i\). Unit = J·m³. |
Source code in src/polykin/thermo/eos/cubic.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
am ¤
am(T: float, y: FloatVector) -> float
Calculate the mixture attractive parameter from the corresponding pure-component parameters.
References
- RC Reid, JM Prausniz, and BE Poling. The properties of gases & liquids 4th edition, 1986, p. 82.
PARAMETER | DESCRIPTION |
---|---|
T
|
Temperature. Unit = K.
TYPE:
|
y
|
Mole fractions of all components. Unit = mol/mol.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
float
|
Mixture attractive parameter, \(a_m\). Unit = J·m³. |
Source code in src/polykin/thermo/eos/cubic.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
b
cached
property
¤
b: FloatVector
Calculate the repulsive parameters of the pure-components that make up the mixture.
RETURNS | DESCRIPTION |
---|---|
FloatVector
|
Repulsive parameters of all components, \(b_i\). Unit = m³/mol. |
bm ¤
bm(y: FloatVector) -> float
Calculate the mixture repulsive parameter from the corresponding pure-component parameters.
References
- RC Reid, JM Prausniz, and BE Poling. The properties of gases & liquids 4th edition, 1986, p. 82.
PARAMETER | DESCRIPTION |
---|---|
y
|
Mole fractions of all components. Unit = mol/mol.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
float
|
Mixture repulsive parameter, \(b_m\). Unit = m³/mol. |
Source code in src/polykin/thermo/eos/cubic.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
fV ¤
fV(T: float, P: float, y: FloatVector) -> FloatVector
Calculate the fugacity of all components in the vapor phase.
\(\hat{f}_i\) is the fugacity in the vapor phase, \(\hat{\phi}_i(T,P,y)\) is the fugacity coefficient, \(P\) is the pressure, and \(y_i\) is the mole fraction in the vapor phase.
PARAMETER | DESCRIPTION |
---|---|
T
|
Temperature. Unit = K.
TYPE:
|
P
|
Pressure. Unit = Pa.
TYPE:
|
y
|
Mole fractions of all components. Unit = mol/mol.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
FloatVector
|
Fugacity coefficients of all components. |
Source code in src/polykin/thermo/eos/base.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
phiV ¤
phiV(T: float, P: float, y: FloatVector) -> FloatVector
Calculate the fugacity coefficients of all components in the vapor phase.
References
- RC Reid, JM Prausniz, and BE Poling. The properties of gases & liquids 4th edition, 1986, p. 145.
PARAMETER | DESCRIPTION |
---|---|
T
|
Temperature. Unit = K.
TYPE:
|
P
|
Pressure. Unit = Pa.
TYPE:
|
y
|
Mole fractions of all components. Unit = mol/mol.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
FloatVector
|
Fugacity coefficients of all components. |
Source code in src/polykin/thermo/eos/cubic.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
|
v ¤
v(T: float, P: float, y: FloatVector) -> FloatVector
Calculate the molar volumes of the coexisting phases a fluid.
where \(v\) is the molar volume, \(Z\) is the compressibility factor, \(T\) is the temperature, \(P\) is the pressure, and \(y\) is the mole fraction vector.
PARAMETER | DESCRIPTION |
---|---|
T
|
Temperature. Unit = K.
TYPE:
|
P
|
Pressure. Unit = Pa.
TYPE:
|
y
|
Mole fractions of all components. Unit = mol/mol.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
FloatVector
|
Molar volume of the vapor and/or liquid phases. Unit = m³/mol. |
Source code in src/polykin/thermo/eos/base.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
Z_cubic_roots ¤
Z_cubic_roots(
u: float, w: float, A: float, B: float
) -> FloatVector
Find the compressibility factor roots of a cubic EOS.
Equation | \(u\) | \(w\) |
---|---|---|
Redlich-Kwong | 1 | 0 |
Soave | 1 | 0 |
Peng-Robinson | 2 | -1 |
References
- RC Reid, JM Prausniz, and BE Poling. The properties of gases & liquids 4th edition, 1986, p. 42.
PARAMETER | DESCRIPTION |
---|---|
u
|
Parameter of polynomial equation.
TYPE:
|
w
|
Parameter of polynomial equation.
TYPE:
|
A
|
Parameter of polynomial equation.
TYPE:
|
B
|
Parameter of polynomial equation.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
FloatVector
|
Compressibility factor(s) of the coexisting phases. If there are two phases, the first result is the lowest value (liquid). |
Source code in src/polykin/thermo/eos/cubic.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
|
Examples¤
Estimate the compressibility factor of a 50 mol% ethylene/nitrogen gas mixture at 300 K and 100 bar.
from polykin.thermo.eos import RedlichKwong
import numpy as np
Tc = [282.4, 126.2] # K
Pc = [50.4e5, 33.9e5] # Pa
eos = RedlichKwong(Tc, Pc)
Z = eos.Z(T=300., P=100e5, y=np.array([0.5, 0.5]))
print(f"{Z[0]:.2f}")