Example_SV.m#

 1% -------------------------------------------------------------------------
 2% EXAMPLE: SV
 3% Compute Isentropic compression/expansion and equilibrium composition at 
 4% a defined set of specific volume (0.5, 2) for a lean CH4-air mixture at
 5% 700 K, a set of 24 species considered, and a equivalence
 6% ratio phi 0.5 [-]
 7%   
 8% Soot formation == {'CO2','CO','H2O','H2','O2','N2','Ar','Cbgrb',...
 9%                    'C2','C2H4','CH','CH3','CH4','CN','H',...
10%                    'HCN','HCO','N','NH','NH2','NH3','NO','O','OH'}
11%   
12% See wiki or setListspecies method from ChemicalSystem class for more predefined sets of species
13%
14% @author: Alberto Cuadra Lara
15%          Postdoctoral researcher - Group Fluid Mechanics
16%          Universidad Carlos III de Madrid
17%                 
18% Last update April 02 2024
19% -------------------------------------------------------------------------
20
21% Import packages
22import combustiontoolbox.databases.NasaDatabase
23import combustiontoolbox.core.*
24import combustiontoolbox.equilibrium.*
25import combustiontoolbox.utils.display.*
26
27% Get Nasa database
28DB = NasaDatabase();
29
30% Define chemical system
31system = ChemicalSystem(DB, 'soot formation');
32
33% Initialize mixture
34mix = Mixture(system);
35
36% Define chemical state
37set(mix, {'CH4'}, 'fuel', 1);
38set(mix, {'N2', 'O2', 'Ar', 'CO2'}, 'oxidizer', [78.084, 20.9476, 0.9365, 0.0319] / 20.9476);
39
40% Define properties
41mixArray = setProperties(mix, 'temperature', 700, 'volume', 0.5:0.01:2, 'equivalenceRatio', 0.5);
42
43% Initialize solver
44solver = EquilibriumSolver('problemType', 'SV');
45
46% Solve problem
47solver.solveArray(mixArray);
48
49% Plot adiabatic flame temperature
50plotFigure('vSpecific', mixArray, 'T', mixArray);
51
52% Plot molar fractions
53plotComposition(mixArray(1), mixArray, 'vSpecific', 'Xi', 'mintol', 1e-14);