Example_HP_COMPLETE_INCOMPLETE.m#

 1% -------------------------------------------------------------------------
 2% EXAMPLE: HP COMPLETE VS INCOMPLETE
 3%
 4% Compute adiabatic temperature and equilibrium composition at constant
 5% pressure (e.g., 1.01325 bar) for lean to rich natural gas-air mixtures at
 6% standard conditions, a set of equivalence ratios phi contained in
 7% (0.5, 3) [-], and two different sets of species "Complete" or "Incomplete"
 8% 
 9% * Complete:
10%       - lean = {'CO2', 'H2O', 'N2', 'Ar', 'O2'};                (equivalence ratio < 1)
11%       - rich = {'CO2', 'H2O', 'N2', 'Ar', 'CO', 'H2'};          (equivalence ratio > 1)
12%       - soot = {'N2', 'Ar', 'CO', 'H2', 'Cbgrb', 'CO2', 'H2O'}; (equivalence ratio > equivalence ratio soot)   
13%
14% * Incomplete:
15%       - Soot formation == {'CO2','CO','H2O','H2','O2','N2','Ar','Cbgrb',...
16%                            'C2','C2H4','CH','CH3','CH4','CN','H',...
17%                            'HCN','HCO','N','NH','NH2','NH3','NO','O','OH'}
18%   
19% See wiki or list_species() for more predefined sets of species
20%
21% @author: Alberto Cuadra Lara
22%          PhD Candidate - Group Fluid Mechanics
23%          Universidad Carlos III de Madrid
24%                 
25% Last update Oct 13 2022
26% -------------------------------------------------------------------------
27
28%% COMPLETE COMBUSTION
29% Initialization
30self = App('Complete');
31% Set fuel composition 
32self.PD.S_Fuel = {'CH4', 'C2H6', 'C3H8', 'C4H10_isobutane', 'H2'};
33self.PD.N_Fuel = [0.8, 0.05, 0.05, 0.05, 0.05];
34% Set oxidizer composition
35self = set_air(self, false);
36% Set temperature, pressure and equivalence ratio
37self = set_prop(self, 'TR', 300, 'pR', 1.01325, 'phi', 0.5:0.02:3);
38% Set constant pressure for products
39self = set_prop(self, 'pP', self.PD.pR.value);
40% Solve Problem
41self = solve_problem(self, 'HP');
42% Save results
43results_complete = self;
44%% INCOMPLETE COMBUSTION
45% Set product species at equilibrium
46self = App('copy', self, 'Soot formation');
47% Solve Problem
48self = solve_problem(self, 'HP');
49% Save results
50results_incomplete = self;
51%% COMPARE RESULTS
52mix1 = results_complete.PS.strR; % Is the same as the incomplete case (same initial mixture)
53mix2_complete = results_complete.PS.strP; 
54mix2_incomplete = results_incomplete.PS.strP;
55
56phi = cell2vector(mix1, 'phi');
57
58self.Misc.config.title = '\rm{Complete\ vs\ Incomplete}';
59self.Misc.config.labelx = 'Equivalence ratio $\phi$';
60self.Misc.config.labely = 'Temperature $T$ [K]';
61legend_name = {'Complete', 'Incomplete'};
62
63ax = plot_figure('phi', phi, 'T', mix2_complete, 'config', self.Misc.config);
64ax = plot_figure('phi', phi, 'T', mix2_incomplete, 'config', self.Misc.config, 'ax', ax, 'legend', legend_name, 'color', 'auto');
65ax.Legend.Location = 'northeast';