The ThermophysicalData:-Chemicals package has been updated with a new property for selected species - the Gibbs Energy of Formation. This new property lets you model chemical reaction spontaneity and equilibrium problems.
The new property has been derived from the existing enthalpy and entropy data in the ThermophysicalData:-Chemicals package.
>
|
restart;
with( ThermophysicalData:-Chemicals )
|
|
|
|
|
Gibbs Energy of Ammonia
|
|
Compare the Gibbs energy of formation of NH3(g) from the ThermophysicalData:-Chemicals package to the data given in the CRC Handbook of Chemistry and Physics, 84th Edition.
>
|
crc_NH3_gibbs := [[298.15, -16.407 * 10^3], [300, -16.223 * 10^3], [400, -5.980 * 10^3], [500, 4.764 * 10^3], [600, 15.846 * 10^3], [700, 27.161 * 10^3], [800, 38.639 * 10^3], [900, 50.231 * 10^3], [1000, 61.903 * 10^3], [1100, 73.629 * 10^3], [1200, 85.392 * 10^3], [1300, 97.177 * 10^3], [1400, 108.975 * 10^3], [1500, 120.779 * 10^3]]:
|
>
|
plots:-display( plot( crc_NH3_gibbs, style = point ), plot( Property( Gmolar, "NH3(g)", "temperature" = T ), T = 298.15 .. 1500 ) )
|
|
|
Reaction Spontaneity
|
|
2 moles of NO are oxidized with 1 mole of O2. The reaction is
2 NO(g) + O2(g) ⇌ 2 NO2
Below what temperature is this reaction spontaneous?
Gibbs energy for NO, O2 and NO2
>
|
g_NO := T -> Property( "Gmolar", "NO(g)", "temperature" = T ):
g_O2 := T -> Property( "Gmolar", "O2(g)", "temperature" = T ):
g_NO2 := T -> Property( "Gmolar", "NO2(g)", "temperature" = T ):
|
Gibbs energy of the reaction
>
|
Gibbs_rn := T -> 2 * g_NO2(T) - 2 * g_NO(T) - g_O2(T):
plot( Gibbs_rn, 300 * Unit(K) .. 1000 * Unit(K), labels = [ "Temperature (K)", "Gibbs Energy (J/mol)" ], labeldirections = [ horizontal, vertical ] )
|
The Gibbs energy of the reaction must be negative for the reaction to be spontaneous. This occurs at or below this temperature,
>
|
fsolve( Gibbs_rn( T ) = 0, T = 1000 * Unit( K ) )
|
|
|
Adiabatic Flame Temperature and Combustion Products
|
|
Two moles of carbon monoxide and one mole of oxygen are burned at constant pressure. The reaction is
2 CO(g) + O2(g) ⇌ 2 CO2
The combustion products undergo dissociation and contain CO2, CO, O and O2.
•
|
The equilibrium composition is found by minimizing the Gibbs energy of the combustion products (formulated as a series of equations constructed via the method of Lagrange multipliers).
|
•
|
The adiabatic flame temperature is found by equating the enthalpy of the reactants and the enthalpy of the products.
|
The resulting equations are solved numerically to give the adiabatic flame temperature and equilibrium composition of the combustion products.
Enthalpies as a function of temperature
>
|
h_CO := Property("Hmolar", "CO(g)", "temperature" = T ):
h_CO2 := Property("Hmolar", "CO2(g)", "temperature" = T ):
h_O := Property("Hmolar", "O(g)", "temperature" = T ):
h_O2 := Property("Hmolar", "O2(g)", "temperature" = T ):
|
Gibbs free energy as a function of temperature
>
|
g_CO := Property("Gmolar", "CO(g)", "temperature" = T ):
g_O2 := 0:
g_CO2 := Property("Gmolar", "CO2(g)", "temperature" = T ):
g_O := Property("Gmolar", "O(g)", "temperature" = T ):
|
Reference enthalpies
>
|
h_r_CO2 := Property( Hmolar, "CO2(g)", temperature = 298.15 );
h_r_CO := Property( Hmolar, "CO(g)", temperature = 298.15 );
h_r_O := Property( Hmolar, "O(g)", temperature = 298.15 );
h_r_O2 := Property( Hmolar, "O2(g)", temperature = 298.15 );
|
Enthalpy of formation
>
|
h_f_CO := Property( "HeatOfFormation", "CO(g)" );
h_f_O2 := Property( "HeatOfFormation", "O2(g)" );
h_f_CO2 := Property( "HeatOfFormation", "CO2(g)" );
h_f_O := Property( "HeatOfFormation", "O(g)" )
|
Gas constant
Balance the atoms in the reactants and combustion products
2 CO + O2 = n1 CO2 + n2 CO + n3 O2 + n4 O
Atom balance on oxygen
>
|
con_1 := 2 * n_1 + n_2 + 2 * n_3 + n_4 = 4:
|
Atom balance on carbon
>
|
con_2 := n_1 + n_2 = 2:
|
Total number of moles in products
>
|
n_t := n_1 + n_2 + n_3 + n_4:
|
Gibbs energy of the combustion products
>
|
gibbs := n_1 * ( g_CO2 + R * T * ln( n_1 / n_t) ) + n_2 * ( g_CO + R * T * ln( n_2 / n_t ) ) + n_3 * ( g_O2 + R * T * ln( n_3 / n_t ) ) + n_4 * ( g_O + R * T * ln( n_4 / n_t ) ):
|
Minimize the Gibbs energy of the combustion products at equilibrium with Lagrange multipliers
>
|
eqComposition_1 := L_1 * diff( lhs( con_1 ), n_1 ) + L_2 * diff( lhs( con_2 ), n_1 ) = diff( gibbs, n_1 ):
eqComposition_2 := L_1 * diff( lhs( con_1 ), n_2 ) + L_2 * diff( lhs( con_2 ), n_2 ) = diff( gibbs, n_2 ):
eqComposition_3 := L_1 * diff( lhs( con_1 ), n_3 ) + L_2 * diff( lhs( con_2 ), n_3 ) = diff( gibbs, n_3 ):
eqComposition_4 := L_1 * diff( lhs( con_1 ), n_4 ) + L_2 * diff( lhs( con_2 ), n_4 ) = diff( gibbs, n_4 ):
|
Equate the enthalpy of the reactants and products
>
|
flameTemp := 2 * h_f_CO + h_f_O2 = n_1 * h_CO2 + n_2 * h_CO + n_3 * h_O2 + n_4 * h_O :
|
Solve the equation system
>
|
sol := fsolve( { eqComposition_1, eqComposition_2, eqComposition_3, eqComposition_4, flameTemp, con_1, con_2 }, { L_1 = -10000, L_2 = -10000, T = 3000, n_1 = 0.1, n_2 = 0.1, n_3 = 0.1, n_4 = 0.1 } )
|
The flame temperature in Kelvin is
The mole fractions of CO2, CO, O2 and O in the combustion products are
>
|
eval( seq( n_||i / ( n_1 + n_2 + n_3 + n_4 ), i = 1 .. 4 ), sol )
|
|
|