IAPWS equation of state

ReducedStateIAPWS

class simu.app.thermo.contributions.iapws.standard.ReducedStateIAPWS

Bases: ThermoContribution

In the IAPWS EOS, all contributions are expressed in terms of

\[\tau_i = \frac{T_{c,i}}{T} \quad\text{and}\quad \varrho_i = \frac{\rho_i}{\rho_{c,i}} = \frac{M_i\,n_i}{V\,\rho_{c,i}}\]

There is no limitation at this point to pure species models. The contribution simply calculates the dimensionless temperatures and mole-densities for all species in vector form.

This contribution is part of the EOS as described in [WPrus02], section 6.2.

It relies on prior definition of molecular weight mw, as the volumetric terms are implemented as density. The following parameters need to be provided as species vectors:

Property

Symbol

Description

T_c

\(T_c\)

Critical temperatures [K]

rho_c

\(\rho_c\)

Critical density [kg/m3]

p_c

\(p_c\)

Critical pressure [Pa]

Note

Despite numerous occasions in literature where \(\tau := T / T_c\), the reciprocal value is used here.

StandardStateIAPWS

class simu.app.thermo.contributions.iapws.standard.StandardStateIAPWS

Bases: ThermoContribution

With previously defined \(\tau\) (_tau) and \(\varrho\) (_rho), the standard state of the IAPWS model according to [WPrus02] is defined via the chemical potential. With

\[\eta_i = \exp(-\gamma_{k,i}^0\,\tau_i)\]

we write

\[\phi_i = n_{1, i}^0 + n_{2, i}^0\,\tau_i + n_{3, i}^0\,\ln \tau_i + \sum_{k=4}^{8}\,n_{k, i}^0\,\ln(1 - \eta_i)\]

As such, the chemical potential is

\[\mu_i = R\,T\,\phi_i.\]

The entropy contribution is calculated as

\[S = \sum_i n_i\, \left . \frac{\partial \mu_i}{\partial T} \right |_p = R\,\sum_i n_i\, \left [ \phi_i - \tau_i\, \left . \frac{\partial \phi_i}{\partial \tau_i} \right |_p \right ]\]

The derivative is implemented as

\[\tau_i\, \left . \frac{\partial \phi_i}{\partial \tau_i} \right |_p = n_{2, i}^0\,\tau_i + n_{3, i}^0 + \sum_{k=4}^{8}\,n_{k, i}^0\,\gamma_{k, i}^0\,\tau_i\, \frac{\eta_i}{1-\eta_i}\]

As such, the contribution requires the following standard state parameters

Parameter

Symbol

Parameter

Symbol

n_1

\(n_{1,i}^0\hspace{3cm}\)

g_4

\(\gamma_{4,i}^0\)

n_8

\(n_{8,i}^0\)

g_8

\(\gamma_{8,i}^0\)

The standard state is technically an ideal gas pure component standard state at the critical point of the individual species.

IdealGasIAPWS

class simu.app.thermo.contributions.iapws.standard.IdealGasIAPWS

Bases: ThermoContribution

The standard state StandardStateIAPWS is defined with a reference to the critical density of the individual species. This contribution adds the ideal gas and ideal mix contribution based on this reference. Due to the individual nature, it is not efficient to distinguish between the ideal mix and ideal gas contribution.

The IAPWS ideal gas contribution in terms of Helmholtz energy is

\[\Delta A^\mathrm{ig} = \sum_k n_k\,R\,T\,\ln \varrho_k = \sum_k n_k\,R\,T\,\ln \frac{M_k\,n_j}{V\,\rho_{c, k}}\]

This yields a chemical potential update

\[\mu_i \leftarrow \mu_i + R\,T\,\left (\ln \frac{M_i\,n_i}{V\,\rho_{c, i}} + 1 \right ) = \mu_i + R\,T\,(\ln \varrho_i + 1)\]

And for the entropy:

\[S \leftarrow S - \sum_k n_k\,R\,\ln \varrho_k\]

Finally, pressure is defined here as

\[p = \frac{\sum_k n_k\,R\,T}{V}\]

As such, this contribution does not require further parameters.

ResidualBaseIAPWS

class simu.app.thermo.contributions.iapws.residual.ResidualBaseIAPWS

Bases: ThermoContribution

All IAPWS residual contributions define a molar residual contribution \(\phi_i^\mathrm{res}(\tau_i, \varrho_i)\) being the sum of \(m\) terms, and applying for a subset of species \(i\).

The contribution can be parameterized by two options:

  • species: If provided, the contribution is only applied to a sub-set of species. This allows to combine the rigorous residual contribution with simplified models for secondary species.

  • number_of_terms: The default number of terms for this contribution is \(m = 7\). This parameter allows to change the number to accommodate different model structures.

The Helmholtz function is then implemented as

\[A^\mathrm{res} = R\,T\,\sum_i n_i\,\phi_i^\mathrm{res}\]

Casadi is used to obtain the derivatives as

\[\begin{split}S \leftarrow S - \left . \frac{\partial A^\mathrm{res}}{\partial T} \right |_{V, n_i}\\ p \leftarrow p - \left . \frac{\partial A^\mathrm{res}}{\partial V} \right |_{T, n_i}\\ \mu_i \leftarrow \mu_i + \left . \frac{\partial A^\mathrm{res}}{\partial n_i} \right |_{T, V}\end{split}\]
abstractmethod static parameter_names() Sequence[str]

Return a sequence of parameter names to be required by the contribution.

abstractmethod static define_phi(
tau: Quantity,
rho: Quantity,
parameters: Mapping[str, Sequence[Quantity]],
) Quantity

Based on the map of parameters, whereas the keys are the names defined in parameter_names(), define the residual \(\phi_i^\mathrm{res}(\tau_i, \varrho_i)\) vector function, such that the Helmholtz function contribution can be constructed as

\[A^{\mathrm{res}, j} = R\,T\,\sum_i n_i\,\phi_i^\mathrm{res}\]

Residual1IAPWS

class simu.app.thermo.contributions.iapws.residual.Residual1IAPWS

Bases: ResidualBaseIAPWS

The first contribution of the IAPWS residual Helmholtz function, as represented by this contribution, is formulated as in [WPrus02]:

\[\phi_i^{\mathrm{res}, 1} = \sum_{k=1}^{m} n_{k, i}\, \varrho_i^{d_{k, i}}\, \tau_i^{t_{k, i}}\,\]

The parameters are defined as follows, the indices formatted with two digits. The default number of terms \(m\) for this contribution is 44.

Parameter

Symbol

n_01 to n_mm

\(n_{1,i}^\mathrm{res,1}\) to \(n_{m,i}^\mathrm{res,1}\)

d_01 to d_mm

\(d_{1,i}\) to \(d_{m,i}\)

t_01 to t_mm

\(t_{1,i}\) to \(t_{m,i}\)

Residual2IAPWS

class simu.app.thermo.contributions.iapws.residual.Residual2IAPWS

Bases: ResidualBaseIAPWS

This contribution defines the second group of terms in the residual Helmholtz energy, defined as in [WPrus02]:

\[\phi_i^{\mathrm{res}, 2} = \sum_{k=1}^{m} n_{k, i}\, \varrho_i^{d_{k, i}}\, \tau_i^{t_{k, i}}\, \exp \left ( -\varrho_i^{c_{k, i}}\right )\]

The parameters are defined as follows, the indices formatted with two digits. The default number of terms \(m\) for this contribution is 44.

Parameter

Symbol

n_01 to n_mm

\(n_{1,i}\) to \(n_{m,i}\)

d_01 to d_mm

\(d_{1,i}\) to \(d_{m,i}\)

t_01 to t_mm

\(t_{1,i}\) to \(t_{m,i}\)

c_01 to c_mm

\(c_{1,i}\) to \(c_{m,i}\)

Residual3IAPWS

class simu.app.thermo.contributions.iapws.residual.Residual3IAPWS

Bases: ResidualBaseIAPWS

This contribution defines the third group of terms in the residual Helmholtz energy, defined as in [WPrus02]:

\[\phi_i^{\mathrm{res}, 3} = \sum_{k=1}^{m} n_{k, i}^\mathrm{res}\, \varrho_i^{d_{k, i}}\, \tau_i^{t_{k, i}}\, \exp \left [ -\alpha_{k,i}\,(\varrho_i - \epsilon_{k,i})^2 -\beta_{k,i}\,(\tau_i - \gamma_{k,i})^2 \right ]\]

The parameters are defined as follows, the indices formatted with two digits. The default number of terms \(m\) for this contribution is 3.

Parameter

Symbol

n_01 to n_mm

\(n_{1,i}\) to \(n_{m,i}\)

d_01 to d_mm

\(d_{1,i}\) to \(d_{m,i}\)

t_01 to t_mm

\(t_{1,i}\) to \(t_{m,i}\)

a_01 to a_mm

\(\alpha_{1,i}\) to \(\alpha_{m,i}\)

b_01 to b_mm

\(\beta_{1,i}\) to \(\beta_{m,i}\)

g_01 to g_mm

\(\gamma_{1,i}\) to \(\gamma_{m,i}\)

e_01 to e_mm

\(\epsilon_{1,i}\) to \(\epsilon_{m,i}\)

Residual4IAPWS

class simu.app.thermo.contributions.iapws.residual.Residual4IAPWS

Bases: ResidualBaseIAPWS

This contribution defines the forth group of terms in the residual Helmholtz energy, defined as in [WPrus02]:

\[\phi_i^{\mathrm{res}, 4} = \sum_{k=1}^{m} n_{k, i}^\mathrm{res}\, \Delta_{k,i}^{b_{k,i}}\,\varrho_i\,\psi_{k,i}\]

with

\[\begin{split}\Delta_{k,i} &= \theta_{k,i}^2 + B_i\,\hat\varrho_i^{a_{k,i}}\\ \theta_{k,i} &= 1-\tau_i + A_{k,i}\,\hat\varrho_i^{1/(2\,\beta_{k,i})}\\ \psi_i &= \exp \left [ -C_{k,i}\,\hat\varrho_i - D_{k,i}\,(\tau_i - 1)^2 \right ]\\ \hat \varrho_i &= (\varrho_i - 1)^2\end{split}\]

The parameters are defined as follows, the indices formatted with two digits. The default number of terms \(m\) for this contribution is 2.

Parameter

Symbol

n_01 to n_mm

\(n_{1,i}\) to \(n_{m,i}\)

a_01 to a_mm

\(a_{1,i}\) to \(a_{m,i}\)

b_01 to b_mm

\(b_{1,i}\) to \(b_{m,i}\)

B_01 to B_mm

\(B_{1,i}\) to \(B_{m,i}\)

C_01 to C_mm

\(C_{1,i}\) to \(C_{m,i}\)

D_01 to D_mm

\(D_{1,i}\) to \(D_{m,i}\)

A_01 to A_mm

\(A_{1,i}\) to \(A_{m,i}\)

beta_01 to beta_mm

\(\beta_{1,i}\) to \(\beta_{m,i}\)

GasIAPWSIdealMix

class simu.app.thermo.contributions.iapws.residual.GasIAPWSIdealMix

Bases: ThermoContribution

This contribution does not add any terms to the state function itself, but prepares and provides the initialization if the IAPWS model gas phase based on empirical expressions for the pure species, paired with ideal mixing rules for multi-component mixtures.

To find the gas volume, we calculate the saturation volume according to the empirical formula in [WPrus02]:

\[\ln \varrho_i^* = \sum_{j=1}^m c_{j,i}\,(1-\tau_i)^{f_{j,i}}\]

The total saturation volume according to Raoult’s law is then

\[V^* = \sum_i \frac{n_i\, M_i}{\varrho_i^*\,\rho_{c,i}}\]

Instead of initialising with the saturation volume itself, we compensate proportionally with any pressure departure. For that, the saturation pressure is evaluated according to [WPrus02] as

\[\ln \frac{p^*_i}{p_{c,i}} = \tau_i\,\sum_{j=1}^{m} a_{j,i}\,(1-\tau_i)^{e_{j,i}}\]

The total saturation pressure is the mole-fraction weighted sum of partial pressures:

\[p^* = \frac{1}{N}\sum_i n_i\,p^*_i\]

As such, the volume estimate is calculated to

\[V^\mathrm{est} = \frac{p^*}{p}\,V^*\]

This contribution requires the following parameters

Parameter

Symbol

a_01 to a_mm

\(a_{1,i}\) to \(a_{m,i}\)

e_01 to e_mm

\(e_{1,i}\) to \(e_{m,i}\)

c_01 to c_mm

\(c_{1,i}\) to \(c_{m,i}\)

f_01 to f_mm

\(f_{1,i}\) to \(f_{m,i}\)

By default, the number of terms is \(m = 6\), but this can be altered by the number_of_terms option.

LiquidIAPWSIdealMix

class simu.app.thermo.contributions.iapws.residual.LiquidIAPWSIdealMix

Bases: ThermoContribution

This contribution does not add any terms to the state function itself, but prepares and provides the initialization if the IAPWS model liquid phase based on empirical expressions for the pure species, paired with ideal mixing rules for multi-component mixtures.

To find the liquid volume, we calculate the saturation volume according to the empirical formula in [WPrus02]:

\[\varrho_i^* = 1 + \sum_{j=1}^m b_{j,i}\,(1-\tau_i)^{f_{j,i}}\]

The total saturation volume is then

\[V^\mathrm{est} = V^* = \sum_i \frac{n_i\, M_i}{\varrho_i^*\,\rho_{c,i}}\]

Unlike for initialising the gas phase (GasIAPWSIdealMix), we do not pressure-compensate the saturation volume.

Parameter

Symbol

b_01 to b_mm

\(b_{1,i}\) to \(b_{m,i}\)

f_01 to f_mm

\(f_{1,i}\) to \(f_{m,i}\)

By default, the number of terms is \(m = 6\), but this can be altered by the number_of_terms option.