Chemical equilibrium#
In this section, you will find the documentation of the kernel of the code, which is used to obtain the chemical equilibrium composition for a desired thermochemical transformation, e.g., constant enthalpy and pressure. It also includes routines to compute chemical equilibrium assuming a complete combustion and the calculation of the thermodynamic derivates. The code stems from the minimization of the free energy of the system by using Lagrange multipliers combined with a Newton-Raphson method, upon condition that initial gas properties are defined by two functions of states, e.g., temperature and pressure.
Note
The kernel of the code is based on Gordon, S., & McBride, B. J. (1994). NASA reference publication, 1311.
Thermodynamic derivatives#
All thermodynamic first derivatives can be obtained with any set of three independent first derivatives [1]. Combustion Toolbox computes all thermodynamic first derivatives from \((\partial \text{ln } V/\partial \text{ln } T)_p\), \((\partial \text{ln } V/\partial \text{ln } p)_T\), and \((\partial h/\partial T)_p = c_p\). Considering the ideal equation of state
and applying logarithms to both sides
is readily seen that
To compute \(c_p\) we have to distinguish between the frozen contribution and the reaction contribution
given by the following relations
with \(\eta_j = \text{ln } n_j\) and \(\delta_j = 1 \) for \(j=1,\dots,NG\) (non-condensed species), and \(\eta_j = n_j\) and \(\delta_j = 0\) for \(j = NG + 1, \dots, NS\) (condensed species).
Derivatives with respect to temperature#
Derivatives with respect to pressure#
Routines
- complete_combustion(self, mix, phi)#
Solve chemical equilibrium for CHNO mixtures assuming a complete combustion
- Parameters
self (
struct
) – Data of the mixture, conditions, and databasesmix (
struct
) – Properties of the initial mixturephi (
float
) – Equivalence ratio [-]
- Returns
Tuple containing
moles (float): Equilibrium composition [moles] at defined temperature
species (str): Species considered in the complemte combustion model
- equilibrate(self, mix1, pP, varargin)#
Obtain properties at equilibrium for the set thermochemical transformation
- Parameters
self (
struct
) – Data of the mixture, conditions, and databasesmix1 (
struct
) – Properties of the initial mixturepP (
float
) – Pressure [bar]
- Optional Args:
mix2 (struct): Properties of the final mixture (previous calculation)
- Returns
mix2 (struct) – Properties of the final mixture
- equilibrate_T(self, mix1, pP, TP, varargin)#
Obtain equilibrium properties and composition for the given temperature [K] and pressure [bar]
- Parameters
self (
struct
) – Data of the mixture, conditions, and databasesmix1 (
struct
) – Properties of the initial mixturepP (
float
) – Pressure [bar]TP (
float
) – Temperature [K]
- Optional Args:
guess_moles (float): mixture composition [mol] of a previous computation
- Returns
mix2 (struct) – Properties of the final mixture
- equilibrium(self, pP, TP, mix1, guess_moles)#
Obtain equilibrium composition [moles] for the given temperature [K] and pressure [bar]. The code stems from the minimization of the free energy of the system by using Lagrange multipliers combined with a Newton-Raphson method, upon condition that initial gas properties are defined by two functions of states. e.g., temperature and pressure.
This method is based on Gordon, S., & McBride, B. J. (1994). NASA reference publication, 1311.
- Parameters
self (
struct
) – Data of the mixture, conditions, and databasespP (
float
) – Pressure [bar]TP (
float
) – Temperature [K]mix1 (
struct
) – Properties of the initial mixtureguess_moles (
float
) – mixture composition [mol] of a previous computation
- Returns
Tuple containing
N0 (float): Equilibrium composition [moles] for the given temperature [K] and pressure [bar]
STOP (float): Relative error [-]
- equilibrium_dT(self, moles, T, mix1)#
Obtain thermodynamic derivative of the moles of the species and of the moles of the mixture respect to temperature from a given composition [moles] at equilibrium
- Parameters
self (
struct
) – Data of the mixture, conditions, and databasesmoles (
float
) – Equilibrium composition [moles]T (
float
) – Temperature [K]mix1 (
struct
) – Properties of the initial mixture
- Returns
Tuple containing
dNi_T (float): Thermodynamic derivative of the moles of the species respect to temperature
dN_T (float): Thermodynamic derivative of the moles of the mixture respect to temperature
- equilibrium_dp(self, moles, mix1)#
Obtain thermodynamic derivative of the moles of the species and of the moles of the mixture respect to pressure from a given composition [moles] at equilibrium
- Parameters
self (
struct
) – Data of the mixture, conditions, and databasesmoles (
float
) – Equilibrium composition [moles]mix1 (
struct
) – Properties of the initial mixture
- Returns
Tuple containing
dNi_p (float): Thermodynamic derivative of the moles of the species respect to pressure
dN_p (float): Thermodynamic derivative of the moles of the mixture respect to pressure
- equilibrium_ions(self, pP, TP, mix1, guess_moles)#
Obtain equilibrium composition [moles] for the given temperature [K] and pressure [bar] considering ionization of the species. The code stems from the minimization of the free energy of the system by using Lagrange multipliers combined with a Newton-Raphson method, upon condition that initial gas properties are defined by two functions of states. e.g., temperature and pressure.
This method is based on Gordon, S., & McBride, B. J. (1994). NASA reference publication, 1311.
- Parameters
self (
struct
) – Data of the mixture, conditions, and databasespP (
float
) – Pressure [bar]TP (
float
) – Temperature [K]mix1 (
struct
) – Properties of the initial mixtureguess_moles (
float
) – mixture composition [mol] of a previous computation
- Returns
Tuple containing
N0 (float): Equilibrium composition [moles] for the given temperature [K] and pressure [bar]
STOP (float): Relative error [-]
- equilibrium_reduced(self, pP, TP, mix1, guess_moles)#
Obtain equilibrium composition [moles] for the given temperature [K] and pressure [bar]. The code stems from the minimization of the free energy of the system by using Lagrange multipliers combined with a Newton-Raphson method, upon condition that initial gas properties are defined by two functions of states. e.g., temperature and pressure. The algorithm implemented take advantage of the sparseness of the upper left submatrix obtaining a matrix A of size NE + NS-NG + 1.
This method is based on Gordon, S., & McBride, B. J. (1994). NASA reference publication, 1311.
- Parameters
self (
struct
) – Data of the mixture, conditions, and databasespP (
float
) – Pressure [bar]TP (
float
) – Temperature [K]mix1 (
struct
) – Properties of the initial mixtureguess_moles (
float
) – mixture composition [mol] of a previous computation
- Returns
Tuple containing
N0 (float): Equilibrium composition [moles] for the given temperature [K] and pressure [bar]
STOP (float): Relative error [-]
McBride, Bonnie J. Computer program for calculation of complex chemical equilibrium compositions and applications. Vol. 2. NASA Lewis Research Center, 1996.