You are on page 1of 71

S.A. Klein and G.F.

Nellis
Cambridge University Press, 2011

14.A-1
The proton exchange membrane (PEM) fuel cell requires hydrogen as the fuel. Unfortunately,
hydrogen does not readily occur and it must therefore be generated from another fuel. One way
to do this is to reform a hydrocarbon fuel such as methane (CH4). A preliminary step in the
reformation process is to react methane with water in a catalytic converter to produce hydrogen
and carbon monoxide according to: CH 4 H 2 O 3H 2 CO . Methane and water are fed to
reactor in molar proportions of 1 mole of methane to 4 moles of water.
a.) Prepare a plot of the equilibrium hydrogen mole fraction versus temperature for temperatures
between 600 K and 1000 K at 1 atm

Much of the calculations can be done using arrays which reduces the typing required. Number
of the gases and enter their names, initial molar amounts and stoichiometric coefficients.

$UnitSystem SI K Pa J molar
"CH4 + H2O = CO + 3 H2"

CH4=1; H2O=2; CO=3; H2=4 "associated array position"


N$[CH4]='CH4'; N$[H2O]='H2O'; N$[CO]='CO'; N$[H2]='H2' "names of each gas"
n_0[CH4]=1 [kmol]; nu[CH4]=-1; "initial amount and stoichiometric coefficient"
n_0[H2O]=4 [kmol]; nu[H2O]=-1;
n_0[CO]=0 [kmol]; nu[CO]=1
n_0[H2]=0 [kmol]; nu[H2]=3;

The moles of each gas an any point in time are related to each other through the reaction
coordinate, defined as .

ni ni ,0
(1)
i

duplicate i=1,4
n[i]=n_0[i]+nu[i]*epsilon "definition of reaction coordinate"
end
n=sum(n[i],i=1,4) "total moles of gas"

A temperature of 700 K is chosen. Temperature will later be varied in the table. The pressure is
atmospheric for part a.

$ifnot ParametricTable
T=700 [K]
$endif
P|o=Po# "atmospheric pressure"
P=P|o

The law of mass action is applied to determine the equilibrium state.

GTo R T ln K (2)
where
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

C
G i gio
o
T (3)
i 1


C
yP
i

K i o (4)
i 1 P

DELTAG|o=-R#*T*ln(K) "definition of equilibrium constant"


DELTAG|o=g|o[CO]+3*g|o[H2]-g|o[CH4]-g|o[H2O] "definition of standard-state Gibbs
change"

duplicate i=1,4
g|o[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=P|o) "specific Gibbs free energy at 1 atm"
y[i]=n[i]/n "mole fraction for gas i"
end

Set epsilon to a reasonable value, e.g., 0.5 and solve. It may also be wise to set lower and upper
bounds on the mole fractions to be 0 and 1, respectively.

epsilon=0.5 "guess for epsilon"

Solve and update the guess values. Then comment the guess for epsilon and enter the definition
of the equilibrium constant, assuming ideal gas behavior.

{epsilon=0.5 "guess for epsilon"}


K=product((y[i]*P/P|o)^nu[i],i=1,4) "relation of mole fractions to K"

Create a Parametric table with columns for T and y[4] (the hydrogen mole fraction). Solve the
table and plot the hydrogen mole fraction versus temperature for temperatures between 600 and
1000 K.

b.) How will the equilibrium mole fraction of hydrogen be affected if the pressure in the
converter is raised to 5 atm?

Change the pressure and resolve the table. A plot of the equilibrium mole fraction of hydrogen
for temperatures between 600 and 1000 K at 1 atm and 5 atm is shown below.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

0.45
1 atm
0.4

hydrogen mole fraction


0.35
5 atm
0.3

0.25

0.2

0.15

0.1

0.05

0
600 650 700 750 800 850 900 950 1000
T [K]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-2
Nitrogen oxide (NO) is one of several pollutants that can be generated in an internal combustion
engine by the reaction between oxygen and nitrogen. Oxides of nitrogen are precursors to the
atmospheric smog that is common in large cities. The rate of reaction between oxygen and
nitrogen increases with increasing temperature. At high temperatures, and equilibrium amounts
of NO may be generated. In the present case, a mixture of octane (C8H18) and 20% excess air at
25C, 1 atm is adiabatically compressed with a compression ratio of 8. Combustion then
initiates at constant volume and proceeds to complete combustion in an adiabatic manner. It is
necessary to estimate the maximum mole fraction of NO that can be occur in the combustion
products. This result can be obtained by answering the following questions.

a.) What is the temperature and pressure of the mixture of octane and air after the adiabatic
compression process has concluded and before combustion is initiated?

It is first necessary to determine the stoichiometry of the fuel and air mixture. Choose a basis of
1 kmol of octane. The reaction of air with octane is written.

$UnitSystem SI K Pa J molar
"Basis: 1 kmole of C8H18"
"C8H18 + a(O2 + 3.76 N2) = 8 CO2 + 9 H2O + 3.76 a N2 + b O2"

The value of a_stoic is found by an oxygen balance that sets b=0. The actual value of a is 20%
greater than the stoichiometric value. An oxygen balance then determines the value of b. The
total moles of reactants can then be determined for the basis of 1 kmole of octane. The
temperature and pressure of this mixture are specified so the internal energy, entropy and volume
of the reactants can be determined.

2*a_stoic=8*2+9 "stoichiometric oxygen balance"


a=1.2*a_stoic "actual moles of oxygen"
b=0.2*a_stoic "moles of oxygen in products"
n_R=1+4.76*a "moles of reactants"
T[1]=convertTemp(C,K,25 [C]) "temperature before compression"
P[1]=1 [atm]*convert(atm,Pa) "pressure before compression"

U[1]=intEnergy(C8H18,T=T[1])+a*intEnergy(O2,T=T[1])+&
3.76*a*intEnergy(N2,T=T[1]) "internal energy before compression"
S[1]=entropy(C8H18,T=T[1],P=1/n_R*P[1])+&
a*entropy(O2,T=T[1],P=a/n_R*P[1])+&
3.76*a*entropy(N2,T=T[1],P=3.76*a/n_R*P[1]) "entropy before compression"
V[1]=n_R*R#*T[1]/P[1] "volume before compression"

The compression process occurs adiabatically and reduces the volume by a factor equal to the
compression ratio. The temperature after compression will be higher than T[1] and it is needed
to compute the properties of the mixture. Enter a guess for T[2], e.g., 500 K. This guess will be
removed soon. With the temperature and volume of the mixture known, the pressure, internal
energy, and entropy can be determined.

CR=8 "compression ratio"


T[2]=500 [K] "guess"
V[2]=V[1]/CR "volume after compression"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

U[2]=intEnergy(C8H18,T=T[2])+a*intEnergy(O2,T=T[2])+&
3.76*a*intEnergy(N2,T=T[2]) "internal energy after compression"
S[2]=entropy(C8H18,T=T[2],P=1/n_R*P[2])+&
a*entropy(O2,T=T[2],P=a/n_R*P[2])+&
3.76*a*entropy(N2,T=T[2],P=3.76*a/n_R*P[2]) "entropy after compression"
V[2]=n_R*R#*T[2]/P[2] "volume after compression"

Solve and update the guess values. Comment out the guess for T[2] and replace the equation
with the requirement that the compression process is isentropic.

{T[2]=500 [K] "guess"}


S[1]=S[2] "compression is isentropic"

Solve. The temperature and pressure after the compression process is completed is 604.5 [K]
and 1.644 MPa.

b.) What is the temperature and pressure of the combustion products in the cylinder after
combustion occurs? Assume that the combustion process is adiabatic and occurs at constant
volume.

The number of moles of gases is the determined. The reaction occurs at constant volume.
Provide a guess value for T[3]. The guess will soon be removed. The volume depends on
pressure which can now be determined. The internal energy of the combustion products can also
be determined with the known temperature.

n_P=8+9+3.76*a+b "moles of products"


V[3]=V[2] "constant volume"
T[3]=2000 [K] "guess value for T[3]"
V[3]=n_P*R#*T[3]/P[3] "volume relates P[3] and T[3]"
U[3]=8*intEnergy(CO2,T=T[3])+9*intEnergy(H2O,T=T[3])+&
3.76*a*intEnergy(N2,T=T[3])+b*intEnergy(O2,T=T[3]) "internal energy after combustion"

Solve and update the guess values. Next, comment out the guess made for T[3] and replace it
with the result of an energy balance that requires U[3]=U[2] since there is no heat, no work and
the system is closed.

{T[3]=2000 [K] "guess value for T[3]"}


U[3]=U[2] "adiabatic combustion"

Solving, the temperature is 2816 K and the pressure is 8.026 MPa.

c.) Assume that the reaction of oxygen and nitrogen proceeds to equilibrium while the
temperature and pressure remain constant at the values found in part b.) Also assume that no
other reactions occur. What will the equilibrium mole fraction of NO be under these
conditions? Assume ideal gas behavior.

The reaction is presumed to occur according to: O2 + N2 = 2 NO


S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The oxygen and nitrogen are mixed with carbon dioxide and water. The number of moles of
these gases is known and the pressure and temperature are assumed to be constant at the values
determined in part b.

"O2 + N2 = 2 NO"
n_CO2=8 "moles of CO2 in products"
n_H2O=9 "moles of H2O in products"
T=T[3] "temperature of reaction"
P=P[3] "pressure of reaction"
n_O2_0=b "moles of O2 in products before NO reaction"
n_N2_0=3.76*a "moles of N2 in products before NO reaction"

The moles of oxygen, nitrogen and nitrogen oxide are related by the reaction coordinate.

n_O2=n_O2_0-epsilon "equilibrium moles of O2"


n_N2=n_N2_0-epsilon "equilibrium moles of N2"
n_NO=2*epsilon "equilibrium moles of NO"

The law of mass action is applied to determine the equilibrium state.

GTo R T ln K (1)
where

C
GTo i gio (2)
i 1


C
yP
i

K i o (3)
i 1 P

DELTAG|o=-R#*T*ln(K) "law of mass action"


DELTAG|o=2*g_NO|o-g_O2|o-g_N2|o "DELTAG|o for O2 - N2 reaction"

g_NO|o=enthalpy(NO,T=T)-T*entropy(NO,T=T,P=Po#) "specific Gibb's free energies at 1 atm"


g_O2|o=enthalpy(O2,T=T)-T*entropy(O2,T=T,P=Po#)
g_N2|o=enthalpy(O2,T=T)-T*entropy(N2,T=T,P=Po#)

The partial pressure of each gas is determined and used in the definition of the equilibrium
constant. The mole fraction of NO can then be determined as the ratio of the partial pressure of
NO to the total pressure.

P_NO=n_NO/(n_NO+n_O2+n_N2+n_CO2+n_H2O)*P "partial pressure of NO"


P_O2=n_O2/(n_NO+n_O2+n_N2+n_CO2+n_H2O)*P "partial pressure of O2"
P_N2=n_N2/(n_NO+n_O2+n_N2+n_CO2+n_H2O)*P "partial pressure of N2"

K=P_NO^2/(P_O2*P_N2) "defn of equilibrium constant"


y_NO=P_NO/P "mole fraction of NO"

Solving, the mole fraction of NO at equilibrium is 0.0142.


S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

Small amounts of NO released to the environment can result in environmental problems.


S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-3
A mixture of methane and 350% stoichiometric pure oxygen at 25C, 1 bar is ignited in a
constant volume, well-insulated container. The only significant decomposition is assumed to be
that of carbon dioxide reacting to produce carbon monoxide and oxygen. Estimate the maximum
temperature, pressure and composition, assuming no hydrogen or decomposition products other
than carbon monoxide are present in the reaction vessel.

The volume of the cylinder is not specified so we are free to choose a size. Choose a basis of 1
kmol of CH4 and balance the reaction as far as possible.

$UnitSystem SI K Pa J molar
"CH4 + 3.5(2 O2) = a CO2 + b CO + 2 H2O + c O2"
"Basis: 1 mole of methane"
a+b=1 "C balance"
3.5*2*2=2*a+b+2+2*c "O balance with 250% stoichiometric O2"

The temperature, pressure and composition of the reactants are known, which allows the volume
and the enthalpy to be determined.

n_R=1+2*2 "moles of reactant gases"


T_R=convertTemp(C,K,25 [C]) "temperature of reactants"
P_R=1 [bar]*convert(bar,Pa) "pressure of reactants"
V=n_R*R#*T_R/P_R "volume of reactants"
H_R=enthalpy(CH4,T=T_R)+4*enthalpy(O2,T=T_R) "enthalpy of reactants"

The moles of product gas is determined in terms of coefficients a, b, and c, and then used to
determine the mole fraction of each gas, the enthalpy of the product gas mixture, and the
pressure of the products gases.

n_P=a+b+2+c "moles of product gases"


y_CO2=a/n_P; y_CO=b/n_P; y_H2O=2/n_P; y_O2=c/n_P "mole fractions"
H_P=a*enthalpy(CO2,T=T_P)+b*enthalpy(CO,T=T_P)+2*enthalpy(H2O,T=T_P)+&
c*enthalpy(O2,T=T_P) "enthalpy of products"
P_P=n_P*R#*T_P/V "pressure of product gases"
P=P_P*convert(Pa,bar) "final pressure in bar"

The reaction is adiabatic and no work is accomplished, so an energy balance requires the change
in internal energy to be zero. The internal energy of the gas mixture can be found using H-PV
where PV = n R T.

U_R=U_P "energy balance"


U_R=H_R-n_R*R#*T_R "internal energy of reactants"
U_P=H_P-n_P*R#*T_P "internal energy of products"

This problem is one equation short of being able to be solved. Temporarily enter a reasonable
guess value for the product temperature. It is expect to be hot so guess that T_P=2500 K.

T_P=2500 [K] "guess for temperature"


S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

Solve and check that the moles fractions are all greater than 0 and less than1. If the results
appear ok, update the guess values. We next will implement the Law of Mass Action which
provides the last relation between temperature and composition. With the Law of Mass Action
in place, it is not necessary to provide a guess for T_P so comment that equation out.

{T_P=2500 [K] "guess for temperature"}

DELTAG|o=-R#*T_P*ln(K) "Law of mass action"


DELTAG|o=1/2*g_O2|o+g_CO|o-g_CO2|o "standard state Gibbs free energy
change"
g_O2|o=enthalpy(O2,T=T_P)-T_P*entropy(O2,T=T_P,P=Po#) "standard-state Gibbs free energy of O2"
g_CO2|o=enthalpy(CO2,T=T_P)-T_P*entropy(CO2,T=T_P,P=Po#) "standard-state Gibbs free energy of
CO2"
g_CO|o=enthalpy(CO,T=T_P)-T_P*entropy(CO,T=T_P,P=Po#) "standard-state Gibbs free energy of CO"

K=(y_CO*P_P/Po#)*sqrt(y_O2*P_P/Po#)/y_CO2*(P_P/Po#) "equilibrium constant"

Solve: The final temperature, pressure and composition are:

P=17.67 [bar]
T_P=3292 [K]
y_CO=0.0001077 [-]
y_CO2=0.1249 [-]
y_H2O=0.25 [-]
y_O2=0.625 [-]

There is not much CO present in the reaction vessel.


S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-4
Methanol can be mixed with gasoline and used in internal combustion engines. The oxygen
provided in methanol can reduce the concentration of pollutants in the exhaust. Methanol can be
produced in many ways. One way is to react carbon monoxide with hydrogen according to the
following reaction.
CO 2H 2 CH 3OH (1)
a.) Calculate and plot the equilibrium yield of methanol per mole of CO at 125C as a function of
pressure for pressures between 1 and 10 bar. (Assume ideal gas behavior.) assuming that CO
and H2 are provided in stoichiometric proportions.

Choose a basis of 1 kmole of CO which reacts as indicated in Eq. (1). Enter the temperature and
a representative pressure. The pressure will later be varied in a Parametric table. Also enter the
initial moles of hydrogen. For this part of the problem, the initial moles of hydrogen is 2 so that
the hydrogen and carbon monoxide are provided in stoichiometric proportions. The effect of this
variable will be varied in part b.)

$UnitSystem SI K Pa J molar
"CO+2 H2=CH3OH"
"Basis: 1 kmol of CO"

$ifnot ParametricTable='Table 1'


P_b=5 [bar]
$endif
T=convertTemp(C,K,125 [C]) "temperature of reaction"
P=P_b*convert(bar,Pa) "pressure of reaction"
$ifnot ParametricTable='Table 2'
n_H2_0=2 "initial moles of H2 per mole of CO"
$endif

The number of moles of each gas are related with a reaction coordinate.

n_CH3OH=epsilon "moles of CH3OH at any point"


n_CO=1-epsilon "moles of CO at any point"
n_H2=n_H2_0-2*epsilon "moles of H2 at any point"

The total moles of gas are determined and used to define the mole fraction of each gas.

n_tot=n_H2+n_CO+n_CH3OH "total moles of gas"


y_CO=n_CO/n_tot; y_H2=n_H2/n_tot; y_CH3OH=n_CH3OH/n_tot

There is one degree of freedom, i.e., one more equation is needed to solve this problem. This
last degree of freedom relates to the chemical equilibrium between the gases. The Law of Mass
actions is

DELTAG|o=-R#*T*ln(K) "Law of Mass Action"


DELTAG|o=g_CH3OH|o-g_CO|o-2*g_H2|o "standard state Gibbs change of reaction"
g_CH3OH|o=enthalpy(CH3OH,T=T)-T*entropy(CH3OH,T=T,P=po#) "standard state Gibbs for CH3OH"
g_CO|o=enthalpy(CO,T=T)-T*entropy(CO,T=T,P=po#) "standard state Gibbs for CO"
g_H2|o=enthalpy(H2,T=T)-T*entropy(H2,T=T,P=po#) "standard state Gibbs for H2"
K=(y_CH3OH*P/Po#)/(y_CO*P/Po#*(y_H2*P/Po#)^2) "equilibrium constant"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The equations should now solve. Update the guess values and then create a Parametric table
with columns for variables P_b and n_CH3OH. A plot of the results obtained with the Solve
Table command is shown.

0.9

moles of CH3OH per mole of CO


0.8

0.7

0.6

0.5

0.4

0.3
1 2 3 4 5 6 7 8 9 10
Pb [bar]

b.) It is possible to provide excess carbon monoxide or excess hydrogen rather than
stoichiometric amounts of the two gases. What ratio of CO to H2 would you recommend if
the concentration of methanol is to be maximized at 125C and 5 bar?

Comment out the equation that sets the initial moles of H2 and define a variable Ratio as

Ratio=n_H2_0/1

Place limits of 0 and 1 are needed on the mole fractions to ensure that physically possible
solutions are obtained. Create a Parametric table in with columns for Ratio and y_CH3OH.
Ratio is varied from 0.5 to 5. A plot of the calculated results indicates that the highest mole
fraction will occur if the reactants are provided in stoichiometric proportions.
0.6

0.5
yCH3OH

0.4

0.3

0.2
0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Ratio
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-5
A gas mixture at 400C, consisting of 7.8% SO2, 10.8% O2 with the remainder being N2, is
passed through a catalytic converter in which the reaction
1/ 2 O 2 SO 2 SO3
occurs adiabatically. The percentages apply on a volumetric basis. Prepare a plot of the
equilibrium temperature at the reactor outlet as a function of pressure for pressures between 1
atm and 10 atm. Assume ideal gas behavior.

Choose a basis of 1 mole of reactant gas mixture. Note that volumetric percentages are
equivalent to molar percentages for ideal gas behavior. There are 4 gases. The initial moles of
each gas, relative to the chosen basis, is known. The reaction is shown above and the
stoichiometric coefficients for each gas are based on this reaction. Note that nitrogen does not
participate in the reaction so its stoichiometric coefficient is 0.

$UnitSystem SI K Pa kJ molar
$TabStops 0.2 3.5 in

"Basis: 1 mole of reactant gas mixture"


"SO2 + 1/2 O2 = SO3"

N_C=4 "number of gases in mixture"


SO2=1; n_0[SO2]=0.078; N$[SO2]='SO2'; nu[SO2]=-1 "data for SO2"
O2=2; n_0[O2]=0.108; N$[O2]='O2'; nu[O2]=-1/2 "data for O2"
SO3=3; n_0[SO3]=0; N$[SO3]='SO3'; nu[SO3]=1 "data for SO3"
N2=4; n_0[N2]=1-sum(n_0[i],i=1,3); N$[N2]='N2'; nu[N2]=0 "data for N2"

The pressure will be varied but first set it to 1 atm. The temperature of the reactants is known.
The properties of each gas at the reactant temperature are found by a call to the NASA external
program. The NASA program returns to the specific heat in kJ/kmol-K, the specific enthalpy in
kJ/kmol and the entropy of the gas at 1 atm in kJ/kmol-K.

P=P_a*convert(atm,Pa)
T_R=convertTemp(C,K,400 [C]) "temperature of reactant mixture"
duplicate i=1,N_C
h_0[i]=enthalpy(N$[i],T=T_R) " specific enthalpy at T_R"
end

The enthalpy of the reactant gas is the sum of the product of the initial molar amount of each gas
and its specific enthalpy.

H_R=sum(n_0[i]*h_0[i],i=1,N_C) "enthalpy of reactants"

The moles of each gas at any point in the reaction are related with the reaction coordinate.

duplicate i=1,N_C
n[i]=n_0[i]+nu[i]*epsilon "moles of each gas at any point in the reaction"
end
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The total moles of gas is found and used to determine the mole fraction of each gas.

n_tot=sum(n[i],i=1,N_C) "total moles of gas"


duplicate i=1,N_C
y[i]=n[i]/n_tot "mole fraction of each gas"
end

The NASA external program is again used to return the specific enthalpy and entropy of each gas
at the product gas temperature. The chemical potential of each gas is computed assuming ideal
gas behavior as h-T s

duplicate i=1,N_C
h[i]=enthalpy(N$[i],T=T) "specific enthalpy of gases"
g|o[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=Po#) "specific standard state Gibbs energy"
end

The Law of Mass Action is applied to determine the equilibrium amounts of each gas.

DELTAG|o=sum(nu[i]*g|o[i],i=1,N_C) "standard state Gibbs free energy change"


DELTAG|o=-R#*T*ln(K) "Law of Mass Action"
K=product((y[i]*P/Po#)^nu[i],i=1,N_C) "definition of the equilibrium contant"

The enthalpy of the product gas is the sum of the product of the molar amount and specific
enthalpy of each gas. The heat transfer from the reaction is the difference between the enthalpy
of the products and reactants.

H_P=sum(n[i]*h[i],i=1,N_C) "enthlapy of products"


Q=H_P-H_R "heat transfer per mole of gas mixture"

Before attempting to solve, set lower and upper limits for each mole fraction to be 0 and 1,
respectively using the Variable Info command (Options men). Next, enter a guess for the
temperature. This guess will be removed shortly.

T=1000 [K] "guess for T"

Solve and update the guess values. Now comment out the guess and in its place, specify the heat
transfer to be zero for the adiabatic reaction.

{T=1000 [K] "guess for T"}


Q=0 [kJ/kmol] "adiabatic reaction"

Create a Parametric table and include columns for P_a, T, and the mole fraction of each gas. Fill
the P_a column with pressures between 1 and 10 atm. Solve the table. A plot of the equilibrium
product gas temperature versus pressure is shown below.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

880

875

870

T [K]
865

860

855
1 2 3 4 5 6 7 8 9 10
Pa [atm]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-6
Portable propane stoves are a concern because they can easily be dropped which could cause
them to malfunction resulting in carbon monoxide generation. Also, the stoves are sometimes
used in closed spaces, against manufacturers guidelines. Assume that the products consist of
CO2, CO, O2, N2 and H2O. Plot the mole fraction of CO versus % theoretical air for values
between 80% and 200% at temperatures of 1000 K, 1500 K and 2000 K. What conditions result
in the largest mole fraction of carbon monoxide?

Choose a basis of 1 kmol of propane and write the chemical reaction. The pressure is assumed to
be atmospheric. The % theoretical air and temperature are set to representative values. They
will later be varied in a Parametric table.

$UnitSystem SI K Pa J molar
$TabStops 0.2 4 in

"Basis: 1 kmole of C3H8


C3H8 + a(O2 + 3.76 N2) = b CO2 + c CO + d O2 + e N2 + 4 H2O"

P=1 [atm]*convert(atm,Pa) "atmospheric pressure"

$ifnot ParametricTable
Theoretical%=100 [%] "air-fuel ratio"
T=1500 [K] "temperature of combustion gas"
$endif

The moles of oxygen at stoichiometric conditions are found to be 5. The known % theoretical air
determines the value of a. No NO or H2 are assumed in this analysis since the only concern is
CO. Balances are written on each of the elements.

2*a_stoic=3*2+4 "stoichiometric value of a"


Theoretical%=a/a_stoic*100 [%] "% theoretical air"
b+c=3 "C balance"
2*a=2*b+c+2*d+4 "O balance"
3.76*a*2=2*e "N balance"

The total moles of gas are computed and used to define the mole fractions.

n_tot=b+c+d+e+4 "total moles of gas"


y_CO2=b/n_tot; y_CO=c/n_tot; y_O2=d/n_Tot "mole fractions"

The concern in this problem is the chemical equilibrium between CO, O2 and CO2. The
distribution of these gases is determined using the Law of Mass Action.

"CO2 = CO + 1/2 O2"


DELTAG|o=-R#*T*ln(K) "Law of Mass Action"
DELTAG|o=g|o_CO+1/2*g|o_O2-g|o_CO2 "DELTAG|o for CO2 decomposition"

g|o_CO=enthalpy(CO,T=T)-T*entropy(CO,T=T,P=y_CO*P) "Standard-state Gibbs for CO"


g|o_CO2=enthalpy(CO2,T=T)-T*entropy(CO2,T=T,P=y_CO2*P) "Standard-state Gibbs for CO2"
g|o_O2=enthalpy(O2,T=T)-T*entropy(O2,T=T,P=y_O2*P) "Standard-state Gibbs for O2"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

K=sqrt(y_O2*P/Po#)*(y_CO*P/Po#)/(y_CO2*P/Po#) "equilibrium constant definition"

Use the Variable Info dialog (Options menu) to set lower and upper limits for the mole fractions
and a lower limit for K of 0. Solve and update the guess values.

Create Parametric tables with columns for Theoretical%, T, y_CO. Fill the Theoretical% column
with values between 80 and 200. Fill the T columns with 1000 K. Duplicate the table and
change the temperature to 1500 K. Duplicate the table and change the temperature to 2000 K.
Solve all 3 tables (this can be done simultaneously). A plot of the results appears below. High
temperatures appear to be the concern for CO generation.
0.1

0.01 2000 K
yCO

0.001
1500 K

1000 K
0.0001
80 100 120 140 160 180 200
Theoretical%
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-7
One method of producing hydrogen gas is to react hydrogen sulfide (H2S) with water vapor in
proportions of 1 mole of H2S to 5 moles of water vapor. The mixture of H2S and H2O is
provided to the reaction at 1.5 atm and 110C. The vapor phase reaction is
H 2S 2 H 2 O 3H 2 SO 2
Calculate and plot the required heat input per mole of H2 produced and the equilibrium mole
fraction of hydrogen from this reaction as a function of temperature for temperatures between
1000 K and 1500 K.

Choose a basis of 1 mole of H2S. The pressure and temperature of the reactants are known. The
temperature of the products will be varied between 1000 and 1500 K.

$UnitSystem SI K Pa kJ molar
"H2S + 2 H2O = 3 H2 + SO2"

P=1.5 [atm]*convert(atm,Pa)
T_R=convertTemp(C,K,110 [C]) "temperature of reactants"
$ifnot ParametricTable
T=1000 [K] "representative temperature"
$endif

Enter an index (1 to 4), the name, the stoichiometric coefficient and the initial molar amounts of
each of the 4 gases.

N_C=4 "number of gases"


H2S=1; N$[H2S]='H2S'; nu[H2S] = -1; n_0[H2S]=1 "index, name, stoichiometric coefficient, and
initial amount of each gas"
H2O=2; N$[H2O]='H2O'; nu[H2O]=-2; n_0[H2O]=5
H2=3; N$[H2]='H2'; nu[H2]=3; n_0[H2]=0
SO2=4; N$[SO2]='SO2'; nu[SO2]=1; n_0[So2]=0

Call the NASA procedure to determine the specific enthalpy of all four gases at temperature
T_R. The enthalpy of the supplied mixture can then be defined. Note that the NASA procedure
returns the specific enthalpy in units of kJ/kmol.

duplicate i=1,N_C
h_R[i]=enthalpy(N$[i],T=T_R) "determines specific enthalpy of reactants"
end
H_R=sum(n_0[i]*h_R[i],i=1,N_C) "enthalpy of reactants"

The number of moles of each gas in this reaction is related through the reaction coordinate. The
total moles is the sum of the moles of all four gases. The mole fraction is the moles of each gas
divided by the total moles of gas.

duplicate i=1,N_C
n[i]=n_0[i]+nu[i]*epsilon "moles of each gas at equilibrium"
y[i]=n[i]/n_tot "mole fraction of each gas"
end
n_tot=sum(n[i],i=1,N_C) "total moles of gas"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The specific enthalpy and entropy at 1 atm for each gas are determined and used to determine the
specific Gibbs free energy at 1 atm for each gas.

duplicate i=1,N_C
h[i]=enthalpy(N$[i],T=T) "properties of gases"
g|o[i]=h[i]-T*entropy(N$[i],T=T,P=Po#) "Gibbs free energy for each gas"
end

Implement the Law of Mass Action for this single reaction.

DELTAG|o=sum(nu[i]*g|o[i],i=1,N_C) "Standard-state Gibbs free energy change"


DELTAG|o=-R#*T*ln(K) "Law of mass action"
K=product((y[i]*P/Po#)^nu[i],i=1,N_C) "equilibrium constant"

The enthalpy of the products is defined and used to calculate Q, the heat transfer per mole of
H2S. However, only n[H2] moles of hydrogen are produced for each mole of H2S, so the heat
transfer per mole of hydrogen is found by dividing Q by the moles of hydrogen that are
produces.

H_P=sum(n_0[i]*h[i],i=1,N_C) "enthalpy of products"


Q=H_P-H_R "required heat input per mole of H2S"
Q_H2=Q/n[H2] "required heat per mole of H2"

Create a Parametric table with columns for T, Q_H2, and y[3]. Set values of T between 1000 K
and 1500 K. Solve the table and use the results to prepare the following plot.
6
2.5x10 0.1
Required heat transfer [kJ/kmol]

Hydrogen mole fraction 0.09


6
2.0x10 0.08
Heat transfer
0.07
6
1.5x10 0.06

0.05
y[3]

6
1.0x10 0.04

0.03
5
5.0x10 0.02

0.01
0
0.0x10 0
1000 1100 1200 1300 1400 1500
T [K]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-8
The dissociation of the hydrogen molecule (H2) into elemental hydrogen atoms is being studied
at high temperatures and 1 atm total pressure. Prepare a plot of the mole fraction of elemental
hydrogen as a function of temperature for temperatures between 3000 K and 4000 K by directly
minimizing the Gibbs free energy.

Choose a basis of 1 kmol of H2 gas. Enter a temperature, which will later be varied and the
pressure.

$UnitSystem SI K Pa kJ molar
"H2=2 H"

$ifnot Parametric Table


T=3800 [K]
$endif
P=1 [atm]*convert(atm,Pa) "pressure"

Enter the identification for each gas and set up the number of moles in terms of the reaction
coordinate.

n[H2]=1-epsilon "balances using a reaction coordinate"


n[H]=2*epsilon
n_tot=1+epsilon

For each gas, determine the mole fraction, standard-state Gibbs free energy and chemical
potential. Note that elemental hydrogen property information is not provided directly in EES,
but it is provided in the NASA external procedure.

duplicate i=1,2
y[i]=n[i]/n_tot "mole fraction"
call NASA(N$[i],T: cp[i],h[i],s|o[i]) "properties"
g|o[i]=h[i]-T*s|o[i] "standard state Gibbs energy"
mu[i]=g|o[i]+R#*T*ln(y[i]*P/Po#) "chemical potential"
end

The Gibbs free energy is the sum of the product of the moles of each gas and it chemical
potential

G=sum(n[i]*mu[i],i=1,2) "Gibbs free energy of mixture"

The equilibrium solution results when G is at a minimum. Use the MinMax command to
minimize G with respect to epsilon. Limits on epsilon are set to 0 and 1, which ensures that the
mole fractions will not become negative. At 3800 K, the Min/Max commend will return a value
of epsilon=0.484 with a corresponding H mole fraction of 0.65. Create a Parametric table with
columns for T, G, epsilon, y[1] and y[2]. Use the Min/Max table command to minimize the G
with respect to epsilon for each row in the table. A plot of the resulting mole fraction of H
versus temperature is shown.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

0.8

0.7

mole fraction of H
0.6

0.5

0.4

0.3

0.2

0.1
3000 3200 3400 3600 3800 4000
T [K]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-9
When ammonia dissociates into hydrogen and nitrogen according to NH 3 1/ 2 N 2 3 / 2 H 2 ,
the moles of gas are increased. An engineer has proposed that the increased moles would
increase the pressure and thus the power output of a turbine. As a preliminary evaluation of this
concept, assume ammonia enters an isentropic turbine at 300C and 3.5 bar and is exhausted to 1
bar. Assume ideal gas behavior.

a.) Calculate the work per mole of ammonia, assuming dissociation does not occur.

The temperature and pressure at the turbine inlet and the pressure at the turbine outlet are known.

$UnitSystem SI K Pa J molar
T_in=convertTemp(C,K,300 [C]) "inlet ammonia temperature"
P_in=3.5 [bar]*convert(bar, Pa) "inlet ammonia pressure"
P_out=1 [bar]*convert(bar, Pa) "turbine exit pressure"

Choose a basis of 1 kmol of ammonia. The enthalpy and entropy of the ammonia at the turbine
inlet can be determined.

H_in=enthalpy(NH3,T=T_in) "enthalpy per mole at turbine inlet"


S_in=entropy(NH3,T=T_in,P=P_in) "entropy per mole at turbine inlet"

An energy balance on the adiabatic turbine indicates that the work out per mole of ammonia is
the difference between the enthalpy at the inlet and outlet. An entropy balance for the isentropic
turbine requires the entropy at the inlet to be equal to the entropy at the outlet.

S_out=S_in "isentropic turbine"


H_in=W+H_out "energy balance"

Assuming no dissociation occurs, the enthalpy and entropy at the turbine exit are the specific
enthalpy and entropy of the ammonia exiting the turbine.

H_out=enthalpy(NH3,T=T_out) "enthalpy assuming no dissociation"


S_out=entropy(NH3,T=T_out,P=P_out) "entropy assuming no dissociation"

These equations are sufficient to solve the problem, but a solution is not likely to be obtained
until the guess value for T_out is set to a reasonable value, e.g., 300 K. Use the Variable Info
dialog in the Options menu to change the guess value. Solve to find that the work is 5.3
MJ/kmol, with an outlet ammonia temperature of 447.9 K.

b.) Calculate the work per mole of ammonia, assuming chemical equilibrium is
achieved. NH 3 1/ 2 N 2 3 / 2 H 2 . Compare the result with the value from part a.

When dissociation occurs, the enthalpy and entropy at the turbine outlet depend on the amounts
of all three gases. Comment out the equations entered for part a that set the enthalpy and
entropy.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

{H_out=enthalpy(NH3,T=T_out) "enthalpy assuming no dissociation"


S_out=entropy(NH3,T=T_out,P=P_out) "entropy assuming no dissociation"}

A chemical equilibrium analysis is needed to determine the composition at the turbine outlet.
The Law of Mass Action will be used. Identify each of the gases.

"Basis: 1 kmol of NH3"


"NH3 = 1/2 N2 + 3/2 H2"

NH3=1; N$[NH3]='NH3'; nu[NH3]=-1 "identify gases and stoichiometric


coefficients"
N2=2; N$[N2]='N2'; nu[N2]=1/2
H2=3; N$[H2]='H2'; nu[H2]=3/2

Write elements balances for N and H. The total moles of gas can be determined by summing the
moles of each gas.

2*n[N2]+n[NH3]=1 "N balance"


2*n[H2]+3*n[NH3]=3 "H balance"
n_tot=sum(n[i],i=1,3) "total moles of gas"

For each gas, determine the mole fraction, the specific enthalpy, specific entropy and specific
Gibbs energy at one atmosphere pressure.

duplicate i=1,3
y[i]=n[i]/n_tot "mole fractions"
h[i]=enthalpy(N$[i],T=T_out) "specific enthalpy of each gas"
s[i]=entropy(N$[i],T=T_out,P=y[i]*P_out) "specific entropy of each gas"
g|o[i]=h[i]-T_out*entropy(N$[i],T=T_out,P=Po#) "specific Gibbs energy for each gas"
end

The enthalpy and entropy of the mixture at the turbine outlet (assuming ideal gases) can be
determined.

H_out=sum(n[i]*h[i],i=1,3) "enthalpy at turbine exit"


S_out=sum(n[i]*s[i],i=1,3) "entropy at turbine exit"

The Law of Mass Action is implemented by calculating the standard state Gibbs free energy
change of reaction and applying the definition of the equilibrium constant.

DELTAG|o=3/2*g|o[H2]+1/2*g|o[N2]-g|o[NH3] "Standard-state Gibbs free energy


change"
DELTAG|o=-R#*T_out*ln(K) "Law of Mass Action"
K=product((y[i]*P_out/Po#)^nu[i],i=1,3) "equilbrium constant"

These equations are sufficient to solve the problem, but guess values and limits must be entered.
Set lower and upper limits of 0 and 1 for the mole fractions. Set a lower limit of 200 K for T_out
and a lower limit of 0 for K. Solve. The work per mole of ammonia is 6.393 MJ/kmol with an
outlet temperature of 328.3 K. There is a 20% increase in work output when dissociation occurs,
so the ideal may be sound.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-10
1 H
An effective molar specific heat capacity of a mixture can be defined as
n T P
where n is the total moles of the mixture and H is the enthalpy of the mixture. An augmentation
of the effected molar specific heat can result when a chemical reaction occurs as a result of a
temperature change. An example of this situation can occur in mixtures of NO2 and N2O4, for
which the reaction N 2 O 4 2 NO 2 achieves chemical equilibrium rapidly at the temperatures
considered in this problem. Calculate and plot the effective molar specific heat capacity of an
equilibrium mixture of NO2 and N2O4 as a function of temperature for temperatures between 300
K and 400 K at 1 atm and at 5 atm. Compare the effective specific with the frozen specific heat
capacity, i.e., the specific heat capacity of the mixture at the equilibrium composition, assuming
no reaction occurs.

The specific enthalpy of the gas mixture is


2

n h i i
h i 1
2
(1)
n
i 1
i

The effective molar specific heat capacity of the mixture can be approximated as

h hT hT
c p ,eff
(2)
T P T T

where hT and hT are the specific molar enthalpies at temperature just a little greater and a little
less than T. The frozen specific heat capacity is simply

2
c p , frozen yi c p ,i (3)
i 1

The effective specific heat capacity will be determined numerically using equation (2).
Chemical equilibrium will be determined at several temperatures so it is convenient to provide a
Subprogram that does this calculation. The calculation is a straightforward application of the
Law of Mass Action at a given temperature and pressure, supplied as arguments to the
Subprogram. A reaction coordinate is used to keep track of the molar amounts of the two gases.
A basis of 1 mole of N2O4 is assumed, but the actual starting conditions have no effect on the
effective specific heat. The frozen specific heat is calculated as the mole-fraction weighted
average of the specific heats of the gases at the equilibrium composition.

$UnitSystem SI K Pa kJ
$TabStops 0.2 0.4 3.5

Subprogram ChemEQ(T,P:h,cp)
"N2O4=2 NO2"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

N2O4=1; N$[N2O4]='N2O4' "identify gases"


NO2=2; N$[NO2]='NO2'

"Basis: 1 mole of N2O4"


n[N2O4]=1-epsilon "reaction coordinate keeps track of moles"
n[NO2]=2*epsilon
n_tot=n[NO2]+n[N2O4] "total moles of gas"

duplicate i=1,2
y[i]=n[i]/n_tot "mole fraction of each gas"
h[i]=enthalpy(N$[i],T=T) "specific enthalpy of each gas"
cp[i]=cp(N$[i],T=T) "specific heat of each gas"
s|o[i]=entropy(N$[i],T=T,P=Po#) "specific entropy of each gas at 1 atm"
g|o[i]=h[i]-T*s|o[i] "specific Gibbs of each gas at 1 atm"
end

DELTAG|o=2*g|o[NO2]-g|o[N2O4] "standard-state Gibbs energy change"


DELTAG|o=-R#*T*ln(K) "Law of Mass Action"
K=(y[NO2]*P/Po#)^2/(y[N2O4]*P/Po#) "definition of equilibrium coefficient"

h=sum(y[i]*h[i],i=1,2) "specific enthalpy of mixture"


cp=sum(y[i]*cp[i],i=1,2) "specific heat capacity of frozen mixture"
end

Set lower and upper bounds for the mole fractions to be 0 and 1, respectively. Also set a lower
bound of 0 for the equilibrium constant. These settings are done with the Variable Information
command in the Options menu. Use the pull down list at the top of the window to select the
ChemEQ Subprogram.

The temperature and pressure are specified in Parametric tables, but can be entered into the
Equations window for testing. The temperature derivative of enthalpy is estimated by
determining the enthalpy at one degree above and below the temperature of interest. Calls to the
ChemEQ Subprogram return the specific enthalpy at the specified temperature and pressure.

$ifnot ParametricTable
T=300 [K]
P_a=1 [atm]
$endif

P=P_a*convert(atm, Pa)

T|plus=T+1 [K]; T|minus=T-1 [K] "numerical estimate of cp"


call ChemEQ(T|plus,P:h|plus,cp1)
call ChemEQ(T|minus,P:h|minus,cp2)
cp_eff=(h|plus-h|minus)/(T|plus-T|minus)
call ChemEQ(T,P:h,cp_frozen) "specific heat for frozen mixture"

Create Parametric tables with columns for T, P_a, cp_eff and cp_frozen. Fill the temperature
columns with values between 300 K and 400 K. Fill the pressure column with 1 atm or 5 atm. A
plot of the calculated specific heat capacities at 1 and 5 atm appears as follows.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

350

Specific Heat Capacity [kJ/kmol-K]


Apparent (1 atm)
300
Apparent (5 atm)
250

200

150

100 Frozen (5 atm)

50
Frozen (1 atm)
0
300 320 340 360 380 400
Temperature [K]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-11
Hydrogen cyanide gas can be formed by reacting acetylene and nitrogen gases in stoichiometric
proportions, according to C2 H 2 N 2 2HCN at 300C. It has been proposed that the
equilibrium mole fraction of HCN could be increased by increasing the pressure. To check this
possibility, prepare a plot of the mole fraction of HCN versus pressure for pressures between 1
and 200 atm. At the high pressures encountered, non-ideal gas behavior is expected. Assume
that the gases form an ideal solution. Critical point property information for the gases is shown
in Table 14.A.11.

Table 14.A-11: Critical properties for C2H2, N2, and HCN


C2H2 N2 HCN
Tcrit [K] 308.3 226.2 456.8
Pcrit [atm] 60.6 33.5 53.2
acentric
0.184 0.040 0.399
factor

Choose a basis of 1 mole of C2H2. Identify each gas and its stoichiometric coefficient. Enter the
temperature and a pressure. The pressure will later be varied.

$UnitSystem SI K Pa J molar
$TabStops 0.25 3.5 in

"C2H2+N2 = 2 HCN"
"Basis: 1 mole of C2H2+1 mole of N2"

C2H2=1; N$[C2H2]='C2H2'; nu[C2H2]=-1


N2=2; N$[N2]='N2'; nu[N2]=-1
HCN=3; N$[HCN]='HCN'; nu[HCN]=2

T=convertTemp(C,K,300 [C])
$ifnot ParametricTable
P_a=100 [atm]
$endif

P=P_a*convert(atm,Pa)

The moles of each gas are related to a reaction coordinate. The total moles are determined and
used to calculate the mole fraction. Properties are found at the specified temperature and used to
determine the specific Gibbs energy at 1 atm.

n[C2H2]=1-epsilon
n[N2]=1-epsilon
n[HCN]=epsilon

n_tot=sum(n[i],i=1,3)
duplicate i=1,3
y[i]=n[i]/n_tot
h[i]=enthalpy(N$[i],T=T)
s|o[i]=entropy(N$[i],T=T,P=y[i]*P)
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

g|o[i]=h[i]-T*s|o[i]
end

Enter the critical property information in the problem state. It can be used to determine the
reduced temperature and pressure for each gas, which then is used to determine the fugacity of
each gas using the FUGCOEF (fugacity coefficient) function provided in the GENEOS external
library. This external function used the Redlich-Kwong-Soave equation of state to determine the
fugacity coefficient. The product of the fugacity coefficient and pressure is the fugacity.

T_c[C2H2]=308.3 [K]; P_c[C2H2]=60.6[atm]; omega[C2H2]=0.184


T_c[N2]=126.2 [K]; P_c[N2]=33.5 [atm]; omega[N2]=0.04
T_c[HCN]=456.8 [K]; P_c[HCN]=53.2 [atm]; omega[HCN]=0.399

duplicate i=1,3
T_r[i]=T/T_c[i] "critical temperature"
P_r[i]=P_a/P_c[i] "reduce pressure"
f[i]=FUGCOEF(T_r[i],P_r[i],omega[i])*P "fugacity"
end

Enter the Law of Mass Action. Note that fugacity of each gas replaces pressure in the
equilibrium constant.

DELTAG|o=2*g|o[HCN]-g|o[N2]-g|o[C2H2] "standard-state Gibbs free energy change"


DELTAG|o=-R#*T*ln(K) "Law of mass action"
K=product((y[i]*f[i]/Po#)^nu[i],i=1,3) "definition of equil. constant"

Use the Variable Information dialog to set lower and upper limits of 0 and 1 for the mole
fractions. Set a lower limit of 0 for K as well.

Create a Parametric table with columns for P_a and y[3]. A plot of the results shows that
pressure has a small, but positive effect on the mole fraction of HCN.
0.11

0.105

0.1
y[3]

0.095

0.09

0.085
0 50 100 150 200
Pa [atm]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.A-12
The reaction forming hydrogen from methane and water is CH 4 H 2 O 3H 2 CO . One more
of methane and four moles of water mixed together and heated to 1000 K. Prepare a plot of the
pressure required to obtain 1.5 moles of hydrogen as a function of the temperature for
temperatures between 800 K and 1200 K, assuming ideal gas behavior.

This problem is easily solved using a reaction coordinate to determine the molar amounts and
mole fractions of each species. The reaction coordinate is defined as
ni
dni ni ni ,0
o
ni ,0
i

i
(1)

We set the initial value of the reaction coordinate to zero. The stoichiometric coefficients are
evident from the reaction. We know that the initial amounts of methane and water are 1 and 4
moles, respectively.

$UnitSystem SI K Pa J molar
"CH4+H2O = 3 H2 + CO"
epsilon=(n_CH4-1)/(-1) "definition of reaction coordinate"
epsilon=n_H2/3
epsilon=(n_H2O-4)/(-1)
epsilon=n_CO

We know that the moles of hydrogen is 1.5. That allows all other molar amounts to be
determined. The total moles of gas is found and used to determine the mole fraction of each gas.

n_H2=1.5 "moles of hydrogen"


n_tot=n_CH4+n_H2+n_CO+n_H2O
y_CH4=n_CH4/n_tot "mole fractions"
y_H2O=n_H2O/n_tot
y_H2=n_H2/n_tot
y_CO=n_CO/n_tot

Next, the Standard-State Gibbs Free energy change of reaction is determine by evaluating h-T s
at the reaction temperature and atmospheric pressure for each gas. Set the temperature to be
1000 K. It will be varied later.

$ifnot ParametricTable
T=1000 [K]
$endif
DELTAG|o=3*g|o_H2+g|o_CO-g|o_CH4-g|o_H2O "standard-state change in Gibbs free energy"
g|o_H2=enthalpy(H2,T=T)-T*entropy(H2,T=T,P=Po#)
g|o_H2O=enthalpy(H2O,T=T)-T*entropy(H2O,T=T,P=Po#)
g|o_CH4=enthalpy(CH4,T=T)-T*entropy(CH4,T=T,P=Po#)
g|o_CO=enthalpy(CO,T=T)-T*entropy(CO,T=T,P=Po#)

The Law of Mass Action is applied to determine the pressure of the reaction.

DELTAG|o=-R#*T*ln(K) "Law of mass action"


S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

K=(y_H2*P/Po#)^3*(y_CO*P/Po#)*(y_CH4*P/Po#)^(-1)*(y_H2O*P/Po#)^(-1) "equilibrium constant"


P\bars=P*convert(Pa,bar) "pressure in bars"

Create a Parametric table with columns for T and P\bars. The plot indicates that the required
pressure increases greatly with increased temperature. The kinetics of the reaction would likely
also increase.
300

100
Pars [bar]

10

1
800 850 900 950 1000 1050 1100 1150 1200
T [K]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-1
Furnaces are designed so that the combustion of the fuel occurs with excess air. However, an
improperly sized fuel jet or an air restriction can result in insufficient air supply. The major
concern in this case is the formation of carbon monoxide gas, which is deadly. In the present
case, the fuel is methane. The combustion gas that exits the furnace when 90% of theoretical air
is provided is believed to be a mixture of CH4, CO2, CO, N2, NO, H2O, H2 and O2.
a.) Prepare a plot of the mole fraction of CO versus temperature for temperatures between 1500
K and 2500 K at atmospheric pressure using the LaGrange method.

Choose a basis of 1 kmol of CH4 and write the reaction of CH4 with 90% of theoretical air to
produce the gases found in the products. There are 8 product gases composed of 4 elements,
which indicates that there are 4 degrees of freedom. For convenience, number the elements and
gases so that they can be used with arrays.

$UnitSystem SI K Pa J molar
$TabStops 0.2 1,2,3,4 in

"Basis: 1 kmol of CH4 with 90% theoretical air"


"CH4 + 0.9*2*(O2+3.76 N2) = n[CH4] CH4 + n{CO2] CO2 + n[CO] CO + n[N2] N2 + n[NO] NO +
n[H2O]H2O + n[H2] H2 + n[O2] O2"

N_E=4 "number of elements"


C=1; H=2; O=3; N=4; "element indices"
N_C=8 "number of gases"
CH4=1; N$[CH4]='CH4' "gase indices and names"
CO2=2; N$[CO2]='CO2'
CO=3; N$[CO]='CO'
N2=4; N$[N2]='N2'
NO=5; N$[NO]='NO'
H2O=6; N$[H2O]='H2O'
H2=7; N$[H2]='H2'
O2=8; N$[O2]='O2'

Element balances for C, H, O and N are written. The total moles of product gas is found by
summing the moles of each gas and it is used to calculate the mole fraction of each gas.

n[CH4]+n[CO2]+n[CO]=1 "C balance"


4*n[CH4]+2*n[H2O]+2*n[H2]=4 "H balance"
2*n[CO2]+n[CO]+n[NO]+n[H2O]+2*n[O2]=1.8*2 "O balance"
2*n[N2]+n[NO]=1.8*3.76*2 "N balance"
n_tot=sum(n[i],i=1,N_C) "total moles of gas"
duplicate i=1,N_C
y[i]=n[i]/n_tot "mole fraction"
end

The LaGrange formulation requires a matrix containing the derivative of each of element
balances with respect to the number of moles of each gas. These partial derivatives can be found
by inspection of the element balance and they are placed in two-dimensional array e.

e[CH4,C]=1; e[CH4,H]=4; e[CH4,O]=0; e[CH4,N]=0; "element indices for CH4"


e[CO,C]=1; e[CO,H]=0; e[CO,O]=1; e[CO,N]=0; "element indices for CO"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

e[CO2,C]=1; e[CO2,H]=0; e[CO2,O]=2; e[CO2,N]=0; "element indices for CO2"


e[H2,C]=0; e[H2,H]=2; e[H2,O]=0; e[H2,N]=0; "element indices for H2"
e[H2O,C]=0; e[H2O,H]=2; e[H2O,O]=1; e[H2O,N]=0; "element indices for H2O"
e[O2,C]=0; e[O2,H]=0; e[O2,O]=2; e[O2,N]=0; "element indices for O2"
e[N2,C]=0; e[N2,H]=0; e[N2,O]=0; e[N2,N]=2; "element indices for N2"
e[NO,C]=0; e[NO,H]=0; e[NO,O]=1; e[NO,N]=1; "element indices for NO"

The temperature and pressure are specified. Temperature will later be varied between 1500 and
2500 K in a Parametric table.

P=Po# "atmospheric pressure"


$ifnot ParametricTable
T=2000 [K] "temperature of products"
$endif

The chemical potential and specific enthalpy of each gas in the products is determined.

duplicate i=1,N_C
mu[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=y[i]*P) "chemical potentials"
h[i]=enthalpy(N$[i],T=T) "specific enthalpies"
end

The LaGrange formulation requires that

E j
i j for i =1, C (1)
j 1 ni
n j j i

These equations can be formulated in the following EES code.

duplicate i=1,N_C
mu[i]+sum(lambda[j]*e[i,j],j=1,N_E)=0 "Lagrange method"
end

The code will likely not solve until the lower and upper limits of 0 and 1 are entered for all mole
fractions. This can be done for the entire y[] array by unchecking Show array variables.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The problem should now solve. Create a Parametric table with columns for T and y[3]. Fill the
T column with values from 1500 to 2500 K and solve the table. Plot the results.
0.038
exothermic endothermic
0.036

0.034

CO mole fraction
0.032

0.03

0.028

0.026

0.024

0.022

0.02
1500 1700 1900 2100 2300 2500
Temperature [K]

b.) What is the maximum temperature that the combustion products gas mixture can reach
without external heating?

The highest temperature will occur when the reaction is adiabatic. In this case the enthalpy of
the reactants will be equal to the enthalpy of the products. The reactant composition and
temperature and known and the enthalpy of the reactants can be directly calculated. The
enthalpy of the products is the sum of the product of the moles of each gas and it specific
enthalpy. The heat, Q, is the difference between the enthalpy of the reactants and the enthalpy of
the products.

T_R=convertTemp(C,K,25 [C]) "temperature of reactants"


H_R=enthalpy(CH4,T=T_R)+1.8*enthalpy(O2,T=T_R)+&
1.8*3.76*enthalpy(N2,T=T_R) "enthalpy of reactants"
H_P=sum(n[i]*h[i],i=1,N_C) "enthalpy of products"
Q=H_P-H_R "energy balance"

Add Q to the Parametric table and resolve the table. A plot of Q versus T shows that the reaction
is adiabatic for a temperature of about 2210 K so that would be the maximum attainable
temperature unless external heating were provided.
8
1.5x10
8
1.0x10
7
5.0x10
0
0.0x10
Q [J/kmol]

7 exothermic endothermic
-5.0x10
8
-1.0x10
8
-1.5x10
8
-2.0x10
8
-2.5x10
8
-3.0x10
1500 1700 1900 2100 2300 2500
T [K]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-2
The combustion process that occurs in spark-ignition engines produces small amounts of carbon
monoxide (CO), nitrogen oxide (NO) and nitrogen dioxide (NO2). Although the amounts of
these gases that are produced are small, the large number of engines and the subsequent reactions
involving these gases that take place in the atmosphere causes these gases to be a concern.
Assume that octane (C8H18) and air are provided in stoichiometric amounts at atmospheric
pressure and 25C to an engine and that the combustion process occurs adiabatically. Estimate
the molar amounts of CO, NO and NO2 that are produced for each molar of octane combusted
and the adiabatic combustion temperature.

Choose a basis of 1 kmol of C8H18 and determine the moles of oxygen needed for stoichiometric
combustion. There are 7 gases in the products representing 4 elements. There are therefore 3
degrees of freedom that are constrained by chemical equilibrium concerns. Enter array indices
for the elements and gases along with the names of the gases.

$UnitSystem SI K Pa J molar
$TabStops 0.2 1 2 3 4 in

"Basis: 1 kmol of C8H18"


"C8H18 + a(O2 + 3.76 N2) = n[CO2] CO2 + n[CO] CO +n[O2] O2 + n[N2] N2 + n[NO] NO+ n[NO2] NO2 +
n[H2O] H2O"

2*a=8*2+9 "stoichiometric amount of O2"

N_E=4 "number of elements"


C=1; H=2; O=3; N=4; "element indices"
N_C=7 "number of gases"
CO2=1; N$[CO2]='CO2' "gase indices and names"
CO=2; N$[CO]='CO'
O2=3; N$[O2]='O2'
N2=4; N$[N2]='N2'
NO=5; N$[NO]='NO'
NO2=6; N$[NO2]='NO2'
H2O=7; N$[H2O]='H2O'

Balances are written for each element. The total moles of gas is determined and used to define
the mole fraction for each gas.

n[CO2]+n[CO]=8 "C balance"


2*n[H2O]=18 "H balance"
2*n[CO2]+n[CO]+2*n[O2]+n[NO]+2*n[NO2]+n[H2O]=2*a "O balance"
2*n[N2]+n[NO]+n[NO2]=a*3.76*2 "N balance"
n_tot=sum(n[i],i=1,N_C) "total moles of gas"
duplicate i=1,N_C
y[i]=n[i]/n_tot "mole fraction"
end

The LaGrange formulation requires a matrix containing the derivative of each of element
balances with respect to the number of moles of each gas. These partial derivatives can be found
by inspection of the element balance and they are placed in two-dimensional array e.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

e[CO,C]=1; e[CO,H]=0; e[CO,O]=1; e[CO,N]=0; "element indices for CO"


e[CO2,C]=1; e[CO2,H]=0; e[CO2,O]=2; e[CO2,N]=0; "element indices for CO2"
e[O2,C]=0; e[O2,H]=0; e[O2,O]=2; e[O2,N]=0; "element indices for O2"
e[N2,C]=0; e[N2,H]=0; e[N2,O]=0; e[N2,N]=2; "element indices for N2"
e[NO,C]=0; e[NO,H]=0; e[NO,O]=1; e[NO,N]=1; "element indices for NO"
e[NO2,C]=0; e[NO2,H]=0; e[NO2,O]=2; e[NO2,N]=1; "element indices for NO2"
e[H2O,C]=0; e[H2O,H]=2; e[H2O,O]=1; e[H2O,N]=0; "element indices for H2O"

The pressure and a guess for the temperature are provided. The guess will be deleted when the
adiabatic energy balance is entered.

P=Po# "atmospheric pressure"


T=2500 [K] "guess for T"

The chemical potential and specific enthalpy of each gas in the products is determined.

duplicate i=1,N_C
mu[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=y[i]*P) "chemical potentials"
h[i]=enthalpy(N$[i],T=T) "specific enthalpies"
end

The LaGrange formulation requires that

E j
i j for i =1, C (1)
j 1 ni
n j j i

These equations can be formulated in the following EES code.

duplicate i=1,N_C
mu[i]+sum(lambda[j]*e[i,j],j=1,N_E)=0 "Lagrange method"
end

The code will likely not solve until the lower and upper limits of 0 and 1 are entered for all mole
fractions. This can be done for the entire y[] array by unchecking Show array variables at the
upper left of the Variable Information dialog.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The problem should now solve. However, this is not the correct solution since the temperature
of the products may not be 2500 K for adiabatic combustion. The highest temperature will occur
when the reaction is adiabatic. In this case the enthalpy of the reactants will be equal to the
enthalpy of the products. The reactant composition and temperature and known and the enthalpy
of the reactants can be directly calculated. The enthalpy of the products is the sum of the product
of the moles of each gas and it specific enthalpy. The heat, Q, is the difference between the
enthalpy of the reactants and the enthalpy of the products.

T_R=convertTemp(C,K,25 [C]) "temperature of reactants"


H_R=enthalpy(C8H18,T=T_R)+a*enthalpy(O2,T=T_R)+&
a*3.76*enthalpy(N2,T=T_R) "enthalpy of reactants"
H_P=sum(n[i]*h[i],i=1,N_C) "enthalpy of products"
Q=H_P-H_R "energy balance"

Comment out the guess for T and set Q= 0 [J/kmol]

{T=2500 [K] "guess for T"}


Q=0 [J/kmol] "adiabatic combustion"

Solve. The adiabatic combustion temperature and moles of CO. NO and NO2 per mole of C8H18
are:
T=2299 [K]
n[CO]= 0.9991
n[NO]=0.1698
n[NO2]=0.0000338
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-3
Internal combustion engines are responsible for the production of carbon monoxide and oxides
of nitrogen that are major contributors to atmospheric pollution. The rate at which oxygen and
nitrogen react to form NO increases with increasing temperature. At the high temperatures
achieved during the combustion process, the rate is sufficient for NO to reach its equilibrium
value. The combustion mixture is then exhausted to the atmosphere, which freezes the reverse
reaction so that the NO remains in the exhaust. In a particular case, octane is combusted with
20% excess air resulting in a gas mixture consisting of CO2, CO, N2, NO, H2O, and O2.
Prepare a plot of the equilibrium mole fractions of CO and NO as a function of maximum
combustion temperature for temperatures between 1500 K and 2000 K at 1 atm. Determine the
equilibrium state by directly minimizing the Gibbs free energy of the products.

Choose a basis of 1 kmol of C8H18 and determine the moles of oxygen needed for stoichiometric
combustion. The actual moles of oxygen supplied to the reaction is 1.2 times the stoichiometric
amount. There are 6 gases in the products representing 4 elements. There are therefore 2
degrees of freedom that are constrained by chemical equilibrium concerns. Enter array indices
for the elements and gases along with the names of the gases.

$UnitSystem SI K Pa J molar
$TabStops 0.2 1 2 3 4 in

"Basis: 1 kmol of C8H18"


"C8H18 + a(O2 + 3.76 N2) = n[CO2] CO2 + n[CO] CO +n[O2] O2 + n[N2] N2 + n[NO] NO+ n[NO2] NO2 +
n[H2O] H2O"

2*a_stoic=8*2+9 "stoichiometric amount of O2"


a=1.2*a_stoic "actual moles of O2"

N_E=4 "number of elements"


C=1; H=2; O=3; N=4; "element indices"
N_C=6 "number of gases"
CO2=1; N$[CO2]='CO2' "gase indices and names"
CO=2; N$[CO]='CO'
O2=3; N$[O2]='O2'
N2=4; N$[N2]='N2'
NO=5; N$[NO]='NO'
H2O=6; N$[H2O]='H2O'

Balances are written for each element. The total moles of gas is determined and used to define
the mole fraction for each gas.

n[CO2]+n[CO]=8 "C balance"


2*n[H2O]=18 "H balance"
2*n[CO2]+n[CO]+2*n[O2]+n[NO]+n[H2O]=2*a "O balance"
2*n[N2]+n[NO]=a*3.76*2 "N balance"
n_tot=sum(n[i],i=1,N_C) "total moles of gas"
duplicate i=1,N_C
y[i]=n[i]/n_tot "mole fraction"
end
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

Enter the temperature and pressure. The temperature will later be varied between 1500 and 2000
K.

P=1 [atm]*convert(atm,Pa)
$ifnot ParametricTable
T=1750 [K]
$endif

The Gibbs free energy of the mixture is

C
GT , P ni i (1)
i 1

The chemical potential of each gas in the products is determined, assuming ideal gas behavior.

duplicate i=1,N_C
mu[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=y[i]*P) "chemical potentials"
end

The Gibbs free energy is the sum of the product of the moles of each gas and its chemical
potential.

G=sum(n[i]*mu[i], i=1,N_C) "Gibbs free energy of products"

There are two degrees of freedom. This problem will be solved using the MinMax or MinMax
Table commands where G is minimized with respect to two variables. A logical choice of the
two variable is the mole fraction of CO and NO, since we expect that these values will be small.
First, enter possible values for these mole fractions.

y[CO]=1e-6; y[NO]=1e-6 "guess values for mole fractions"

Solve and update the guess values. Next, select the MinMax command. Choose to minimize G
with independent variables y[2] and y[5].
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

Click the Bounds button and set lower and upper limits for the mole fractions to be 0 and 0.1,
respectively. Click OK to start the minimization process. Check to ensure that the solution is
physically correct.

Create a Parametric table with columns for T, G, y[2] and y[5]. Fill the T column with values
between 1500 K and 2000 K. Use the MinMax Table command to determine the values of y[2]
and y[5] that minimize G for each temperature. The results are plotted below.
0.003
Mole Fractions of CO and NO

0.0025 yNO

0.002

0.0015

0.001

0.0005 yCO

0
1500 1600 1700 1800 1900 2000
T [K]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-4
Higher compression ratios tend to increase internal combustion engine efficiency, but they also
result in higher rates of CO and NO production. Consider an eight cylinder engine with each
cylinder having a bore of 4.00 in and a stroke of 4.52 in operating at 3000 rpm (4-stroke cycle)
combusting octane (C8H18) with stoichiometric air at 75F, 1 atm. Assume the compression
process occurs isentropically. The combustion products are CO2, CO, N2, NO, H2O, and O2.
Assume that the equilibrium amounts of CO and NO are produced at the adiabatic combustion
temperature and then frozen at these compositions so that they appear in the exhaust gas.
Prepare plots of adiabatic combustion temperature and the rates of production of CO and NO as a
function of compression ratio, for compression ratios between 6 and 12. Comment on the trends
that you observe.

Choose a basis of 1 kmol of octane and balance the stoichiometric reaction. Identify the
elements and gases for use the in chemical equilibrium analysis.

$UnitSystem SI K Pa J molar
"Basis: 1 kmol of C8H18"
"C8H18 + a(O2 + 3.76 N2) = n[CO2] CO2 + n[CO] CO +n[O2] O2 + n[N2] N2 + n[NO] NO+ n[H2O] H2O"

2*a=8*2+9 "stoichiometric amount of O2"

N_E=4 "number of elements"


C=1; H=2; O=3; N=4; "element indices"
N_C=6 "number of gases"
CO2=1; N$[CO2]='CO2' "gas indices and names"
CO=2; N$[CO]='CO'
O2=3; N$[O2]='O2'
N2=4; N$[N2]='N2'
NO=5; N$[NO]='NO'
H2O=6; N$[H2O]='H2O'

The air and fuel mixture with stoichiometric proportions enters the engine at 75F, 1 atm. The
rotation speed of the engine must be divided by 2 since combustion occurs every other
revolution. All inputs will be converted to SI units. The number of cylinders and cylinder
geometry are known. The displacement is the volume change for one cylinder during one
compression process. The volumetric flow rate is the flow rate of fuel-air mixture (assuming a
volumetric efficiency of 1).

T_air=convertTemp(F,K,75 [F]) "air temperature"


P_air=1 [atm]*convert(atm, Pa) "air pressure"
RPM=(3000/2) [1/min]*convert(1/min,1/sec) "frequency of power strokes"
N_cyl=8 "Number of cylinders"
Bore=4 [in]*convert(in,m) "cylinder bore"
Stroke=4.52 [in]*convert(in,m) "cylinder stroke"
Displacement = pi*(Bore/2)^2*Stroke "displacement of one cylinder"
V_dot=N_cyl*Displacement*RPM "displacement rate of air-fuel mixture"

The number of moles of reactant gas per mole of octane is computed and used to determine the
mole fraction of octane and the other reactant gases. The actual molar flow rate of octane is the
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

product of the mole fraction of octane and the volumetric flow of the reactant gas mixture
divided by the specific volume of the gas mixture assuming ideal gas behavior.

n_R=1+4.76*a "number of moles of reactant per kmol of fuel"


y_C8H18=1/n_R "mole fraction of octane vapor"
n_dot_C8H18=y_C8H18*V_dot/(R#*T_air/P_air) "molar flow rate of octane"

The fuel and air mixture is compressed in an adiabatic reversible process. The enthalpy, entropy
and volume per kmole of methane before the compression can be determined since the
temperature, pressure and composition are specified.

"Compression Process"
H_in=enthalpy(C8H18,T=T_air)+a*enthalpy(O2,T=T_air)+&
a*3.76*enthalpy(N2,T=T_air) "enthalpy of inlet fuel-air per kmol of C8H18"
S_in=entropy(C8H18,T=T_air,P=y_C8H18*P_air)+a*entropy(O2,T=T_air,P=a/n_R*P_air)+&
a*3.76*entropy(N2,T=T_air,P=3.76*a/n_R*P_air) "entropy of inlet fuel-air per kmol of C8H18"
V_in=(1+4.76*a)*R#*T_air/P_air "volume of inlet fuel air per kmol of C8H18"

The compression ratio will be varied, but it is temporary set to 8. The volume after compression
is reduced by a factor equal to the compression ration. The enthalpy, entropy, and internal
energy of the gas mixture after compression are fixed knowing the volume, entropy and
composition, which is not changed during the compression process.

$ifnot ParametricTable
CR=8
$endif
V_c=V_in/CR "volume of gases after compression"
V_c=(1+4.76*a)*R#*T_c/P_c "volume relates P and T after compression"
H_c=enthalpy(C8H18,T=T_c)+a*enthalpy(O2,T=T_c)+&
a*3.76*enthalpy(N2,T=T_c) "enthalpy of fuel-air after compression"
S_c=entropy(C8H18,T=T_c,P=y_C8H18*P_c)+a*entropy(O2,T=T_c,P=a/n_R*P_c)+&
a*3.76*entropy(N2,T=T_c,P=3.76*a/n_R*P_c) "entropy of fuel-air after compression"
S_c=S_in "isentropic compression"
U_c=H_c-n_R*R#*T_c "internal energy of compressed gases per kmol"

These equations may solve at this point, but they will not provide a correct result. The value of
T_c, the temperature after the compression process, must be found iteratively. The guess value
of 1 K does leads to a non-physical result. It is necessary to provide a reasonable guess value for
T_c. This task can be accomplished using the Variable Info dialog (Options menu). Set the
guess value for T_c to 500 K.

Solve. The temperature after compression, T_c, is 593.1 K. The pressure is 1.62 MPa. Update
the guess values.

Next, the combustion process is considered. Element balances are written for C, H, O, and N.
The total moles of gas are computed and used to define the mole fractions.

"Adiabatic Constant Volume Combustion Process"


n[CO2]+n[CO]=8 "C balance"
2*n[H2O]=18 "H balance"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

2*n[CO2]+n[CO]+2*n[O2]+n[NO]+n[H2O]=2*a "O balance"


2*n[N2]+n[NO]=a*3.76*2 "N balance"
n_tot=sum(n[i],i=1,N_C) "total moles of gas"
duplicate i=1,N_C
y[i]=n[i]/n_tot "mole fraction"
end

The LaGrange method will be used to solve the chemical equilibrium problem. The first step in
this process is to calculate the derivative of each element balance with respect to each gas. These
derivatives are placed in the two-dimensional e array and filled by inspection of the element
balances.

e[CO,C]=1; e[CO,H]=0; e[CO,O]=1; e[CO,N]=0; "element indices for CO"


e[CO2,C]=1; e[CO2,H]=0; e[CO2,O]=2; e[CO2,N]=0; "element indices for CO2"
e[O2,C]=0; e[O2,H]=0; e[O2,O]=2; e[O2,N]=0; "element indices for O2"
e[N2,C]=0; e[N2,H]=0; e[N2,O]=0; e[N2,N]=2; "element indices for N2"
e[NO,C]=0; e[NO,H]=0; e[NO,O]=1; e[NO,N]=1; "element indices for NO"
e[H2O,C]=0; e[H2O,H]=2; e[H2O,O]=1; e[H2O,N]=0; "element indices for H2O"

The temperature after combustion is not known. Specify a guess for this temperature while will
be removed later. With temperature known, the pressure, specific enthalpy and chemical
potential of each gas in the combustion products can be determined.

T=2000 [K] "guess for T"


P=n_tot*R#*T/V_c "pressure of products"

duplicate i=1,N_C
mu[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=y[i]*P) "chemical potentials"
h[i]=enthalpy(N$[i],T=T) "specific enthalpies"
end

The LaGrange formulation requires that

E j
i j for i =1, C
j 1 ni
n j j i

These equations can be formulated in the following EES code.

duplicate i=1,N_C
mu[i]+sum(lambda[j]*e[i,j],j=1,N_E)=0 "Lagrange method"
end

The enthalpy and internal energy of the gases after combustion are computed. An energy
balance on the combustion chamber during the combustion process is that the heat transfer is the
difference between the internal energies of the products and reactants.

H_P=sum(n[i]*h[i],i=1,N_C) "enthalpy of products"


U_P=H_P-n_tot*R#*T "internal energy of products"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

Q=U_P-U_c "energy balance"

Set the lower and upper limits for the mole fractions to be 0 and 1, respectively. Solve and
update the guess values. The combustion process occurs adiabatically. Comment out the guess
made earlier for T and set Q=0 [J/kmol]

{T=2000 [K] "guess for T"}


Q=0 [J/kmol] "adiabatic combustion"

Solve. Finally, determine the molar flow rates of NO and CO as the product of the molar flow
rate of octane, the moles of gas per mole of octane and the mole fraction of each gas.

n_dot_CO=y[CO]*n_tot*n_dot_C8H18 "molar flow rate of CO"


n_dot_NO=y[NO]*n_tot*n_dot_C8H18 "molar flow rate of NO"

Plots of the combustion temperature and molar flow rates of NO and CO appear as follows.
Adiabatic Combustion Temperature [K]

2960

2940

2920

2900

2880

2860
6 7 8 9 10 11 12
Compression Ratio

0.0002155 0.000073

NO 0.000072
0.000215
0.000071
CO
nNO [kmol/s]
nCO [kmol/s]

0.00007
0.0002145

0.000069

0.000214
0.000068

0.000067
0.0002135
0.000066

0.000213 0.000065
6 7 8 9 10 11 12
Compression Ratio
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-5
You have been asked to investigate methods to improve the energy efficiency of the ammonia
synthesis process. Currently the process is operated at 300 atm and 425C with the nitrogen and
hydrogen provided in stoichiometric proportions at 25C, 300 atm. One idea that you have is to
provide excess nitrogen since nitrogen is inexpensive. Prepare plots of the mole fraction of
ammonia and the required heat input per mole of ammonia produced as a function of the ratio of
the actual nitrogen provided to the stoichiometric amount. Note that, because of the high
pressures, ideal gas law behavior is not valid. Assume that the mixture obeys ideal solution
theory.

Start by writing the reaction of nitrogen and hydrogen to produce one more of ammonia. The
temperature and pressure of the reaction are known. The ratio of the initial moles of N2 to the
stoichiometric amount of mole per 1.5 moles of H2 is set to 1.

$UnitSystem SI K Pa kJ molar
$TabStops 0.25 3.5 in

"1/2N2+3/2H2=NH3 Basis: 1 mole of ammonia"

T=convertTemp(C,K,425 [C]) "temperature in K"


P=300 [atm]*convert(atm, Pa) "pressure at which reaction occurs"

$ifnot ParametricTable
N2_stoic_ratio=1 "moles of N2 provided to the stoich. value (1/2)"
$endif

The index, ideal gas name, stoichiometric coefficient for the above reaction and initial molar
amount relative to a basis of one more mole NH3 are entered fore each gas..

The Gibbs free energy of each gas at 1 atm is computed knowing the specific enthalpy and
entropy. The standard state Gibbs free energy change of reaction can then be computed.

duplicate i=1,3
g|o[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=Po#) "standard state Gibbs free energy for each gas"
end
DELTAG|o=sum(nu[i]*g|o[i],i=1,3) "Gibbs free energy change of reaction"

The number of moles of each gas can be expressed with a reaction coordinate. The total moles
of gas is determined and used to calculate the mole fraction of each gas.

duplicate i=1,3
n[i]=n_0[i]+nu[i]*epsilon "moles of gases at any point in reaction"
y[i]=n[i]/n_tot "mole fraction of each gas"
end
n_tot=sum(n[i],i=1,3) "total moles of gas"

The Law of Mass Action reaction defines the equilibrium constant.

DELTAG|o=-R#*T*ln(K) "Law of mass action"


S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The fugacity of each gas at the reaction temperature and pressure is needed. Fugacity is
provided in EES for the real gases. Array NR$ is filled with the names of the real gases and the
fugacity of each gas at 300 atm and 425 K is determined.

The definition of the equilibrium constant for this non-ideal gas mixture uses the product of the
mole fraction and fugacity in place of the partial pressure for each gas.

K=product((y[i]*f[i]/Po#)^nu[i],i=1,3) "Equilibrium constant - ideal solution"

The specific enthalpy of each gas at the inlet and outlet temperatures and 300 atm is found and
used to calculate the enthalpy of the reactants and products. The heat transfer per mole of
ammonia produced can then be calculated.

Create a Parametric table with columns for N2_stoic_ratio, y[3] and Q. Fill the N2_stoic_ratio
column with values from 0.25 to 2. Solve the table and plot the required quantities.

Heat input per mole of NH3 [kJ/kmol]


0.43 60000
NH3 mole fraction
59000
hydrogen mole fraction

0.42 58000

57000

0.41 56000

55000

0.4 54000

53000
Heat input per
0.39 mole of NH3 produced 52000

51000

0.38 50000
0 0.5 1 1.5 2
Ratio of initial amount of N2 to stoichiometric
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-6
Hydrogen reforming is one of the main processes used for the industrial production of hydrogen.
It is based on the following reaction of methane with water vapor:
CH4 + H2 O CO + 3H2
The reaction is endothermic and the equilibrium constant at low temperature results in a very
small yield of hydrogen. Thus, the reforming is performed at 1100C. This temperature remains
constant during the reaction by combusting controlled amounts of methane with oxygen which
reacts according to:
2CH 4 + 3O2 2CO + 4H 2 O
A well-insulated reactor operating at steady conditions is fed with separate streams of 1 kmol/sec
of methane, 1 kmol/sec of water vapor and oxygen at a rate which is to be determined. All
streams are preheated so that they enter the reactor at 1100C and all streams are at 1 atm
pressure. The oxygen is completely consumed. Leaving the reactor is a mixture of methane,
water vapor, carbon monoxide, and hydrogen in chemical equilibrium at 1100C, 1 atm.
Determine the required molar flow rate of oxygen and the mole fraction of hydrogen in exit
stream.

Enter the known temperature and pressure.

$UnitSystem SI K Pa J molar
T=convertTemp(C,K,1100 [C])
P=1 [atm]*convert(atm,Pa)

The overall reaction can be written as

"Basis: 1 mole of CH4 and 1 mole of H2O + a moles of oxygen"


"CH4 + H2O +a O2 = n[CH4] CH4 + n[CO] CO + n[H2O] H2O + n[H2] H2"

There are three elements and 5 gases in this problem. Enter the element and gas identities,
names and initial molar amounts. Note that the initial moles of O2 is a, which is to be
determined.

N_E=3 "number of elements"


C=1; H=2; O=3 "element identities"

N_C=5 "number of gases in products"


CH4=1; N$[CH4]='CH4'; n_0[CH4]=1 "identities, names and initial moles of each gas"
H2O=2; N$[H2O]='H2O'; n_0[H2O]=1
H2=3; N$[H2]='H2'; n_0[H2]=0
CO=4; N$[CO]='CO'; n_0[CO]=0
O2=5; N$[O2]='O2'; n_0[O2]=a "a is to be determined"

Balances are written for C, H and O.

n[CH4]+n[CO]=1 "C balance"


4*n[CH4]+2*n[H2O]+2*n[H2]=6 "H balance"
1+2*a=n[CO]+n[H2O] "O balance"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The total moles is the sum of the moles of each gas and it can be used to determine the mole
fraction of each gas,

n_tot=sum(n[i],i=1,N_C) "total moles of gas"


duplicate i=1,N_C
y[i]=n[i]/n_tot "mole fraction of each gas"
end

The LaGrange method will be used in this problem since then we do not need to be concerned
with the actual reactions. The chemical potential and specific enthalpy of each gas is determined
from property information.

duplicate i=1,N_C
mu[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=y[i]*P) "chemical potential"
h[i]=enthalpy(N$[i],T=T) "specific enthalpy"
end

The element indices needed in the LaGrange method are found by inspection of the element
balance equations.

e[CH4,C]=1; e[CH4,H]=4; e[CH4,O]=0 "element indices"


e[H2O,C]=0; e[H2O,H]=2; e[H2O,O]=1
e[H2,C]=0; e[H2,H]=2; e[H2,O]=0
e[CO,C]=1; e[CO,H]=0; e[CO,O]=1
e[O2,C]=0; e[O2,H]=0; e[O2,O]=2

The LaGrange method can be implemented in the following manner.

duplicate i=1,N_C
mu[i]+sum(lambda[j]*e[i,j],j=1,N_E)=0 "Lagrange method"
end

At this point, we are one equation short of being able to solve this problem. The final equation
results from an energy balance on the reactor. The enthalpy of the reactants and products, both
at 1100C, are determined. The heat transfer is the difference between the enthalpy of the
products and reactants.

H_R=sum(n_0[i]*h[i],i=1,N_C) "enthlapy of reactants"


H_P=sum(n[i]*h[i],i=1,N_C) "enthalpy of products"
Q=H_P-H_R "energy balance"

Enter a guess for a.

a=0.1 "guess for a"

Solve and update the guess values. Comment out the guess for a and enter the constraint that the
reaction is adiabatic.

{a=0.1 "guess for a"}


Q=0 [J/kmol] "adiabatic operation"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

Solve. The mole fraction of hydrogen in the products is 0.524 and the molar flow rate of oxygen
required is 0.452 kmol/s. Note that no oxygen remains in the products.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-7
The presence of even small amounts of the various oxides of nitrogen in combustion products is
an important factor from an air pollution perspective. Consider a mixture consisting of the
following basic products of combustion: 11% CO2, 12% H2O, 4% O2 and 73% N2 with the
percentages on a volumetric basis. At the high temperatures and pressure occurring within the
cylinder of an engine both NO and NO2 may form; carbon monoxide will also likely be formed.
Prepare plots showing the moles fractions of CO, NO and NO2 as a function of pressure for
pressures between 5 and 15 atm at 2000 K.

Choose a basis of 100 kmol of combustion gas at 2000 K. The reaction involves 4 elements
composing 7 gases.

$UnitSystem SI K Pa J molar
"Basis: 100 moles of combustion gas"
"11 CO2 + 12 H2O + 4 O2 + 73 N2 = n[CO2] CO2 + n[CO] CO + n[H2O] H2O + n[NO] NO + n[NO2] NO2
+ n[N2] N2 + n[O2] O2"

N_E=4 "number of elements"


C=1; H=2 ; O=3; N=4 "ID for elements"

N_C=7 "number of gases"


CO2=1; n$[CO2]='CO2' "ID for gases"
CO=2; N$[CO]='CO'
H2O=3; N$[H2O]='H2O'
NO=4; N$[NO]='NO'
NO2=5; N$[NO2]='NO2'
N2=6; N$[N2]='N2'
O2=7; N$[O2]='O2'

Element balances are written for C, H2, O, and N. The total moles of gas are found and used to
calculate the mole fraction of each gas.

n[CO2]+n[CO]=11 "C balance"


n[H2O]=12 "H2 balance"
2*n[CO2]+n[CO]+n[NO]+2*n[NO2]+n[H2O]+2*n[O2]=2*11+12+4*2 "O balance"
2*n[N2]+n[NO]+n[NO2]=73*2 "N balance"
n_tot=sum(n[i],i=1,N_C) "total moles of gas"
duplicate i=1,N_C
y[i]=n[i]/n_tot "mole fraction"
end

The LaGrange method is used to find the equilibrium state. The method requires the
specification of the derivative of the element constraint equation with respect to the number of
moles of each gas. These derivatives are placed in the 2-D e array.

e[CO2,C]=1; e[CO2,H]=0; e[CO2,O]=2; e[CO2,N]=0 "element indices for CO2"


e[CO,C]=1; e[CO,H]=0; e[CO,O]=1; e[CO,N]=0 "element indices for CO"
e[H2O,C]=0; e[H2O,H]=2; e[H2O,O]=1; e[H2O,N]=0 "element indices for H2O"
e[NO,C]=0; e[NO,H]=0; e[NO,O]=1; e[NO,N]=1 "element indices for NO"
e[NO2,C]=0; e[NO2,H]=0; e[NO2,O]=2; e[NO2,N]=1 "element indices for NO2"
e[O2,C]=0; e[O2,H]=0; e[O2,O]=2; e[O2,N]=0 "element indices for O2"
e[N2,C]=0; e[N2,H]=0; e[N2,O]=0; e[N2,N]=2 "element indices for N2"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The temperature and pressure entered. The pressure will be varied in a Parametric table.

T=2000 [K] "temperature of products"


$ifnot ParametricTable
P_a=10 [atm] "pressure in atmospheres "
$endif
P=P_a*convert(atm,Pa) "pressure in Pa"

The chemical potential of each gas is calculated and used in the LaGrange formulation with the
undetermined multipliers.

duplicate i=1,N_C
mu[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=y[i]*P) "chemical potentials"
end

duplicate i=1,N_C
mu[i]+sum(lambda[j]*e[i,j],j=1,N_E)=0 "Lagrange method"
end

It is necessary to place lower and upper limits of 0 and 1 on the mole fractions in order for this
problem to solve.

Create a Parametric table with columns for P_a, y[2], y[4], and y[5]. Solve the table. The plot is
best prepared with a log scale. The amount of NO2 that forms is quite small.
-2
10

CO
-3
10
Mole Fractions

NO
-4
10

-5
10 NO2

-6
10
5 7 9 11 13 15
Pa [atm]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-8
Acetylene (C2H2) at 25C, 1 atm is used a fuel for a cutting torch. The fuel is reacted with air at
25C, 1 atm resulting in products that include CO2, CO, H2O, H, and N2, all at 1 atm. Calculate
the equilibrium temperature of the products as a function for % theoretical air for values between
60% and 120%. At what theoretical % does the highest temperature occur?

Choose a basis of 1 kmol of C2H2 and write the net reaction with air. The stoichiometric amount
of oxygen per mole of acetylene is found with an oxygen balance to be 2.5 kmol/kmol. There
are 4 elements and 6 gases present after combustion is completed. The pressure is 1 atm.

$UnitSystem SI K Pa J molar
"C2H2 + a(O2+3.76 N2) = n[CO2] CO2 + n[CO] CO + n[O2] O2 + n[H2O] H2O + n[H2] H2 + n[N2] N2"
"Basis: 1 kmol of C2H2"

2*a_stoic=2*2+1 "stoichiometric value of a"


P=1 [atm]*convert(atm,Pa) "reaction pressure"

N_E=4 "number of elements"


C=1; H=2; O=3; N=4 "element identification"

N_C=6 "number of gases"


CO2=1; N$[CO2]='CO2' "gas identification"
CO=2; N$[CO]='CO'
O2=3; N$[O2]='O2'
H2O=4; N$[H2O]='H2O'
H2=5; N$[H2]='H2'
N2=6; N$[N2]='N2'

Set the % of theoretical air, which determines the value of a, the moles of oxygen. % theoretical
air will be varied between 60% and 120%

$ifnot ParametricTable
Theo%=80
$endif

a=a_stoic*Theo%/100 [%] "actual moles of oxygen per mole of C2H2"

Element balances are written for C, H, O, and N. The total moles of gas are found by summing
the moles of each gas.

n[CO2]+n[CO]=2 "C balance"


2*n[H2O]+2*n[H2]=2 "H balance"
2*n[CO2]+n[CO]+2*n[O2]+n[H2O]=2*a "O balance"
2*n[N2]=2*a*3.76 "N balance"
n_tot=sum(n[i],i=1,N_C) "total moles of gas"

The LaGrange method is used to determine the equilibrium mole fractions. The derivative of the
element constraint equations with respect to the number of moles of each gas are entered.

e[CO2,C]=1; e[CO2,H]=0; e[CO2,O]=2; e[CO2,N]=0 "derivative of element constraint wrt


n[i]"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

e[CO,C]=1; e[CO,H]=0; e[CO,O]=1; e[CO,N]=0


e[O2,C]=0; e[O2,H]=0; e[O2,O]=2; e[O2,N]=0
e[H2O,C]=0; e[H2O,H]=2; e[H2O,O]=1; e[H2O,N]=0
e[H2,C]=0; e[H2,H]=2; e[H2,O]=0; e[H2,N]=0
e[N2,C]=0; e[N2,H]=0; e[N2,O]=0; e[N2,N]=2

The mole fraction, specific enthalpy, and chemical potential are computed for each gas.

duplicate i=1,N_C
y[i]=n[i]/n_Tot "mole fraction"
h[i]=enthalpy(N$[i],T=T) "specific enthalpy"
mu[i]=h[i]-T*entropy(N$[i],T=T,P=y[i]*P) "chemical potential"
end

The LaGrange method is implemented with the undetermined multipliers.

duplicate i=1,N_C
mu[i]+sum(lambda[j]*e[i,j],j=1,N_E)=0 "Lagrange method"
end

The temperature and composition of the reactants is known, which allows the enthalpy of the
reactants per mole of acetylene to be determined.

T_R=convertTemp(C,K,25 [C]) "temperature of reactants"


H_R=enthalpy(C2H2,T=T_R)+a*enthalpy(O2,T=T_R)+&
a*3.76*enthalpy(N2,T=T_R) "enthalpy of reactants"

The enthalpy of the products is the sum of the product of the number of moles and specific
enthalpy of each gas. The heat transfer is the difference between the enthalpy of the products
and the enthalpy of the reactants.

H_P=sum(n[i]*h[i],i=1,N_C) "enthalpy of products"


Q=H_P-H_R "energy balance"

At this point, there is one fewer equations than unknowns. Enter a guess for the temperature of
the combustion products.

T=2000 [K] "guess for T"

Solve and update the guess values. Comment out the guess and replace it with the requirement
that Q=0 J/kmol] for an adiabatic reaction.

{T=2000 [K] "guess for T"}


Q=0 [J/kmol] "adiabatic reaction"

The temperature of the products is 2682 K. Create a Parametric Table with columns for Theo%
and T. Fill Theo% with values between 60 and 120. Solve the table and plot the results, as
shown. Interestingly, the maximum temperature occurs for a theoretical air percent of about
77%.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

2700

2650

2600

T [K]
2550

2500

2450

2400
60 70 80 90 100 110 120
% Theoretical Air [%]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-9
1.6 grams of methane (CH4) are placed into an evacuated 2 liter pressure cylinder at 25C. The
cylinder and its contents are then slowly heated to 1500C. Methane is expected to dissociate
into elemental carbon and hydrogen gas during this heating process according to:
CH 4 C 2H 2 . Prepare plots of the expected pressure in the cylinder and the methane mole
fraction as a function of temperature for temperatures between 50C and 1500C. Assume ideal
gas behavior.

The initial pressure in the cylinder can be calculated knowing the initial temperature, molar
amount of CH4 and the volume.

$UnitSystem SI K Pa J molar
T_R=convertTemp(C,K,25 [C]) "temperature of reactants"
V=2 [liter]*convert(liter,m^3) "volume of bomb"
n_0_CH4=1.6 [g]*convert(g,kg)/molarmass(CH4) "initial moles of CH4"
P_0=n_0_CH4*R#*T_R/V "initial pressure of CH4"

Temporarily, set the temperature. It will be varied from 50C to 1500C in a Parametric table
later. The gases in the reaction and the solid carbon are identified.

"CH4 = C + 2 H2"
$ifnot ParametricTable
T_C=1000 [C] "temperature of contents"
$endif
T=convertTemp(C,K,T_C)
N_C=2 "number of gases"
CH4=1; N$[CH4]='CH4' "gas identification"
H2=2; N$[H2]='H2'
Carbon=3; N$[Carbon]='C(gr)'

A reaction coordinate can be used to determine the moles of each chemical in the reaction. The
total moles of gas (no carbon) are computed and used to determine the mole fractions of methane
and hydrogen. The ideal gas law is applied to determine the pressure.

n[CH4]=n_0_CH4-epsilon "reaction coordinate balances"


n[H2]=2*epsilon
n[Carbon]=epsilon
n_gases=n[CH4]+n[H2] "total moles of gas"
duplicate i=1,2
y[i]=n[i]/n_gases "mole fractions"
end
P=n_gases*R#*T/V "ideal gas law"
P_b=P*convert(Pa,bar) "pressure in bars"

One additional relation is needed to solve this problem and that comes from chemical
equilibrium. The specific Gibbs free energy of each gas is computed using the EES data base.
The NASA external procedure provides the specific enthalpy and entropy for solid carbon, C(gr),
which is used to calculate its specific Gibbs free energy.

duplicate i=1,2
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

g|o[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=Po#) "Specific Gibb's free energy"


end
call NASA(N$[Carbon],T: cp_C,h_c,s_C) "property data for C"
g|o[Carbon]=(h_c-T*s_c)*convert(kJ/kmol,J/kmol)

The standard state Gibbs free energy change of reaction is determined and used to calculate the
equilibrium constant, K. The chemical potential of solid carbon is then constant, independent of
the amount of carbon present in the reaction vessel but the chemical potentials of the gases vary.
These factors are considered in the definition of the equilibrium constant which excludes the
solid carbon.

DELTAG|o=2*g|o[H2]+g|o[Carbon]-g|o[CH4] "Standard-state Gibbs free energy change"


DELTAG|o=-R#*T*ln(K) "Law of Mass Action"
K=(y[H2]*P/Po#)^2/(y[CH4]*P/Po#) "equilibrium constant"

Prepare a Parametric table with columns for T_C, P, and y[1]. Fill the T_C column with
temperatures between 50C and 1500C. A plot of the requested results appears below. Note
that dissociation into C and H2 occurs to a large extent at high temperatures.
16 1
mole fraction of CH4
14 Pressure
0.8

mole fraction of CH4


12
Pressure [bar]

10 0.6

0.4
6

4
0.2
2

0 0
0 200 400 600 800 1000 1200 1400 1600
TC [C]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-10
The vast coal deposits in the U.S. and elsewhere are likely a result of a chemical equilibrium
process in which small hydrocarbon molecules disassociated into carbon. A simple model to
study this process is provided by the chemical equilibrium of the ethane formation reaction
2 C 3H 2 C2 H 6 . As a part of a study of this reaction, a 4 liter volume is filled with pure
ethane at 15 bar and 25C. The ethane is then slowly heated to 1000C.

a.) Determine the pressure and mole fraction of hydrogen assuming ideal gas behavior.
b.) Non-ideal gas behavior can be expected at the high pressures involved in this process.
Repeat the calculations requested in part a), but assume that the gases form an ideal solution,
but not necessarily an ideal gas mixture.

Both the ideal and non-ideal gas analyses will be done in one program. A string variable,
Model$, is set to Ideal for the ideal gas analysis. Otherwise ethane will be considered to have
real gas behavior. The temperature, volume and pressure of the ethane placed in the container
are known and they can be used to calculate the moles of ethane gas.

$UnitSystem SI K Pa J molar
Model$='ideal'
T_R=convertTemp(C,K,25 [C]) "temperature of reactants"
V=4 [liter]*convert(liter,m^3) "volume of bomb"
P_0=15[bar]*convert(bar,Pa) "initial pressure of C2H6"
$if Model$='ideal'
n_0_C2H6=P_0*V/(R#*T_R) "initial amount - ideal gas"
$elseif
n_0_C2H6=V/volume(ethane,T=T_R,P=P_0) "initial amount - real gas"
$endif

The reverse formation reaction is considered here. Assume a temperature of 1000C. The
temperature will be varied between 25C and 1000C after the analysis is completed. The gases
are solid carbon are identified so that they can be used in arrays.

"C2H6 = 2C + 3H2"
$ifnot ParametricTable
T_C=1000 [C] "temperature of contents"
$endif
T=convertTemp(C,K,T_C)
N_C=2 "number of gases"
C2H6=1; N$[C2H6]='C2H6' "gas identification"
H2=2; N$[H2]='H2'
Carbon=3; N$[Carbon]='C(gr)'

A reaction coordinate, epsilon, provides a convenient method to do the element balances for this
one reaction. The total moles of gas (excluding solid carbon) are found and used to determine
the mole fractions in the gas phase.

n[C2H6]=n_0_C2H6-epsilon "reaction coordinate balances"


n[H2]=3*epsilon
n[Carbon]=2*epsilon
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

n_gases=n[C2H6]+n[H2] "total moles of gas"


duplicate i=1,2
y[i]=n[i]/n_gases "mole fractions"
end

The pressure of the gas mixture of hydrogen and ethane can be represented as

Z n gases R univ T
P (1)
V

where Z is the compressibility factor. If the gas mixture is ideal, the compressibility factor is 1.
Otherwise a value of Z must be estimated for the mixture. One easy way to obtain this estimate
is to use Kays rule. The critical properties of each gas are found and used to define pseudo-
critical pressure and temperature. A mole fraction weighted acentric factor is determined. The
pseudo-reduced temperature, pressure and acentric factor are provided to the Compress function,
which uses the Redlich-Kwong-Soave equation of state to estimate the compressibility factor.

$if Model$='ideal'
Z=1
$elseif
T_pc=sum(y[i]*T_crit(N$[i]),i=1,2) "pseudo-critical temperture"
P_pc=sum(y[i]*P_crit(N$[i]),i=1,2)
omega=sum(y[i]*acentricFactor(N$[i]),i=1,2)
Z=COMPRESS(T/T_pc,P/P_pc,omega) "compressibility factor - Kay's
rule"
$endif
P=Z*n_gases*R#*T/V "pressure of mixture"
P_b=P*convert(Pa,bar) "pressure in bars"

The Law of Mass action will be used to solve the chemical equilibrium problem. The specific
Gibbs free energy of the gases at 1 atm pressure can be determined using the EES property data.
The Gibbs free energy of the carbon is determined using the NASA external procedure.

duplicate i=1,2
g|o[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=Po#) "Specific Gibb's free energy"
end
call NASA(N$[Carbon],T: cp_C,h_C,s_C) "property data for C"
g|o[Carbon]=(h_c-T*s_c)*convert(kJ/kmol,J/kmol)

The standard-state Gibbs free energy change of the reaction is calculated and used to determine
the equilibrium constant, K.

DELTAG|o=3*g|o[H2]+2*g|o[Carbon]-g|o[C2H6] "Standard-state Gibbs free energy


change"
DELTAG|o=-R#*T*ln(K) "Law of Mass Action"

If the mixture is assume to obey the ideal gas law, the equilibrium constant is determined using
the partial pressures of the gases. Note that the solid carbon does not appear in the equilibrium
constant since, as long as some carbon is present, its chemical potential is constant. If the
mixture does not obey the ideal gas law, fugacities of each gas must be used in place of pressure.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

the ideal solution behavior indicates that the fugacity of each gas in the mixture is the product of
the mole fraction and fugacity of the pure gas at the temperature and pressure of the mixture.

$if Model$='Ideal'
K=(y[H2]*P/Po#)^2/(y[C2H6]*P/Po#) "equilibrium constant - ideal gas"
$elseif
duplicate i=1,2
f[i]=fugacity(N$[i],T=T,P=P) "fugacity of each gas"
end
K=(y[H2]*f[H2]/Po#)^2/(y[C2H6]*f[C2H6]/Po#) "equilibrium constant using
fugacities"
$endif

Create a Parametric table with columns for T, P_b and the mole fraction of hydrogen. Fill the
temperature columns with values between 25 C and 1000 C. Set limits for y[1] and y[2] to be 0
and 1, respectively. Solve the table for the ideal gas case and plot the results. Change Model$
tonon-ideal. It will be necessary to set lower limits for T_pc, and P_pc so that they do not
become less than zero during the iterative calculations. Solve and overlay the results on the plot
as shown. Relaxation of the ideal gas assumption appears to have a significant effect on the
pressure and smaller effect on the equilibrium hydrogen mole fractin.
240 1
mole fraction of H2
220 real gas mole fraction of H2
200 ideal gas

Hydrogen Mole Fraction


0.8
180
Pressure
Pressure [bar]

160 Real Gas


140 0.6

120
100 Pressure 0.4
Ideal Gas
80
60
0.2
40
20
0 0
0 200 400 600 800 1000
Temperature [C]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-11
Coal is increasingly less desirable as a fuel because it contains trace elements (e.g., mercury,
sulfur) that form pollutant when combusted and because of the large amount of CO2 that is
produced per unit energy. A proposed alternative is react coal (assumed here to be pure carbon)
with steam at 825C and a pressure that is to be determined. The following reactions are
believed to occur simultaneously.
C H 2 O CO H 2
CO H 2 O CO 2 H 2
C CO 2 2CO
Prepare plots of the hydrogen can CO mole fractions as a function of pressure for pressures
between 1 and 12 atm. Assume ideal gas behavior.

Only two of the three chemical equations in the problem statement are independent. This
problem can be solved using the Law of Mass Action for two of the three reactions or the
LaGrange method, which does not require information on the stoichiometry if each reaction.
The LaGrange method is more powerful and it is used here.

The pressure is set to 2 atm. It will be varied later.

$UnitSystem SI K Pa J molar
T=convertTemp(C,K,825 [C])
$ifnot ParametricTable
P_a=2 [atm]
$endif
P=P_a*convert(atm,Pa)

The elements and gases involved in these reactions are identified. Note that solid carbon is also
involved, but it is not a gas and it is not included in N_C, the number of gases.

N_E=3 "number of elements"


C=1; H=2; O=3 "identification of elements"

N_C=4 "number of gases"


H2=1; N$[H2]='H2'
H2O=2; N$[H2O]='H2O'
CO=3; N$[CO]='CO'
CO2=4; N$[CO2]='CO2'
Carbon=5; N$[Carbon]='C(gr)'

It is assumed that solid carbon is always present. In this case, the initial molar amount of water
does not have any affect on the mole fractions. It is set to 1. The initial moles of carbon are also
set to 1. Element balances are written for C, H, and O. The total moles of gases is the sum of
the moles of each of the N_C=4 gases.

n_H2O_0=1 "initial moles of H2O - does not affect


mole fractions"
"Basis: 1 mole of C and 1 mole of H2O"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

n[Carbon]+n[CO]+n[CO2]=1 "carbon balance"


2*n[H2]+2*n[H2O]=2*n_H2O_0 "hydrogen balance"
n[CO]+2*n[CO2]+n[H2O]=n_H2O_0 "oxygen balance"
n_gases=sum(n[i],i=1,N_C) "total moles of gas"

The derivatives of each element constraint equation with respect to the number of moles of each
chemical are required for implementation of the LaGrange method. The derivatives are placed in
the two-dimensional e array and filled by inspection of the element balance equations.

e[H2,C]=0; e[H2,H]=2; e[H2,O]=0 "element indices for use in the LaGrange method"
e[H2O,C]=0; e[H2O,H]=2; e[H2O,O]=1
e[CO,C]=1; e[CO,H]=0; e[CO,O]=1
e[CO2,C]=1; e[CO2,H]=0; e[CO2,O]=2
e[Carbon,C]=1; e[Carbon,H]=0; e[Carbon,O]=0

The mole fraction and chemical potential for each gas can be computed.

duplicate i=1,N_C
y[i]=n[i]/n_gases "mole fraction"
mu[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T,P=y[i]*P) "chemical potential"
end

The NASA external procedure is used to obtain specific enthalpy and entropy of solid carbon,
which are used to determine its chemical potential.

call NASA('c(gr)',T: cp_C, h_C, s_C) "properties of solid carbon"


mu[carbon]=(h_C-T*s_C)*convert(kJ/kmol,J/kmol) "chemical potential of solid carbon"

The LaGrange formulation is applied to all chemicals (including carbon) for all elements.

duplicate i=1,N_C+1
mu[i]+sum(lambda[j]*e[i,j],j=1,N_E)=0 "Lagrange method"
end

Set lower and upper limits of 0 and 1 for all of the mole fractions. The problem should solve.
Next, create a Parametric table with columns for P_a, y[1], and y[3]. Fill P_a with pressures
between 1 and 12 atm. Solve the table and plot the results. The plot appears below.
0.55

0.5
Mole Fractions

0.45 hydrogen

0.4

0.35
carbon monoxide

0.3

0.25
0 2 4 6 8 10 12
Pa [atm]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-12
Methane needs to be steam-reformed to produce hydrogen for use in a fuel-cell system. The
desired reaction is: CH 4 2 H 2 O CO 2 4 H 2 . However, other species may be present at
equilibrium. The equilibrium condition can be considered to be a mixture of CO2, CO, H2, H2O,
CH4 and solid carbon. Molecular oxygen has been shown to not be one of the products. The
presence of CO is a problem since CO is a poison to some types of fuel cell systems.
a.) Calculate and plot the equilibrium mole fractions of hydrogen and carbon monoxide for a
stoichiometric mixture of methane and water at 1 atm as a function of temperature for
temperatures between 500 and 1000 K. Assume that solid carbon does not form. Ideal gas
behavior can be assumed.
b.) Repeat part b but in this case, allow for the possibility that solid carbon may be present at
equilibrium. Plot the moles of solid carbon per mole of methane that form.

Both parts a and b can be coded at one time using $IF directives. Chose a basis of 1 mole of CH4
and 2 moles of H2O. Enter known information and identify elements, gases, and solid carbon.
The temperature will be varied, but temporarily set it to 900 K.

$UnitSystem SI K Pa J molar
"known information: CH4+ 2 H2O <=> CO2 + 4 H2 ideally"

P=1 [atm]*convert(atm,Pa) "atmospheric pressure"


R=R# "gas constant"
N_E=3 "3 elements"
C=1; H=2; O=3 "element IDs"
N_C=6 "total number of species including carbon"
N_gases=N_C-1 "total number of gases"

CO2=1; N$[CO2]='CO2' "identification of components"


CO=2; N$[CO]='CO'
H2=3; N$[H2]='H2'
H2O=4; N$[H2O]='H2O'
CH4=5; N$[CH4]='CH4'
Carbon=6; N$[Carbon]='C'

$ifnot ParametricTable
T=900 [K]
$EndIf

A string variable will be used to determine whether part a or part b is solved. When solving part
a, the moles of carbon is zero.

Part$='a'

$if Part$='a'
n[Carbon]=0 "moles of pure carbon - set to zero if not doing
part b"
$endif
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

Element balances are written for C, O, and H. The total moles of gases are computed and used to
calculate the mole fraction of each gas.

"Element balance constraints"


"Initially 1 mole of CH4 with 2 moles of steam"
n[CO2]+n[CO]+n[CH4]+n[Carbon]=1 [kmol] "C Balance"
2*n[CO2]+n[CO]+n[H2O]=2 [kmol] "O balance"
2*n[H2]+2*n[H2O]+4*n[CH4]=2*2 [kmol] "H balance"

n_Total=sum(n[i],i=1,N_gases) "don't count C in this sum of gas moles"


duplicate i=1,N_gases
y[i]=n[i]/n_Total "define mole fractions"
end

The chemical potential of each gas is found using the EES property data base. The carbon is
considered to be a pure phase and its chemical potential is found using the NASA external
procedure.

duplicate i=1,N_gases
mu[i]=enthalpy(N$[i],T=T)-T*entropy(N$[i],T=T, P=y[i]*P) "chemical potentials of each gqas"
end

Call NASA('C(gr)',T: cp_C, h_C , s_C)


mu[Carbon]=(h_C-T*s_C)*convert(kJ/kmol,J/kmol) "carbon acts as pure phase"

The derivative of the constraint equations with respect to each chemical are needed in the
Lagrange method.

"Constraint derivatives [constraint,species]"


e[CO2,C]=1; e[CO2,H]=0; e[CO2,O]=2 "CO2"
e[CO,C]=1; e[CO,H]=0; e[CO,O]=1 "CO"
e[H2,C]=0; e[H2,H]=2; e[H2,O]=0 "H2"
e[H2O,C]=0; e[H2O,H]=2; e[H2O,O]=1 "H2O"
e[CH4,C]=1; e[CH4,H]=4; e[CH4,O]=0 "CH4"
e[Carbon,C]=1; e[Carbon,H]=0; e[Carbon,O]=0 "C"

The Lagrange method is applied in case a for just the gases, and in case b for all of the
chemicals, including carbon.

$if Part$='a'
Duplicate i=1,N_gases
$elseif
duplicate i=1,N_C
$endif
mu[i]+sum(lambda[j]*e[i,j],j=1,N_E)=0 "Lagrange method"
end

Set lower and upper limits of 0 and 1 for the mole fractions. Create a Parametric table with
columns for T, y[2], y[3], and n[6]. Solve and plot the mole fractions versus temperature.
Change Part$=b and resolve. Plot the mole fractions and n[6], the moles of carbon per mole of
CH4. Replot. The plot is shown below. Carbon apparently does form at temperatures below
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

840 K, but it has little effect on the calculate mole fractions of H2 and CO. There appears to be a
difference in the mole fractions calculated with and without carbon for CO at temperatures above
840 C, but here, the moles of carbon was found to be negative and calculated values are not
valid.
0.5
no Carbon H2 mole fraction

Moles of C per mole of CH4


with Carbon
0.4
Mole Fractions and

0.3 moles C per mole of CH4


CO mole fraction

0.2

0.1
Part b values not valid

0
500 600 700 800 900 1000
T [K]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-13
Acetylene (C2H2) at 25C, 1 atm is used a fuel for a cutting torch. The fuel is reacted with air at
25C, 1 atm resulting in products that include CO2, CO, H2O, H, and N2, all at 1 atm. The
proportions of the acetylene and air are controlled by adjustable valves. A student has noticed
that smoke appears if he adjusts the torch to run lean, i.e., with insufficient air. He suspects that
the smoke could be visible carbon particles that form during the reaction. Is this possible?
Assume that the products exit the torch at equilibrium at 800 K. Calculate and plot the moles of
solid carbon that form per mole of acetylene for theoretical air percentages between 20% and
100%. Assume ideal gas behavior.

A basis of 1 kmol of C2H2 is chosen and the reaction with insufficient air is written. The
pressure is known. There are 4 elements present forming 5 gases and 6 compounds, including
carbon.

$UnitSystem SI K Pa J molar
$TabStops 0.2 3.75 in

"C2H2 + a(O2+3.76 N2) = n[CO2] CO2 + n[CO] CO + n[H2O] H2O + n[H2] H2 + n[N2] N2 + n[Carbon]
C"
"Basis: 1 kmol of C2H2"

T=800 [K] "temperature of products"


P=1 [atm]*convert(atm,Pa) "reaction pressure"
N_E=4 "number of elements"
C=1; H=2; O=3; N=4 "element identification"

N_C=5 "number of gases"


CO2=1; N$[CO2]='CO2' "gas identification"
CO=2; N$[CO]='CO'
H2O=3; N$[H2O]='H2O'
H2=4; N$[H2]='H2'
N2=5; N$[N2]='N2'
Carbon=6; N$[Carbon]='C(gr)'

The % theoretical air is set for now; it will be varied in a table. The stoichiometric value of the
moles of O2 is computed. The actual moles of oxygen is the % theoretical air divided by 100
times the stoichiometric value.

$ifnot ParametricTable
Theo%=80
$endif
2*a_stoic=2*2+1 "stoichiometric value of a"
a=a_stoic*Theo%/100 [%] "actual moles of oxygen per mole of C2H2"

Element balances are written for C, H, O, and N. The total moles of gas are computed.

n[CO2]+n[CO]+n[Carbon]=2 "C balance"


2*n[H2O]+2*n[H2]=2 "H balance"
2*n[CO2]+n[CO]+n[H2O]=2*a "O balance"
2*n[N2]=2*a*3.76 "N balance"
n_tot=sum(n[i],i=1,N_C) "total moles of gas"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

The derivative of each element balance with respect to the number of moles of each chemical is
needed in the Lagrange method. These derivatives are placed in the e array.

e[CO2,C]=1; e[CO2,H]=0; e[CO2,O]=2; e[CO2,N]=0 "derivative of element constraint wrt n[i]"


e[CO,C]=1; e[CO,H]=0; e[CO,O]=1; e[CO,N]=0
e[H2O,C]=0; e[H2O,H]=2; e[H2O,O]=1; e[H2O,N]=0
e[H2,C]=0; e[H2,H]=2; e[H2,O]=0; e[H2,N]=0
e[N2,C]=0; e[N2,H]=0; e[N2,O]=0; e[N2,N]=2
e[Carbon,C]=1; e[Carbon,H]=0; e[Carbon,O]=0; e[Carbon,N]=0

The mole fraction and chemical potential of each gas is determined.

duplicate i=1,N_C
y[i]=n[i]/n_Tot "mole fraction"
h[i]=enthalpy(N$[i],T=T) "specific enthalpy"
mu[i]=h[i]-T*entropy(N$[i],T=T,P=y[i]*P) "chemical potential"
end

The NASA external procedure is called to determine the properties of solid carbon, needed to
determine its chemical potential.

call NASA('c(gr)',T: cp_C, h_C, s_C) "properties of solid carbon"


h[Carbon]=h_C*convert(kJ/kmol,J/kmol) "specific enthalpy of solid carbon"
mu[carbon]=(h_C-T*s_C)*convert(kJ/kmol,J/kmol) "chemical potential of solid carbon"

The Lagrange method is applied.

duplicate i=1,N_C+1
mu[i]+sum(lambda[j]*e[i,j],j=1,N_E)=0 "Lagrange method"
end

Set the lower and upper limits of the mole fractions to be 0 and 1, respectively.

Create a Parametric table with columns for Theo% and n[6], the moles of carbon. Fill Theo%
with values between 20 and 100%. The plot appears below. Note that the moles of carbon
becomes negative for theoretical air percentages above about 82%. This clearly is not possible.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-14
Calcium carbonate (CaCO3) will spontaneously dissociate into calcium oxide (CaO) and carbon
dioxide gas (CO2) when heated if the equilibrium pressure of CO2 is sufficiently low. Calcium
carbonate is placed in an evacuated container and its temperature is raised from 25C to 1000C.
Prepare a plot of the expected pressure as a function of temperature. Note that property data for
solid CaCO3 and CaO are provided in the NASA external procedure. Instructions for using this
procedure can be found in the Function Information dialog (Options menu) with the External
routines button selected.

Enter the temperature. It will be varied later. The Law of Mass Action will be used for this
problem. The standard state Gibbs free energy for all three chemicals is found using the NASA
external procedure. Note that the names used by the NASA program for calcium carbonate and
calcium oxide are CaCO3(cr) and CaO(cr), respectively.

$UnitSystem SI K Pa kJ
$TabStops 0.2 3.5

"CaCO3= CO2 + CaO"

$ifnot ParametricTable
T=1000 [K]
$endif

N$[1]='CaCO3(cr)'; N$[2]='CO2'; N$[3]='CaO(cr)' "names of chemicals"

duplicate i=1,3
Call NASA(N$[i],T: cp[i],h[i],s|o[i])
g|o[i]=h[i]-T*s|o[i] "standard state specific Gibbs energy"
end

The standard-state Gibbs free energy change of reaction is entered for the dissociation reaction.

CaCO3=1; CO2=2; CaO=3


DELTAG|o=g|o[CaO]+g|o[CO2]-g|o[CaCO3] "Standard state Gibbs change of reaction"

The Law of Mass Action determines the equilibrium coefficient.

DELTAG|o=-R#*T*ln(K) "Law of mass action"

In this problem, CO2 is the only gas, since the solids do not have any significant vapor pressure.
Thus, K is just the pressure divided by the atmospheric pressure.

K=P/Po# "CaO and CaCO3 have no vapor pressure"

Create a Parametric table with columns for P and T. Fill the T column with values from 300 K
to 1000 K. Note that, at low temperatures, the pressure is very low. It may be necessary to reset
the default stopping criteria. The calculations will stop if the change in variables is less than the
specified value, which is 1e-9 by default. This is not an appropriate value for this problem, since
the pressure itself can be that low at low temperatures. Change the value to 1E-99 as shown.
The dialog is accessed with the Stop Criteria item in the Options menu.
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

A plot of the pressure versus temperature is shown. Negligible dissociation occurs for
temperatures under 500 K.
4
10
3
10
2
10
1
10
0
10
-1
10
P [Pa]

-2
10
-3
10
-4
10
-5
10
-6
10
-7
10
-8
10
300 400 500 600 700 800 900 1000
T [K]
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

14.B-15
A constant volume bomb is charged with 62 g of pure ethane (C2H6) at 24C, 5 bar. The bomb
and its contents are then heated to 500C and allowed to come to equilibrium. The equilibrium
products are expected to be ethane, methane (CH4), ethylene (C2H4), acetylene (C2H2), hydrogen
(H2), and possibly solid carbon.
a) What is the pressure and the composition of the bomb contents at the 500C equilibrium state
assuming that carbon does not form.

Enter known information.

$UnitSystem SI K kJ bar molar


$TabStops 0.2 1 3.5 in

R=R# "gas constant"


N=5 "total number of gases in products"
G$[1..N]=['C2H6','CH4','C2H4','C2H2','H2'] "names of gases"
C2H6=1; CH4=2; C2H4=3; C2H2=4; H2=5 "indices of gases"
T_init=convertTemp(C,K,24 [C]) "initial temperature"
P_init=5 [bar] "initial pressure"
T=convertTemp(C,K,500 [C]) "temperature of products"

Choose a basis of 1 kmol of ethane. Note that the 62 g is not useful since the volume is not
provided. However, this information is not needed. Carbon and hydrogen element balances
provide:

"Basis: 1 mole of C2H6"


2*n[C2H6]+2*n[C2H2]+n[CH4]+2*n[C2H4]=2 [kmol] "carbon balance"
2*n[H2]+2*n[C2H2]+6*n[C2H6]+4*n[CH4]+4*n[C2H4]=6 [kmol] "hydrogen balance"

The standard state (1 bar) values of the specific Gibbs free energy of each gas are computed.

"standard state if pure substance at 1 bar"


P|o=1 [bar] "pressure at reference state"
duplicate i=1,N
g|o[i]=enthalpy(G$[i],T=T)-T*entropy(G$[i],T=T,P=P|o) "specific Gibbs free energy at P|o"
end

The total moles of gases at equilibrium relative to the 1 kmol of ethane chosen as the basis is
determined and used to calculate the mole fraction of each gas.

n_gas=sum(n[i],i=1,N) "total moles of gas relative to basis"


duplicate i=1,N
y[i]=n[i]/n_gas "mole fraction of each gas"
end

Application of the ideal gas law to the mixture determines the pressure. A major effect in the
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

pressure is the change in the number of moles of gas.

P=P_init*(n_gas/1 [kmol])*T/T_init "equilibrium pressure (assuming ideal gas behavior)"

Assuming the mixture forms an ideal gas mixture, the chemical potential of each gas is

yi P
i io Runiv T ln o
for ideal gas mixture
P
duplicate i=1,N
mu[i]=g|o[i]+R*T*ln(y[i]*P/P|o) "chemical potential of each gas"
end

The number of degrees of freedom is equal to the number of gases (5) minus the number of
element balances (2). This problem could be solved by the law of mass action, minimizing G or
with Lagrange multipliers. The Lagrange method is used here. The first step in the Lagrange
method is to assemble the array of element indices, i.e., the derivative of each element balance
with respect to each gas.

Carbon=1; Hydrogen=2 "element indices"


"e[i,j] is the derivative of constraint i for species j
e[carbon,C2H6]=2; e[hydrogen,C2H6]=6
e[carbon,H2]=0; e[hydrogen,H2]=2
e[carbon,C2H2]=2; e[hydrogen,C2H2]=2
e[carbon,CH4]=1; e[hydrogen,CH4]=4
e[carbon,C2H4]=2; e[hydrogen,C2H4]=4

The Lagrange method is implemented with the following equations. E=2 in our case.

E
i j ei , j 0 for i 1..N
j 1

duplicate i=1,N
mu[i]+sum(lambda[j]*e[j,i],j=1,2)=0 "LaGrange method"
end

All of the equations have been entered, but now they need to be solved. If you try to solve at this
point, you will likely see the following error message.

The problem is highly non-linear so guess values and limits must be entered. First, to present
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

logs of negative numbers, set the lower and upper limits of y[i] to 1e-15 and 1, respectively.
Also, set the lower limit for n[i] and P to 1e-15.

The problem should now solve. The equilibrium pressure is 18.54 bar and the equilibrium mole
fractions are:

yC2H6=0.1055
yCH4=0.5969
yC2H4=0.2966
yC2H2=0.0009393
yH2=0.00004549

Note that very little hydrogen and acetylene are in the equilibrium mixture.

b) Repeat part a assuming carbon may be a product.

If present, carbon will form a pure phase. We need to determine the specific Gibbs free energy
of the carbon, which is done with the following function that is placed at the top of the Equations
window.

Function g_C(T)
Call NASA('C(gr)',T:cp,h,s) "NASA proves properties of carbon"
g_C=h-T*s
end

Most of the equations entered in part a can be reused, but the entire problem will be entered for
this part. The carbon balance is modified to include solid carbon.

R=R# "gas constant"


N=5 "total number of gases in products"
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

G$[1..N]=['C2H6','CH4','C2H4','C2H2','H2'] "names of gases"


C2H6=1; CH4=2; C2H4=3; C2H2=4; H2=5; C=6 "indices of gases"
T_init=convertTemp(C,K,24 [C]) "initial temperature"
P_init=5 [bar] "initial pressure"
T=convertTemp(C,K,500 [C]) "temperature of products"

"Basis: 1 mole of C2H6"


2*n[C2H6]+2*n[C2H2]+n[CH4]+2*n[C2H4]+n_c=2 [kmol] "carbon balance"
2*n[H2]+2*n[C2H2]+6*n[C2H6]+4*n[CH4]+4*n[C2H4]=6 [kmol] "hydrogen balance"

The standard state of pure carbon is found by calling the function.

"standard state if pure substance at 1 bar"


P|o=1 [bar] "pressure at reference state"
duplicate i=1,N
g|o[i]=enthalpy(G$[i],T=T)-T*entropy(G$[i],T=T,P=P|o) "specific Gibbs free energy at P|o"
end
g|o[C]=g_C(T) "specific Gibbs free energy of carbon

Solid carbon has negligible volume, so the mole fraction and pressure relations do not involve
the moles of carbon.

n_gas=sum(n[i],i=1,N) "total moles of gas relative to basis"


duplicate i=1,N
y[i]=n[i]/n_gas "mole fraction of each gas"
end

P=P_init*(n_gas/1 [kmol])*T/T_init "equilibrium pressure (assuming ideal gas behavior)"

Since carbon forms a pure phase, its chemical potential is equal to it specific Gibbs free energy.

duplicate i=1,N
mu[i]=g|o[i]+R*T*ln(y[i]*P/P|o) "chemical potential of each gas"
end
mu[C]=g|o[C] "carbon forms a pure phase"

The element indices array is determined for all species, including carbon.

Carbon=1; Hydrogen=2 "element indices"


"e[i,j] is the derivative of constraint i for species j"
e[carbon,C2H6]=2; e[hydrogen,C2H6]=6
e[carbon,H2]=0; e[hydrogen,H2]=2
e[carbon,C2H2]=2; e[hydrogen,C2H2]=2
e[carbon,CH4]=1; e[hydrogen,CH4]=4
e[carbon,C2H4]=2; e[hydrogen,C2H4]=4
e[carbon,C]=1; e[hydrogen,C]=0

The Lagrange equations are not applied to the 5 gases plus carbon.

duplicate i=1,N+1
mu[i]+sum(lambda[j]*e[j,i],j=1,2)=0 "LaGrange method"
end
S.A. Klein and G.F. Nellis
Cambridge University Press, 2011

Solving reveals a very different result from part a. The pressure is 20.96 bar. However, 0.61
kmol of carbon form and the mole fractions of the gases are:

yC2H6= 0.00007253
yCH4= 0.8619
yC2H4= 5.943E-08
yC2H2= 5.488E-14
yH2= 0.138

The equilibrium state indicates that there will be no double or triple-bonded substances present.
The only significant products are methane, hydrogen and solid carbon.

You might also like