"# And you can get information about the model in JSON format \n",
"# from the get_meta function\n",
"modelPR.get_meta()"
]
},
{
"cell_type": "markdown",
"id": "615c7830",
...
...
@@ -142,7 +154,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
"version": "3.10.6"
}
},
"nbformat": 4,
...
...
%% Cell type:markdown id:df447d16 tags:
# General cubics
The reduced residual Helmholtz energy for the main cubic EOS (van der Waals, Peng-Robinson, and Soave-Redlich-Kwong) can be written in a common form (see https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7365965/)
The quantities $a_m$ and $b_m$ are described (with exact solutions for the numerical coefficients) for each of these EOS in https://pubs.acs.org/doi/abs/10.1021/acs.iecr.1c00847.
The models in teqp are instantiated based on knowledge of the critical temperature, pressure, and acentric factor. Thereafter all quantities are obtained from derivatives of $\alpha^r$.
%% Cell type:raw id:a65e7316 tags:
The Python class is here: :py:class:`GeneralizedCubic <teqp.teqp.GeneralizedCubic>`
%% Cell type:code id:9a884dab tags:
``` python
importteqp
importteqp,json
# 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]
# Instantiate Peng-Robinson model
modelPR=teqp.canonical_PR(Tc_K,pc_Pa,acentric)
# Instantiate Soave-Redlich-Kwong model
modelSRK=teqp.canonical_SRK(Tc_K,pc_Pa,acentric)
```
%% Cell type:code id:75961e5b tags:
``` python
# And you can get information about the model in JSON format
# from the get_meta function
modelPR.get_meta()
```
%% Cell type:markdown id:615c7830 tags:
## Adjusting k_ij
Fine-tuned values of $k_{ij}$ can be provided when instantiating the model, for Peng-Robinson and SRK. A complete matrix of all the $k_{ij}$ values must be provided. This allows for asymmetric mixing models in which $k_{ij}\neq k_{ji}$.
%% Cell type:code id:a8c87890 tags:
``` python
k_12=0.01
kmat=[[0,k_12,0],[k_12,0,0],[0,0,0]]
teqp.canonical_PR(Tc_K,pc_Pa,acentric,kmat)
teqp.canonical_SRK(Tc_K,pc_Pa,acentric,kmat)
```
%% Cell type:markdown id:c3a62795 tags:
## Superancillary
The superancillary equation gives the co-existing liquid and vapor (orthobaric) densities as a function of temperature. The set of Chebyshev expansions was developed in https://pubs.acs.org/doi/abs/10.1021/acs.iecr.1c00847 . These superancillary equations are more accurate than iterative calculations in double precision arithmetic and also at least 10 times faster to calculate, and cannot fail in iterative routines, even extremely close to the critical point.
The superancillary equation is only exposed for pure fluids to remove ambiguity when considering mixtures. The returned tuple is the liquid and vapor densities
For the cubic EOS, it can be useful to obtain the a and b parameters directly. The b parameter is particularly useful because 1/b is the maximum allowed density in the EOS