-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaerothermochemistry.m
101 lines (78 loc) · 4.66 KB
/
aerothermochemistry.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
function[SM_results] = aerothermochemistry(Pc, AR_sup)
% Define Propellant Ingredients & initial condition
% For example
% SM_inputs = CEAinput();
%
% SM_inputs.ox1 = 'NH4CLO4(I)'; %primary oxidizer
% SM_inputs.ox1T = 298; %primary ox temp (K)
%
% SM_inputs.fu1 = 'C4H6,butadiene'; %primary fuel
% SM_inputs.fu1T = 298; %primary fuel temp (K)
%
% SM_inputs.fu2 = 'AL(cr)'; %secondary fuel
% SM_inputs.fu2T = 298; %secondary fuel temp (K)
%
% SM_inputs.ox1wt = 80; %primary oxidizer weight (by mass) in total
% SM_inputs.fu1wt = 10; %primary fuel weight (by mass) in total
% SM_inputs.fu2wt = 10; %secondary fuel weight (by mass) in total
%
% SM_inputs.Pc = Pc; %chamber pressure (Pa)
%
% SM_inputs.supar = AR_sup; % nozzle expansion ratio
%% Insert Algorithms or Table of Theoretical Aerothermochemistry Data for the chamber, nozzle throat and nozzle exit
% SM_results.T = 2616; % [K] chamber temperature
% SM_results.g = 1.235; % ratio of specific heats
% SM_results.MolWt = 22.959; % molecular weight
% SM_results.rho = 7.276; % [kg/m3] gas density
% SM_results.c = 1500; % [m/s] cstar
SM_inputs = CEAinput();
SM_inputs.ox1 = 'NH4CLO4(I)'; %primary oxidizer
SM_inputs.ox1T = 298; %primary ox temp (K)
SM_inputs.fu1 = 'C4H6,butadiene'; %primary fuel
SM_inputs.fu1T = 298; %primary fuel temp (K)
SM_inputs.fu2 = 'AL(cr)'; %secondary fuel
SM_inputs.fu2T = 298; %secondary fuel temp (K)
SM_inputs.ox1wt = 80; %primary oxidizer weight (by mass) in total
SM_inputs.fu1wt = 10; %primary fuel weight (by mass) in total
SM_inputs.fu2wt = 10; %secondary fuel weight (by mass) in total
SM_inputs.Pc = Pc; %chamber pressure (Pa)
SM_inputs.supar = AR_sup; % nozzle expansion ratio
%% Insert Algorithms or Table of Theoretical Aerothermochemistry Data for the chamber, nozzle throat and nozzle exit
SM_results.T = 2616; % [K] chamber temperature
SM_results.g = 1.235; % ratio of specific heats
SM_results.MolWt = 22.959; % molecular weight
SM_results.rho = 7.276; % [kg/m3] gas density
SM_results.c = 1500; % [m/s] cstar
%% Return results
%SM_results1 = SM_inputs.getresults(1,'si');
%SM_results2 = SM_inputs.getresults(2,'si');
%SM_results3 = SM_inputs.getresults(3,'si'); %1 for chamber conditions, 2 for throat, 3 for nozzle exit: requires arg for area ratio or exit pressure), 'en' for english units
%% New Method to retrieve data from CEA:
reactants = [ ...
CEA.Reactant('C3H8', ...
'Type','Fuel', ...
'E',DimVar(-10000,'J/mol'), ...
'T',DimVar(27,'C'), ...
'Q',DimVar(1,'kg')) ...
CEA.Reactant('H2O2(L)', ...
'Type','ox', ...
'T',DimVar(298,'K'), ...
'Q',DimVar(0.9,'kg')) ...
CEA.Reactant('H2O(L)', ...
'Type','ox', ...
'T',DimVar(298,'K'), ...
'Q',DimVar(0.1,'kg')) ...
];
data = CEA.Run(reactants, ...
'ProblemType','Rocket', ...
'Flow','eq', ...
'Pc',DimVar(Pc*0.000145038,'psi'), ...
'OF',1, ...
'Outputs',{'T','gam','m','rho','son'});
disp(data)
SM_results.T = data.Temperature(1,1); % [K] chamber temperature
SM_results.g = data.gam(1,1); % ratio of specific heats
SM_results.MolWt = data.MolarMass(1,1); % molecular weight
SM_results.rho = data.Density(1,1); % [kg/m3] gas density
SM_results.c = data.son(1,1); % [m/s] cstar
end