Reference state, standard state, and ideal contributions¶
H0S0ReferenceState¶
- class simu.app.thermo.contributions.basic.H0S0ReferenceState¶
Bases:
ThermoContributionThis contribution defines the reference state based on enthalpy of formation and standard entropy. It requires the following parameters:
Parameter
Description
Symbol
dh_formMolar enthalpy of formation vector
\(\Delta_f h\)
s_0Vector of standard entropies
\(s_0\)
T_refReference temperature
\(T_\mathrm{ref}\)
p_refReference pressure
\(T_\mathrm{ref}\)
Based on this, the reference state is defined in therms of entropy and chemical potentials:
Property
Description
Symbol
SReference state entropy of the system
\(S\)
muReference state chemical potential vector
\(\mu\)
T_refReference temperature (same as parameter)
\(T_\mathrm{ref}\)
p_refReference pressure (same as parameter)
\(p_\mathrm{ref}\)
The contribution does not support any options.
\[\begin{split}S &= \sum_i s_{0,i}\, n_i\\ \mu_i &= \Delta_f h_i - T\,s_{0,i}\end{split}\]
LinearHeatCapacity¶
- class simu.app.thermo.contributions.basic.LinearHeatCapacity¶
Bases:
ThermoContributionThis contribution implements a simple heat capacity, being linear in temperature. It normally builds on a reference state and yields the standard state model. It requires the following parameters:
Parameter
Description
Symbol
cp_aMolar heat capacity coefficient vector
\(c_{p,a}\)
cp_bMolar heat capacity coefficient vector
\(c_{p,b}\)
Heat capacity is here defined as
\[\begin{split}\Delta T := T-T_\mathrm{ref}\\ c_{p,i} = c_{p,a,i} + \Delta T\,c_{p,b,i}\end{split}\]The contribution does not define new properties, but builds on entropy
S(\(S\)) and chemical potentialmu(\(\mu\)). With the following definitions:\[\begin{split}\Delta h_i &= \left (c_{p,a,i} + \frac12\Delta T\,c_{p,b,i}\right )\, \Delta T\\ \Delta s_i &= (c_{p,a,i} - c_{p,b,i}\,T_\mathrm{ref})\, \ln \frac{T}{T_\mathrm{ref}} + c_{p,b,i}\,\Delta T\\\end{split}\]The properties are updated as
\[\begin{split}S &\leftarrow S + \sum_i \Delta s_i\,n_i\\ \mu_i &\leftarrow \mu_i + \Delta h_i - T\,\Delta s_i\end{split}\]The contribution model domain is defined for positive temperatures only, due to a logarithmic contribution to entropy.
BarinHeatCapacity¶
- class simu.app.thermo.contributions.basic.BarinHeatCapacity¶
Bases:
ThermoContributionThis contribution defines the Barin heat capacity expression, slightly expanded by including a \(T^{-1}\) term. We introduce a temperature scaling parameter \(T_s\) [K] to align the physical dimension of all parameters:
\[t = \frac{T}{T_s}\quad t_\mathrm{ref} = \frac{T_\mathrm{ref}}{T_s}\]\[\begin{split}c_{p,i}(T) = a_i + b_i\,(t - t_\mathrm{ref}) + c_i\,(t^2 - t_\mathrm{ref}^2) + d_i\,(t^3 - t_\mathrm{ref}^3) + e_i\,(t^{-1} - t_\mathrm{ref}^{-1})\\ + f_i\,(t^{-2} - t_\mathrm{ref}^{-2}) + g_i\,(t^{-3} - t_\mathrm{ref}^{-3})\end{split}\]from here, integration yields
\[\Delta_{c_p} h_i = \int_{T_\mathrm{ref}}^{T} c_{p,i}(\tau)\,\mathrm{d}\tau\]and
\[\Delta_{c_p} s_i = \int_{T_\mathrm{ref}}^{T} \frac{c_{p,i}(\tau)}{\tau}\, \mathrm{d}\tau\]The expression for chemical potential is then
\[\Delta_{c_p} \mu_i= \Delta_{c_p} h_i^0 - T\,\Delta_{c_p} s_i^0\]
StandardState¶
- class simu.app.thermo.contributions.basic.StandardState¶
This contribution assumes the current state to be the standard state and tags the following properties:
Property
Origin
S_stdSp_stdp_refmu_stdmuThe contribution does not support any options or parameters.
IdealMix¶
- class simu.app.thermo.contributions.basic.IdealMix¶
Bases:
ThermoContributionThis contribution supplies the ideal mix entropy contribution, applicable for both liquid and gas phases. It does not require any parameters nor supports options.
The contribution does not define new properties, but builds on entropy
S(\(S\)) and chemical potentialmu(\(\mu\)). With \(\Delta s_i := -R\,\ln n_i/N\), we update\[\begin{split}S &\leftarrow S + \sum_i \Delta s_i\,n_i\\ \mu_i &\leftarrow \mu_i - T\,\Delta s_i\end{split}\]The contribution model domain is limited to positive quantities in order to prevent negative arguments to the logarithmic functions. One could enable also the third quadrant (all mole numbers negative), but doing so and thereby allowing the solver to jump between these two nearly disconnected domains has proven to be challenging in terms of solver robustness.
GibbsIdealGas¶
- class simu.app.thermo.contributions.basic.GibbsIdealGas¶
Bases:
ThermoContributionThis contribution supplements the ideal gas entropy contribution and defines the volume property in Gibbs coordinates, i.e. with volume as a function of pressure. The main use of this class is to actually represent an ideal gas model, while most non-ideal gas phase models are equations of state and formulated in Helmholtz coordinates.
Based on the previously provided reference pressure
p_refand \(\Delta s := -R\,\ln p/p_\mathrm{ref}\), the update is\[\begin{split}S &\leftarrow S + \Delta s\,N\\ \mu_i &\leftarrow \mu_i - T\,\Delta s\end{split}\]Volume is defined as
\[V = \frac{N\,R\,T}{p}\]Due to the logarithmic term in entropy, the contribution model domain is limited to positive pressures.
HelmholtzIdealGas¶
- class simu.app.thermo.contributions.basic.HelmholtzIdealGas¶
Bases:
ThermoContributionThis contribution supplements the ideal gas entropy contribution and defines the pressure property in Helmholtz coordinates, i.e. with pressure as function of volume. This is the common base contribution for most equations of state. Based on the previously provided reference pressure
p_refand\[\Delta s := -R\,\ln \frac{N\,R\,T}{V\,p_\mathrm{ref}}\]the update is
\[\begin{split}S &\leftarrow S + \Delta s\,N\\ \mu_i &\leftarrow \mu_i - T\,\Delta s\end{split}\]Pressure is defined as
\[p = \frac{N\,R\,T}{V}\]Due to the logarithmic term in entropy, the contribution model domain is limited to positive volumes.
ConstantGibbsVolume¶
- class simu.app.thermo.contributions.basic.ConstantGibbsVolume¶
Bases:
ThermoContributionThis contribution defines a mixture with constant molar volumes and hence zero compressibility and thermal expansion. This is an easy and sufficient way to describe a condensed phase at moderate pressures in limited temperature ranges. Mixing volume is not considered either, but can be added via additional contributions.
The sole parameter is the molar volume for each species:
Parameter
Description
Symbol
v_nMolar volume vector
\(v_n\)
The system volume is then calculated as
\[V = \sum_i v_{n,i}\,n_i\]For the chemical potential, this yields, given pressure
pand reference pressurep_ref:\[\mu_i \leftarrow \mu_i + v_{n,i}\,(p - p_\mathrm{ref})\]Note
The volume definition has a slight impact on the chemical potential, as shown in above equation. For a typical condensed phase however, say water, \(v_n = 1.8\cdot 10^{-5}\ \mathrm{m^3/mol}\), and if pressures are in the range of few bars, \(\Delta \mu < 10\ \mathrm{J/mol}\). This yields a 0.4 % change in the activity coefficient.
MolecularWeight¶
- class simu.app.thermo.contributions.basic.MolecularWeight¶
Bases:
ThermoContributionThis contribution defines the molecular weights as a species vector, based on the underlying
simu.SpeciesDefinitiondefinitions.
ChargeBalance¶
- class simu.app.thermo.contributions.basic.ChargeBalance¶
Bases:
ThermoContributionThis contribution defines a charge balance residual, if there are charged species. A ValueError is raised if only either positive or negative charged species exist.
Given the presents of opposite charged species, the residual defined, based on the molar quantities \(n_i\) is
\[\sum_i n_i \cdot c_i = 0\]Here, the charges \(c_i\) are extracted from the species definition.
By default, the unit for the residual is
efor states ande / sfor flows. This can be altered by the following options:The option
state_unitdefines the unit used for states. Ifflow_unitis not given, it will be defined asstate_unit / s.The option
flow_unitdefines the unit used for flows. It does not impact thestate_unitvalue.