This report contains the theory behind the algorithm to find the composition of air at temperatures 200-9000 K. A C++ program for the same is hosted at my profile on GitHub.com/kcavatar.
C++ Algorithm Computes Air Composition from 200-9000K
1. A C++ algorithm for computing
equilibrium chemical composition of air at
temperatures 200-9000 K
A REPORT
by
G R Krishna Chand Avatar
BE (Aerospace Engineering)
Punjab Engineering College, Chandigarh
July 5, 2016
3. Abstract
The chemical composition of air drastically changes at high tempera-
tures, which is triggered mainly due to molecular dissociation of diatomic
nitrogen (N2) and diatomic oxygen (O2). The algorithm presented here at-
tempts to compute the composition of air for the temperature range 200 –
9000 K. The constituents of air are assumed to be primarily N2, O2, O, N
and NO as they are present in substantial amounts for the selected range of
study.
4. Nomenclature
i, j : Indices
ai,j : Interpolating polynomials
bn : Polynomial coefficients
R : Ideal gas constant (8.314 J/mol/K)
ρ : Density of air (kg/m3)
∆G : Gibbs energy function (J/mol)
P0 : Reference pressure (101325 Pa)
T0 : Reference temperature (0 K)
T : Temperature (K)
Go
i : Molar Gibbs energy for ith species (J/mol)
Ho
i : Molar enthalpy for ith species (J/mol)
So
i : Molar entropy for ith species (J/mol/K)
σN : Mole number of nitrogen atoms
σO : Mole number of oxygen atoms
σi : Mole number of ith species
σ : Sum of mole numbers of all species
ν : Stoichiometric coefficients of any species in a chemical reaction
Ki : Equilibrium constant based on mole numbers
Kpi : Equilibrium constant based on partial pressures
tol : Tolerance value
1
5. Chapter 1
Introduction
1.1 Air
Air is a mixture of gases, which at low temperatures are primarily
Nitrogen, Oxygen and small amounts of argon, carbon dioxide and other
gases. Since nitrogen and oxygen form almost all of the air, it is considered
that the former has a presence with 79% and the latter with 21% by moles
at low temperatures. Five chemically reacting species are assumed to be
present in air, viz., N2, N, O, O2 and NO and designed respectively as :
σ1, σ2, σ3, σ4 and σ5.
Three independent chemical reactions are considered involving all the
5 reacting species which are enumerated as :
O2 → 2O (1.1)
N2 + O2 → 2NO (1.2)
N2 → 2N (1.3)
1.2 Equilibrium fundamentals
To determine whether a reaction has reached its state of equilibrium or
not, a parameter known as equilibrium coefficient is defined. This equilib-
rium coefficient, when expressed in terms of partial pressures of the partici-
pating gaseous entities, Kp is more easily computed once the Gibbs standard
energy change for the particular reaction (∆G) is calculated. Both these
terms are related via the expression :
Kpj = e−∆Go
j /RT
for any jth
reaction.
∆Go for any reaction is calculated using the following expression:
∆Go
=
products
νiGi −
reactants
νiGi
2
6. For the reactions in the previous section, ∆Go
j (j = 1,2,3) is given as under;
∆Go
1 = 2Go
3 − Go
4
∆Go
2 = 2Go
5 − Go
1 − Go
4
∆Go
3 = 2Go
2 − Go
1
In order to detemine ∆G, Gibbs free energy with reference to a temperature
0 K has to be computed for each of the five species that have been considered
using a Gibbs energy function, Go(T). Many research organisations, notably
NASA, have curve-fitted the data, using least-squares method, obtained af-
ter performing rigorous experiments using a set of interpolating polynomials
valid for continual temperature ranges. These values for the interpolating
coefficients could be obtained from any reliable source. For our purpose, we
have used the data from "A Rapid Method for the Computation of Equilib-
rium Chemical Composition of Air to 15000 K" - Ramadas K. Prabhu and
Wayne D. Erickson, NASA Technical Paper 2792 published in March 1988.
Gibbs energy function is expressed as:
Go
i
RT
=
Ho
i
RT
−
So
i
R
Ho
i
RT
=
5
j=1
ai,jTj−1
j
+
ai,6
T
So
i
R
= ai,1 log T +
5
j=2
ai,jTj−1
j − 1
+ ai,7
The coefficients ai,6 and ai,7 are the itegration constants. The
values of ai,6 were determined from the enthalpy of formation (taken from
the JANAF Thermochemical Tables published by The Dow Chemical Co.)
for all the species at the reference temperature (T0 = 0 K). The values of
ai,7 were determined from the values of entropy at T = 298.15 K.
3
7. Chapter 2
Governing Equations
2.1 Equilibrium equations
There are three reactions which govern the equilibrium chemical compo-
sition of air at various temperatures. At these temperatures, corresponding
equilibrium constants in terms of the mole numbers, Ki (i=1,2,3) of the
participating species for the three reactions are obtained.
The reactions with their Ki’s are enumerated as:
O2 → 2O; K1 =
σ3
2
σ4
(2.1)
N2 + O2 → 2NO; K2 =
σ5
2
σ1 · σ4
(2.2)
N2 → 2N; K3 =
σ2
2
σ1
(2.3)
As the equilibrium constants are based on mole numbers Ki of the
species, they have to be expressed in terms of equilibrium constants based on
partial pressures of the participating species, Kpi (i=1,2,3). This is because
the latter can be easily expressed as a function of the Gibbs’ free energy
change for each of the reactions as discussed in the introduction.
The two types of equibrium constants are related through an expression as:
Ki = Kpi · (P0/ρRT)∆N
∆N = Nmole numbers of products − Nmole numbers of reactants
2.2 Conservation equations
All the species that are considered here are made of two fundamental
elements, Oxygen and Nitrogen which allows for the formulation of two con-
4
8. servation equations, one each for Oxygen and Nitrogen, as:
2σ4 + σ3 + σ5 = σO (2.4)
2σ1 + σ2 + σ5 = σN (2.5)
One mole of diatomic species, N2 (σ1) and O2 (σ4) contributes two
moles of atoms of their constituent element species. Similarly one mole of
species NO (σ5) contributes one mole of Oxygen atoms and another mole of
Nitrogen atoms.
5
9. Chapter 3
Computational models
For computation of equilibrium chemical composition of air for the tem-
perature range 200–9000 K, three models are adopted for three overlapping
temperature ranges. Every model includes two sets of constituent species,
viz,
1. Major species : Comprises of those species which are predominant
for the temperature range under study
2. Minor species : Enumerates those species whose presence is rela-
tively very low
The regions of applicability of the models,as presented above, strictly
depends upon the value of log ρ alongwith temperature, T. The graph show-
ing the same is presented on the last page of this report. The applicability
(in terms of temperature ranges) of each of the models, as mentioned in its
description, is particularly for the case when ρ = 0.01kg/m3.
3.1 Model 1
This model computes the composition of air in the low temperature range :
200-1600 K (or based on the value of log ρ)
Here the major species are N2 (σ1) and O2 (σ4) and the minor
ones are O (σ3), NO (σ5) and N (σ2).
Procedure:
1. Assume initial values for mole numbers for O2 and N2 as:
σ4 = σO
2 and σ1 = σN
2
2. Compute minor species as:
σ3 = K1σ4 σ2 = K3σ1 σ5 = Keσ2σ3; Ke = K2
K1K3
3. Update the major species as:
σ4 = (σO−σ3−σ5)
2 σ1 = (σN −σ2−σ5)
2
6
10. 4. Iterate the preceding steps until convergence is achieved,i.e.,until
|σ4 − σ4| ≤ tol and |σ1 − σ1| ≤ tol
3.2 Model 2
This model computes the composition of air in the median temperature
range : 1600-6000 K (or based on the value of log ρ)
The major species are N2 (σ1), N (σ2), O (σ3), O2 (σ4) and NO
(σ5).
Procedure:
1. Calculate the initial guess for σ3 using the equations as under:
2σ4 + σ3 + σ5 = σO σ4 =
σ2
3
K1
σ5 = σ3
σN K2
2K1
taking σ1 = σN /2
such that : σ3 =
−
K1
2
(1+
σN K2
2K1
)+
K2
1
4
(1+
σN K2
2K1
)2+2σOK1
2
2. Determine values of bn : n=0,1,2,3,4 as:
b0 = 2K1σ2
O
b1 = (−4 + K3Ke)K1σO
b2 = −8σO + 2K1 + (σO − σN )K2 − K1K3Ke
b3 = 8 − K2 − 2K3Ke
b4 = (8−2K2)
K1
3. Compute ∆σ3 = − F
F
as: F = 4
n=0 bnσn
3 F = 4
n=1 nbnσn−1
3
4. Update σ3 and compute the major species as :
σ3 = σ3 + ∆σ3 σ2 =
σO−2
σ2
3
K1
−σ3
Keσ3
σ5 = Keσ2σ3
σ1 = (σN −σ2−σ5)
2
σ4 = (σO−σ3−σ5)
2
5. Iterate steps 3-4 till convergence for σ3 is achieved,i.e.,
|∆σ3| ≤ tol
3.3 Model 3
This model computes the composition of air in the relatively high tempera-
ture range : 3500-9000 K (or based on the value of log ρ)
The major species are N2 (σ1), N (σ2) and O (σ3); the minor ones
are O2 (σ4) and NO (σ5).
Procedure:
1. Assume σ4 = σ5 = 0. Take σ3 = σO.
7
11. 2. σN = σN − σ5 and solving quadratically for σ2 as :
σ2 =
−K3
2 + (K3
2 )2 + 2K3σN
2
3. Compute major and minor species:
σ1 =
(σN −σ2)
2 σ4 =
σ3
2
K1
σ5 = Keσ3σ2
σ3 = σO − 2σ4 − σ5
4. Take σ3 = σ3
5. Keep on iterating steps 2-4 till the following criterion is met:
|σ3 − σ3| ≤ tol
8
12. Chapter 4
Results
The results are discussed when ρ = 1 ∗ 10−2kg/m3. The level of molec-
ular dissociation for the two species N2 and O2 remains substantially very
low at temperatures in the range of 200–2900 K. Thereafter the molecular
dissociation of O2 gets accelerated with increase in temperature beyond 2900
K. And for the range of 2900–6300 K, N2 and O are predominant. Beyond
6300 K, N2 also starts getting dissociated rapidly and so the predominant
species are N and O. A graph for the same is provided on the the next page.
References
"A Rapid Method for the Computation of Equilibrium Chemical Composition
of Air to 15000 K" - Ramadas K. Prabhu and Wayne D. Erickson, NASA
Technical Paper 2792 published in March 1988.
9
13. Chapter 5
Algorithm Description
The algorithm for the entire computation process is listed as:
1. Input temperature (T) and density of air ρ.
2. Gather curve-fitting coefficients, aij corresponding to the input T.
3. Using the values of aij and T, compute values for Ho
i and So
i and
thereby Go
i for i = 1, 2, 3, 4, 5 or simply all the species.
4. Calculate ∆Go
j ∀ j = 1, 2, 3
5. Compute Kpj using the exponential relation and then Kj ∀ j = 1, 2, 3.
6. Invoke the requisite models as per the value of input temperature, (T).
7. Obtain the values of mole fractions of all the species.
10
16. Figure 5.2: Regions of Applicability of Various models
Reproduced with modification from "A Rapid Method for the Computation
of Equilibrium Chemical Composition of Air to 15000 K" - Ramadas K.
Prabhu and Wayne D. Erickson, NASA Technical Paper 2792
13