Skip to content
Snippets Groups Projects
Commit 402164ad authored by Ian Bell's avatar Ian Bell
Browse files

Fix superancillary implementation, update check notebook

parent 98072740
No related branches found
No related tags found
No related merge requests found
......@@ -77,8 +77,8 @@ public:
auto b = get_b(T, z);
auto Ttilde = R(z)*T*b/get_a(T,z);
return std::make_tuple(
CubicSuperAncillary::supercubic(superanc_index, CubicSuperAncillary::RHOL_CODE, Ttilde)*b,
CubicSuperAncillary::supercubic(superanc_index, CubicSuperAncillary::RHOV_CODE, Ttilde)*b
CubicSuperAncillary::supercubic(superanc_index, CubicSuperAncillary::RHOL_CODE, Ttilde)/b,
CubicSuperAncillary::supercubic(superanc_index, CubicSuperAncillary::RHOV_CODE, Ttilde)/b
);
}
......
%% Cell type:markdown id: tags:
# Check Cubic EOS
The values will not be precisely the same because Bell and Jager, JRN, 2016 used the conventional truncated values for $\Omega_a$ and $\Omega_b$ while teqp uses the exact values from Bell and Deiters, IECR, 2021
%% Cell type:code id: tags:
``` python
%matplotlib inline
import matplotlib.pyplot as plt, numpy as np
import matplotlib as mpl
mpl.rcParams['figure.dpi']= 100
import teqp
```
%% Cell type:code id: tags:
``` python
# Values taken from http://dx.doi.org/10.6028/jres.121.011
Tc_K = [190.564, 154.581, 150.687]
pc_Pa = [4599200, 5042800, 4863000]
acentric = [0.011, 0.022, -0.002]
z = np.array([0.5, 0.3, 0.2]) # mole fractions
```
%% Cell type:code id: tags:
``` python
model = teqp.canonical_PR(Tc_K, pc_Pa, acentric)
T = 800 # K
rho = 5000 # mol/m^3
print(model.get_Ar01(T, rho, z), 9.6019116018396e-002)
print(model.get_Ar02n(T, rho, z)[2], 2.3611667278971e-002)
print(model.get_Ar03n(T, rho, z)[3], 1.7433108161805e-003)
model.get_meta()
```
%% Output
0.0960116460031759 0.096019116018396
0.02360946208541689 0.023611667278971
0.0017427456394558435 0.0017433108161805
{'Delta1': 2.414213562373095,
'Delta2': -0.41421356237309515,
'OmegaA': 0.4572355289213822,
'OmegaB': 0.07779607390388846,
'kind': 'Peng-Robinson'}
%% Cell type:code id: tags:
``` python
model = teqp.canonical_SRK(Tc_K, pc_Pa, acentric)
T = 800 # K
rho = 5000 # mol/m^3
print(model.get_Ar01(T, rho, z), 1.2741566551477e-001)
print(model.get_Ar02n(T, rho, z)[2], 2.4895937945147e-002)
print(model.get_Ar03n(T, rho, z)[3], 6.0986538256190e-003)
model.get_meta()
```
%% Output
0.12741589269633935 0.12741566551477
0.024896233252879204 0.024895937945147
0.006098736292510815 0.006098653825619
{'Delta1': 1.0,
'Delta2': 0.0,
'OmegaA': 0.4274802335403417,
'OmegaB': 0.08664034996495766,
'kind': 'Soave-Redlich-Kwong'}
%% Cell type:code id: tags:
``` python
model = teqp.canonical_PR([Tc_K[0]], [pc_Pa[0]], [acentric[0]])
print(model.get_meta())
[rhoL, rhoV ] = model.superanc_rhoLV(150)
import CoolProp.CoolProp as CP
[rhoL, rhoV], CP.PropsSI('Dmolar','T',150,'Q',[0,1],'PR::METHANE').tolist()
```
%% Output
{'Delta1': 2.414213562373095, 'Delta2': -0.41421356237309515, 'OmegaA': 0.4572355289213822, 'OmegaB': 0.07779607390388846, 'kind': 'Peng-Robinson'}
([24221.746187758014, 1030.361868803444],
[24222.536725733073, 1029.779329419418])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment