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

Superancillary for cubics

parent f0f46e66
No related branches found
No related tags found
No related merge requests found
%% 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:
$$ \begin{equation}
\label{eq:alphar_from_psi}
\alpha^r = \psi^{(-)} - \dfrac{\tau a_m}{RT_r } \psi^{(+)}.
\end{equation}$$
$$ \begin{eqnarray}
\psi^{(-)} &=& \int_0^\delta\dfrac{b_m\rho_r }{1-b_m\delta\rho_r }{\rm d}\delta \label{eq:psiminusintegral}\\
&=&-\ln(1-b_m\rho ). \label{eq:psiminusresult}
\end{eqnarray} $$
$$ \begin{eqnarray}
\psi^{(+)} &=& \int_0^\delta \dfrac{\rho_r}{\left(1+\Delta_1 b_m\delta\rho_r \right)\left(1+\Delta_2 b_m\delta\rho_r \right)} {\rm d}\delta \label{eq:psiplusintegral}\\
&=& \dfrac{\ln\left(\dfrac{\Delta_1 b_m\rho+1}{\Delta_2b_m\rho+1}\right)}{b_m(\Delta_1-\Delta_2)}\label{eq:psiplusresult}
\end{eqnarray} $$
with the constants given by:
* vdW: $\Delta_1=0$, $\Delta_2=0$
* SRK: $\Delta_1=1$, $\Delta_2=0$
* PR: $\Delta_1=1+\sqrt{2}$, $\Delta_2=1-\sqrt{2}$
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:code id:9a884dab tags:
``` python
import teqp
# 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: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)
```
%% Output
<teqp.teqp.GenericCubic at 0x20b222799b0>
<teqp.teqp.GenericCubic at 0x18f604c3a70>
%% 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
%% Cell type:code id:1b02ef72 tags:
``` python
teqp.canonical_PR([Tc_K[0]], [pc_Pa[0]], [acentric[0]]).superanc_rhoLV(100)
```
%% Output
(30846.392909514052, 42.480231719002326)
......
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