-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaggregate_paraview_data.asv
230 lines (194 loc) · 6.19 KB
/
aggregate_paraview_data.asv
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
%% read csv
clear all
%% First time running after cloning - setup up results directories
setup_dir = true;
if setup_dir
setup_directories;
end
%% read files, set names
test_run_name = 'IS_inf_fusing';
n_steps = '2125000';
cell_data = readtable('./raw_cell_data/celldata_IS_inf_fusing.csv');
grid = readtable('./raw_cell_data/grid_NS_silica.csv');
flame = 'NS'; % NS, IS, S
%% grid size
NX = 200;
NY = 100;
NZ = 1;
total_cells = NX*NY*NZ;
cell_info = zeros(total_cells, 26);
offsets = [1,NX+1, NX+2, (NX+1)*(NY+1),(NX+1)*(NY+1)+1, (NX+1)*(NY+1) + (NX+1), (NX+1)*(NY+1) + (NX+2)];
%% add cellcentre cols to cell_data
cellcentre_0 = zeros(total_cells,1);
cellcentre_1 = zeros(total_cells,1);
cellcentre_2 = zeros(total_cells,1);
cell_data = addvars(cell_data,cellcentre_0);
cell_data = addvars(cell_data,cellcentre_1);
cell_data = addvars(cell_data,cellcentre_2);
%%
% row_no = true cellid +1
cell_data = calc_add_cell_centres(total_cells,offsets,cell_data, grid,cell_info);
%% Particulate phase
% PSD parameters
m = 60;
index_crit = 13;
% psds = zeros()
ni = zeros(total_cells,m);
np = zeros(total_cells,m);
moments = zeros(total_cells, 4);
rho= zeros(total_cells,1);
dps = zeros(total_cells,2);
[v,dv,v_m, psd_headings] = get_pbe_grid_info(cell_data);
for cell_id = 1:total_cells
ni(cell_id,:) = get_agg_psd(cell_id,index_crit,m,psd_headings,cell_data);
np(cell_id,:) = get_np(cell_id,index_crit,m,psd_headings,cell_data);
rho(cell_id) = get_rho(cell_id,cell_data);
moments(cell_id,1) = sum( rho(cell_id)*ni(cell_id,:)'.*dv(:) ); % Mo, zeroth moment
moments(cell_id,2) = sum( rho(cell_id)*ni(cell_id,:)'.*dv(:).*v_m(:) ); % M1, first moment
moments(cell_id,3) = sum( rho(cell_id)*np(cell_id,:)'.*dv(:) ); % Mp,o
end
%% calc integrated Soot VF
% get x positions: HAB (m)
HABs = unique(cell_data.cellcentre_0);
int_SVF = calc_ISVF(HABs,cell_data, moments,cell_info);
%% find annulus of max soot
%--------------------------------------------
% dp calculation method
%--------------------------------------------
dp_select = 3;
%1 = volume fraction based: M1/Mp,o
%2 = Surface area based: Surface Area/Mp,o
%3 = 6 Vn/An Diemer approach: 6Vn/An based on point cntact assumption
% Assumed kf = 1.84, Df = 1.8 (constant)
% extract all cells with that radius
HABs = unique(cell_data.cellcentre_0);
max_soot_cells = zeros(length(HABs),7);
[max_soot_cells,nav_agg_only] = get_path_max_soot(index_crit,HABs,m,ni,np,rho,dv, cell_data,moments,dp_select);
%% Radial Distributions
chosen_HAB = [0.003,0.005,0.007,0.01, 0.02, 0.05, 0.069];
all_habs = unique(cell_data.cellcentre_0);
[T_radial, OH_radial,rho_radial,acet_radial,total_conc_radial,ox_rate_fv] = get_radial_dists(chosen_HAB,all_habs,cell_data);
%
% H = size(chosen_HAB,2);
%
% T_radial = zeros(100,2,H);
% OH_radial= zeros(100,2,H);
% rho_radial= zeros(100,2,H);
% acet_radial = zeros(100,2,H);
%
% for h = 1:size(chosen_HAB,2)
% HAB = chosen_HAB(h);
% j=1;
%
% while(all_habs(j)<HAB)
% j=j+1;
% end
%
%
% row_beneath = cell_data.cellcentre_0 == all_habs(j-1);
% row_above = cell_data.cellcentre_0 == all_habs(j);
%
%
% cells_above = cell_data(row_above,:);
% cells_beneath = cell_data(row_beneath,:);
%
%
% radial_locs = unique(cells_above.cellcentre_1);
%
%
% for k = 1:size(cells_above)
%
%
% T_radial(k,1,h) = radial_locs(k);
% T_radial(k,2,h) = 0.5*(cells_beneath.T(k) + cells_above.T(k));
%
%
% OH_radial(k,1,h) = radial_locs(k);
% OH_radial(k,2,h) = 0.5*(cells_beneath.OH(k) + cells_above.OH(k));
%
%
% rho_radial(k,1,h) = radial_locs(k);
% rho_radial(k,2,h) = 0.5*(cells_beneath.drho(k) + cells_above.drho(k));
%
%
% acet_radial(k,1,h) = radial_locs(k);
% acet_radial(k,2,h) = 0.5*(cells_beneath.C2H2(k) + cells_above.C2H2(k));
% end
% end
%% save matlab objs
processed_results_dir = './processed_results/';
if not(isfolder(strcat(processed_results_dir,test_run_name)))
mkdir(strcat(processed_results_dir,test_run_name))
end
save(strcat(strcat(processed_results_dir,test_run_name),'/',test_run_name,n_steps));
%% get psd at cell id
%
% mode = 9; %1 = psd, 2= X0
%
% for c = 1:size(max_soot_cells,1)
% cell_id = max_soot_cells(c,1);
% n = ni(cell_id,:);
% n_p = np(cell_id,:);
%
% hab = cell_data.cellcentre_0(cell_id +1);
% x1 = cell_data.X1(cell_id);
% x0 = cell_data.X0(cell_id);
% nu_fv = cell_data.Nuc_fv(cell_id);
% ox = cell_data.Oxidation_O2_fv(cell_id) + cell_data.Oxidation_OH_fv(cell_id);
% surface_area = cell_data.Surface_area(cell_id);
% g_fv = cell_data.Growth_fv(cell_id);
% x01 = cell_data.X01(cell_id);
% T = cell_data.T(cell_id);
%
% if(mode ==1 )
% loglog(v_m,n);
% text(v_m(30),10^40,strcat('HAB = ',num2str(hab)));
% text(v_m(30),10^30,strcat('X1 = ',num2str(x1)));
% text(v_m(30),10^25,strcat('X0 = ',num2str(x0)));
% axis([v_m(1),v_m(end),10^20,10^50])
% x = input(strcat('curr cellid = ',num2str(cell_id)));
% elseif(mode ==2 )
% hold on
% plot(hab,x1,'ob');
% elseif(mode==3)
% hold on
% plot(hab,nu_fv,'ro')
% elseif(mode==4)
% hold on
% plot(hab,ox,'ro')
% elseif(mode==5)
% hold on
% plot(hab,surface_area,'bo')
% elseif(mode==6)
% hold on
% plot(x01,g_fv,'ro')
% elseif(mode==7)
% hold on
% plot(hab,T,'bo')
%
% elseif(mode ==8)
% hold on
% plot(hab,x0,'or-');
% text(hab,x0,num2str(cell_id));
% elseif(mode==9)
%
% loglog(v_m,n,'r');
% hold on
% loglog(v_m,n_p,'b');
% txt = strcmp('HAB =',num2str(hab));
%
% disp(txt);
% disp(num2str(hab));
%
% % text(v_m(30),10^40,num2str(hab));
%
% text(v_m(30),10^40,strcat('HAB = ',num2str(hab)));
% text(v_m(5),1,'NS flame 5,000 K fusing model');
% % text(v_m(30),10^30,strcat('X1 = ',num2str(x1)));
% % text(v_m(30),10^25,strcat('X0 = ',num2str(x0)));
% % axis([v_m(1),v_m(end),10^20,10^50])
%
% x = input(strcat('curr cellid = ',num2str(cell_id)));
% close all
% end
% end