Chemical Equilibrium

Versione 1.0.0 (3,37 KB) da Julian
Calculates the chemical equilibrium of gas phase reactions or reactions between gases and solids.
22 download
Aggiornato 1 mar 2024

Visualizza la licenza

Introduction
The function getEqmComp.m determines the composition of a reactive system comprising gaseous and solid species at chemical equilibrium, for a given temperature and pressure. The chemical equilibrium is determined by minimizing the Gibbs free energy subject to the conservation of all elements:
Assumptions
The gaseous species are assumed to abide ideal gas behavior,
,
with
and
.
The solid is assumed to be pure, with no pressure dependence of the enthalpy and entropy,
,
with
and
.
For gaseous species, constant values for the heat capacity as well as calculation of the heat capacity from DIPPR equation 107 are supported, while for solid species, a constant heat capacity is assumed. However, the model can easily be extended to other temperature (and pressure) dependencies of the heat capacity. DIPPR equation 107, applied to the heat capacity, is given by
.
Short Description of Functions
  • ThermoPropertiesIG() calculates enthalpy, entropy, and Gibbs free energy of an ideal gas as a function of temperature and pressure. The reference values for enthalpy and entropy must be passed as arguments, as well as the model that should be used for the heat capacity ("const" or "DIPPR107") and the respective parameters.
  • ThermoPropertiesS() calculates enthalpy, entropy, and Gibbs free energy of a pure solid as a function of temperature, given the reference values for enthalpy and entropy and a value for the heat capacity.
  • getEqmComp() calculates the equilibrium composition of the mixture for a specified temperature and pressure. The initial composition of the system as well as structures representing the gaseous and solid species must be passed as arguments.
Examples
Reverse Water-Gas-Shift Reaction (no solids)
% Each gaseous species is specified by its composition, ideal gas heat of formation at 298.15 K
% in kJ/mol, standard entropy at 298.15 K and 1 bar in kJ/(mol-K),
% the heat capacity model to be used ("const" or "DIPPR107"), and a value for the heat capacity or the
% [Parameters A, B, C, D, and E for ideal gas heat capacity according to DIPPR equation 107] in kJ/(mol-K)
% With gas heat capacity from DIPPR 107
propertiesIG = struct("Hydrogen", struct("composition", struct("H", 2), "h_0IG", 0, "s_0IG", 0.13068, "Cp_model", "DIPPR107", "Cp_params", [0.027617, 0.00956, 2466, 0.00376, 567.6]), ...
"Carbon_Monoxide", struct("composition", struct("C", 1, "O", 1), "h_0IG", -110.53, "s_0IG", 0.19766, "Cp_model", "DIPPR107", "Cp_params", [0.029108, 0.008773, 3085.1, 0.0084553, 1538.2]),...
"Carbon_Dioxide", struct("composition", struct("C", 1, "O", 2), "h_0IG", -393.51, "s_0IG", 0.21379, "Cp_model", "DIPPR107", "Cp_params", [0.02937, 0.03454, 1428, 0.0264, 588]), ...
"Water", struct("composition", struct("H", 2, "O", 1), "h_0IG", -241.81, "s_0IG", 0.18884, "Cp_model", "DIPPR107", "Cp_params", [0.033363, 0.02679, 2610.5, 0.008896, 1169]));
% With constant gas heat capacity
% propertiesIG = struct("Hydrogen", struct("composition", struct("H", 2), "h_0IG", 0, "s_0IG", 0.13068, "Cp_model", "const", "Cp_params", 0.0288), ...
% "Carbon_Monoxide", struct("composition", struct("C", 1, "O", 1), "h_0IG", -110.53, "s_0IG", 0.19766, "Cp_model", "const", "Cp_params", 0.0291),...
% "Carbon_Dioxide", struct("composition", struct("C", 1, "O", 2), "h_0IG", -393.51, "s_0IG", 0.21379, "Cp_model", "const", "Cp_params", 0.0372), ...
% "Water", struct("composition", struct("H", 2, "O", 1), "h_0IG", -241.81, "s_0IG", 0.18884, "Cp_model", "const", "Cp_params", 0.0336));
propertiesS = struct();
% Initial composition, temperature, and pressure
n_ini_IG = [1, 0, 1, 0]; % [mol] ORDER MUST BE THE SAME AS IN THE STRUCTURE propertiesIG, i.e. H2, CO, CO2, H2O
n_ini_S = 0;
T_range = 873.15:10:1473.15; % [K]
p = 100; % [kPa]
% Calculate equilibrium composition at various temperatures
n_eqm_vec = zeros(length(n_ini_IG), length(T_range));
for i=1:length(T_range)
T = T_range(i);
n_eqm = getEqmComp(n_ini_IG, n_ini_S, T, p, propertiesIG, propertiesS);
n_eqm_vec(:, i) = n_eqm;
end
% Visualize results
figure;
plot(T_range-273.15, n_eqm_vec, LineWidth=2);
legend("H_2", "CO", "CO_2", "H_{2}O", Location="best");
legend boxoff;
xlabel("Temperature (°C)");
ylabel("Amount of Substance (mol)");
Coal gasification (gas-solid reaction)
% With gas heat capacity from DIPPR 107
propertiesIG = struct("Oxygen", struct("composition", struct("O", 2), "h_0IG", 0, "s_0IG", 0.20515, "Cp_model", "DIPPR107", "Cp_params", [0.029103, 0.01004, 2526.5, 0.009356, 1153.8]), ...
"Carbon_Monoxide", struct("composition", struct("C", 1, "O", 1), "h_0IG", -110.53, "s_0IG", 0.19766, "Cp_model", "DIPPR107", "Cp_params", [0.029108, 0.008773, 3085.1, 0.0084553, 1538.2]),...
"Carbon_Dioxide", struct("composition", struct("C", 1, "O", 2), "h_0IG", -393.51, "s_0IG", 0.21379, "Cp_model", "DIPPR107", "Cp_params", [0.02937, 0.03454, 1428, 0.0264, 588]));
% Each solid species is specified by its composition, heat of formation at 298.15 K in kJ/mol,
% standard entropy at 298.15 K and 1 bar in kJ/(mol-K), and heat capacity in kJ/(mol-K)
propertiesS = struct("Carbon", struct("composition", struct("C", 1), "h_0_s", 0, "s_0_s", 0.005833, "C_s", 0.008598));
% Initial composition, temperature, and pressure
n_ini_IG = [0.6, 0, 0]; % [mol] ORDER MUST BE THE SAME AS IN THE STRUCTURE propertiesIG, i.e. H2, CO, CO2, H2O
n_ini_S = 1;
T_range = 873.15:10:1473.15; % [K]
p = 100; % [kPa]
% Calculate equilibrium composition at various temperatures
n_eqm_vec = zeros(length(n_ini_IG)+length(n_ini_S), length(T_range));
for i=1:length(T_range)
T = T_range(i);
n_eqm = getEqmComp(n_ini_IG, n_ini_S, T, p, propertiesIG, propertiesS);
n_eqm_vec(:, i) = n_eqm;
end
% Visualize results
figure;
plot(T_range-273.15, n_eqm_vec, LineWidth=2);
legend("O_2", "CO", "CO_2", "C", Location="best");
legend boxoff;
xlabel("Temperature (°C)");
ylabel("Amount of Substance (mol)");
Where to Find Data
  • Standard enthalpy and entropy values for gaseous species can be obtained from cccbdb.nist.gov, DIPPR 107 parameters for the heat capacities from Aspen Plus or databases
  • Heat capacity and standard entropy of some solids are reported in the NIST Chemistry WebBook
Contact
Feel free to reach out to me under ufert@mit.edu.
Disclaimer
The functions are provided 'as is', without warranty of any kind, express or implied.

Cita come

Julian (2024). Chemical Equilibrium (https://www.mathworks.com/matlabcentral/fileexchange/160431-chemical-equilibrium), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2023b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Tag Aggiungi tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0