|
1 | | -function [ vidMFlux ] = massFlux3D( runpath,vis,viewaz,viewel,ghostcells,... |
| 1 | +function [ massratio ] = massFlux3D( runpath,vis,viewaz,viewel,ghostcells,... |
2 | 2 | IMAX,JMAX,KMAX,tickx,ticky,tickz,XRES,YRES,ZRES,labelx,labely,labelz,... |
3 | 3 | labelXunit,labelYunit,labelZunit,run,timesteps,postpath,massflux_alts,... |
4 | 4 | RO_S1,RO_S2,RO_S3,plumeedge,massflux_crange,PULSE,FREQ,time,... |
|
10 | 10 | % Detailed explanation goes here |
11 | 11 | % |
12 | 12 | % Functions called: loadTimestep3D; pulsetitle |
13 | | -% Last edit: Taryn Black, 15 April 2016 |
| 13 | +% Last edit: Taryn Black, 19 April 2016 |
14 | 14 |
|
15 | 15 | % Clear directory of appending files from previous processing attempts |
16 | 16 | cd(savepath) |
|
45 | 45 | % Subtightplot properties |
46 | 46 | gap = [0.01 0.01]; |
47 | 47 | ht = 0.15; |
48 | | - wd = 0.15; |
| 48 | + wd = 0.10; |
49 | 49 |
|
50 | 50 |
|
51 | 51 | % ----------------------- FIGURE INITIALIZATION ----------------------- % |
|
56 | 56 |
|
57 | 57 | % Mass flux slice: figure and axes properties |
58 | 58 | figMFlux = figure('Name','Mass flux','units','centimeters',... |
59 | | - 'outerposition',[0 0 28 18.75],'visible',vis,'PaperPositionMode',... |
| 59 | + 'outerposition',[0 0 33 18.75],'visible',vis,'PaperPositionMode',... |
60 | 60 | 'auto','color','w'); |
61 | 61 | cd(postpath) |
62 | 62 | axMFlux1 = subtightplot(1,2,1,gap,ht,wd); |
|
134 | 134 |
|
135 | 135 | % Preallocate vectors |
136 | 136 | netMF_alts = zeros(length(massflux_alts),timesteps); |
137 | | - collapse_crit = zeros(1,timesteps); |
| 137 | +% collapse_crit = zeros(1,timesteps); |
138 | 138 |
|
139 | 139 |
|
140 | 140 | % =================== B E G I N T I M E L O O P =================== % |
|
192 | 192 | logMF(logMF>0) = log10(logMF(logMF>0)); |
193 | 193 | logMF(logMF<0) = -log10(abs(logMF(logMF<0))); |
194 | 194 |
|
195 | | - % Calculate most-negative flux and vent flux for Ongaro criterion |
196 | | - massflux_jetheight = massflux(:,:,round(jetheight)); |
197 | | - netnegmassflux_JH = sum(massflux_jetheight(massflux_jetheight<0)); |
198 | | -% negMF = abs(min(netmassflux(netmassflux<0))); |
199 | | - if isempty(netnegmassflux_JH) |
200 | | - netnegmassflux_JH = 0; |
201 | | - end |
202 | | - collapse_crit(t) = -netnegmassflux_JH/MASSFLUX_SOL; |
203 | | - dlmwrite(fullfile(savepath,sprintf('collapseRatio_%s.txt',run)),... |
204 | | - [time(t) netnegmassflux_JH MASSFLUX_SOL collapse_crit(t)],... |
205 | | - '-append','delimiter','\t'); |
206 | | - |
| 195 | +% % Calculate net negative flux and collapse criterion |
| 196 | +% massflux_jetheight = massflux(:,:,round(jetheight)); |
| 197 | +% netnegmassflux_JH = sum(massflux_jetheight(massflux_jetheight<0)); |
| 198 | +% if isempty(netnegmassflux_JH) |
| 199 | +% netnegmassflux_JH = 0; |
| 200 | +% end |
| 201 | +% collapse_crit(t) = -netnegmassflux_JH/MASSFLUX_SOL; |
| 202 | +% dlmwrite(fullfile(savepath,sprintf('collapseRatio_%s.txt',run)),... |
| 203 | +% [time(t) netnegmassflux_JH MASSFLUX_SOL collapse_crit(t)],... |
| 204 | +% '-append','delimiter','\t'); |
207 | 205 |
|
208 | 206 |
|
209 | 207 | % --------------------- MASS FLUX SLICE FIGURE -------------------- % |
|
227 | 225 | [plumeedge plumeedge]); |
228 | 226 | set(hEPZ2,'EdgeColor',[1 1 1],'LineWidth',0.5); |
229 | 227 | caxis(axMFlux2,[-log10(abs(massflux_crange(1))) log10(massflux_crange(2))]); |
230 | | -% tMF = pulsetitle(varMF,PULSE,time,t,titlerun,FREQ); |
231 | | - tMF2 = sprintf('Jet height: %.3f km',jetheight*YRES/1000); |
232 | | - title(axMFlux2,[tMF2],'FontWeight','bold'); |
| 228 | + tMF2 = sprintf('Jet height: %.3f km',jetheight*YRES/1000); |
| 229 | + title(axMFlux2,tMF2,'FontWeight','bold'); |
233 | 230 | PosMF1 = get(axMFlux1,'position'); |
234 | 231 | PosMF2 = get(axMFlux2,'position'); |
235 | 232 | PosMF2(3:4) = PosMF1(3:4); |
236 | 233 | set(axMFlux2,'position',PosMF2); |
| 234 | + set(figMFlux,'Visible',vis); |
237 | 235 | % ================================================================= % |
238 | 236 |
|
239 | 237 |
|
|
244 | 242 | hMFZ = plot(netmassflux,1:JMAX-ghostcells,'k','LineWidth',2); |
245 | 243 | tMFZ = pulsetitle(varMFZ,PULSE,time,t,titlerun,FREQ); |
246 | 244 | title(axAvgMFZ,tMFZ,'FontWeight','bold'); |
| 245 | + set(figAvgMFZ,'Visible',vis); |
247 | 246 | % ================================================================= % |
248 | 247 |
|
249 | 248 |
|
|
284 | 283 | % End video write and finish video files |
285 | 284 | cd(savepath) |
286 | 285 | close(vidMFlux); |
| 286 | + |
| 287 | + % Calculate ratio of mass below jet height to total mass erupted at end |
| 288 | + % of simulation |
| 289 | + totalmass = RO_S1*EPS1 + RO_S2*EPS2 + RO_S3*EPS3; |
| 290 | + massbelowJH = totalmass(:,:,1:round(jetheight)); |
| 291 | + collapsemass = sum(massbelowJH(:)); |
| 292 | + eruptedmass = MASSFLUX_SOL*time(end); |
| 293 | + massratio = collapsemass/eruptedmass; |
| 294 | + dlmwrite(fullfile(savepath,sprintf('finalMassRatio_%s.txt',run)),... |
| 295 | + [collapsemass eruptedmass massratio],'delimiter','\t'); |
287 | 296 |
|
288 | 297 |
|
289 | 298 | if strcmp(PULSE,'T') == 1 |
|
302 | 311 | hold on |
303 | 312 | plot(time,netMF_alts); |
304 | 313 | legend(axNetMF,massflux_legend) |
305 | | - title(axNetMF,sprintf('%s: Net solid mass flux through specified altitudes',str)) |
| 314 | + title(axNetMF,sprintf('Net solid mass flux\n%s',str)) |
306 | 315 | xlabel(axNetMF,'\bfTime (s)') |
307 | 316 | ylabel(axNetMF,'\bfNet mass flux (kg/m^2s)') |
308 | 317 | saveas(figNetMF,fullfile(savepath,sprintf('NetMassFlux_tseries_%s.jpg',run))) |
|
318 | 327 | hNMF = plot(avgNMF,1:JMAX-ghostcells,'-.','Color',[0 0.4 0.7],'LineWidth',3); |
319 | 328 | set(hNMF,'DisplayName','Time-averaged profile') |
320 | 329 | set(hMFZ,'DisplayName','Individual timestep profiles') |
321 | | - title(axAvgMFZ,sprintf('%s: Time-averaged mass flux with height',str)) |
| 330 | + title(axAvgMFZ,sprintf('Time-averaged solid mass flux\n%s',str)) |
322 | 331 | hMFZleg = legend(axAvgMFZ,[hNMF hMFZ hJet]); |
323 | 332 | set(hMFZleg,'FontSize',12,'Location','Northwest') |
324 | 333 | saveas(figAvgMFZ,fullfile(savepath,sprintf('TimeAvgNetMF_%s.jpg',run))); |
325 | 334 |
|
326 | | - avgNegMF = abs(min(avgNMF(avgNMF<0))); |
327 | | - if isempty(avgNegMF) |
328 | | - avgNegMF = 0; |
329 | | - end |
330 | | - avg_Ongaro = avgNegMF/MASSFLUX_SOL; |
331 | | - dlmwrite(fullfile(savepath,sprintf('avgOngaroCrit_%s.txt',run)),... |
332 | | - [avgNegMF MASSFLUX_SOL avg_Ongaro],'delimiter','\t'); |
| 335 | +% avgNegMF = abs(min(avgNMF(avgNMF<0))); |
| 336 | +% if isempty(avgNegMF) |
| 337 | +% avgNegMF = 0; |
| 338 | +% end |
| 339 | +% avg_Ongaro = avgNegMF/MASSFLUX_SOL; |
| 340 | +% dlmwrite(fullfile(savepath,sprintf('avgOngaroCrit_%s.txt',run)),... |
| 341 | +% [avgNegMF MASSFLUX_SOL avg_Ongaro],'delimiter','\t'); |
333 | 342 | % ===================================================================== % |
334 | 343 |
|
335 | 344 |
|
336 | | - % ---------------- COLLAPSE CRITERION TIME SERIES PLOT ---------------- % |
337 | | - figCollapse = figure('Name','Collapse criterion','units','centimeters',... |
338 | | - 'outerposition',[0 0 33.33 18.75],'visible',vis,'PaperPositionMode',... |
339 | | - 'auto','color','w'); |
340 | | - axCollapse = axes('Parent',figCollapse,'box','on','TickDir','in',... |
341 | | - 'FontSize',12); |
342 | | - grid(axCollapse,'on'); |
343 | | - axis(axCollapse,[0,time(end),0,1]); |
344 | | - hold on |
345 | | - plot(time,collapse_crit,'.-');%,time,0.9*ones(1,length(time)),'k--',time,... |
346 | | -% 0.65*ones(1,length(time)),'k-.',time,0.5*ones(1,length(time)),'k:'); |
347 | | - xlabel(axCollapse,'\bfTime (s)'); |
348 | | - ylabel(axCollapse,'\bfCollapse criterion ratio'); |
349 | | - title(axCollapse,sprintf('%s: Collapse criterion ratio...',str)); |
350 | | - legend('SUPERRATIO!','Near-total collapse','Partial collapse','Incipient collapse'); |
351 | | - saveas(figCollapse,fullfile(savepath,sprintf('CollapseCriterion_%s.jpg',run))); |
352 | | - % ===================================================================== % |
| 345 | +% % ---------------- COLLAPSE CRITERION TIME SERIES PLOT ---------------- % |
| 346 | +% figCollapse = figure('Name','Collapse criterion','units','centimeters',... |
| 347 | +% 'outerposition',[0 0 33.33 18.75],'visible',vis,'PaperPositionMode',... |
| 348 | +% 'auto','color','w'); |
| 349 | +% axCollapse = axes('Parent',figCollapse,'box','on','TickDir','in',... |
| 350 | +% 'FontSize',12); |
| 351 | +% grid(axCollapse,'on'); |
| 352 | +% xlim(axCollapse,[0,time(end)]); |
| 353 | +% hold on |
| 354 | +% plot(time,collapse_crit,'LineWidth',2);%,time,0.9*ones(1,length(time)),'k--',time,... |
| 355 | +% % 0.65*ones(1,length(time)),'k-.',time,0.5*ones(1,length(time)),'k:'); |
| 356 | +% xlabel(axCollapse,'\bfTime (s)'); |
| 357 | +% ylabel(axCollapse,'\bfSolid mass flux ratio'); |
| 358 | +% title(axCollapse,sprintf('Collapse criterion\n%s',str)); |
| 359 | +% saveas(figCollapse,fullfile(savepath,sprintf('CollapseCriterion_%s.jpg',run))); |
| 360 | +% % ===================================================================== % |
353 | 361 |
|
354 | 362 |
|
355 | 363 | cd(postpath) |
|
0 commit comments