Skip to content

Commit 3b3ccb0

Browse files
author
Taryn Black
committed
Merge pull request #13 from tarynblack/PostUpdates_Joe
Post updates joe
2 parents 50a04fd + 1e3378d commit 3b3ccb0

File tree

12 files changed

+437
-330
lines changed

12 files changed

+437
-330
lines changed

calc_inletFlow.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function [ XG,vel_char,MFR,MASSFLUX,MFR_SOL,MASSFLUX_SOL,jetheight ] = ...
1+
function [ XG,vel_char,MFR,MASSFLUX,MFR_SOL,MASSFLUX_SOL,jetheight,avgEPG ] = ...
22
calc_inletFlow( charEPG,MING,MAXG,PULSE,BC_EPG,BC_PG,BC_TG,Rgas,...
33
RO_S1,RO_S2,RO_S3,NFR_S1,NFR_S2,NFR_S3,BC_TS1,BC_TS2,BC_TS3,VENT_R,g )
44
%calc_inletFlow calculates the gas mass fraction, choked velocity, and mass
@@ -23,12 +23,15 @@
2323
%
2424
% Last edit: Taryn Black, 6 April 2016
2525

26+
beta = asin((MAXG-MING)/(MING*(1-MING)));
27+
avgEPG = 1 + ((2/pi)*(1-MING)*(MING - (MING*cos(beta)) - beta));
28+
2629
if strcmp(charEPG,'mingas') == 1
2730
EPGunst = MING;
2831
elseif strcmp(charEPG,'maxgas') == 1
2932
EPGunst = MAXG;
3033
elseif strcmp(charEPG,'avggas') == 1
31-
EPGunst = (2*MING*(1-MING)/pi)+MING;
34+
EPGunst = avgEPG;
3235
end
3336

3437
if strcmp(PULSE,'T') == 1

entrainment3D.m

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
function [ vidEntr ] = entrainment3D( run,runpath,vis,ghostcells,IMAX,JMAX,...
2-
KMAX,tickx,labelx,labelXunit,ticky,labely,labelYunit,tickz,labelz,...
3-
labelZunit,plumeedge,XRES,YRES,ZRES,postpath,PULSE,FREQ,time,...
4-
vel_char,jetheight,entrainment_crange,viewaz,viewel,imtype,titlerun,...
5-
timesteps,isoEPG,colEPG,trnEPG,DT,VENT_R,savepath,...
1+
function [ STavg_entr,STavg_jentr ] = entrainment3D( run,runpath,...
2+
vis,ghostcells,IMAX,JMAX,KMAX,tickx,labelx,labelXunit,ticky,labely,...
3+
labelYunit,tickz,labelz,labelZunit,plumeedge,XRES,YRES,ZRES,postpath,...
4+
PULSE,FREQ,time,vel_char,jetheight,entrainment_crange,viewaz,viewel,...
5+
imtype,titlerun,timesteps,isoEPG,colEPG,trnEPG,DT,VENT_R,savepath,...
66
readEPG,fnameEPG,readUG,fnameUG,readVG,fnameVG,readWG,fnameWG )
77
%entrainment3D Summary of this function goes here
88
% entrainment3D ---does things---
99
%
1010
% Functions called: loadTimestep3D; pulsetitle
11-
% Last edit: Taryn Black, 15 April 2016
11+
% Last edit: Taryn Black, 19 April 2016
1212

1313
% Clear directory of appending files from previous processing attempts
1414
cd(savepath)
@@ -199,6 +199,7 @@
199199
lighting gouraud;
200200
tLEP = pulsetitle(varEP,PULSE,time,t,titlerun,FREQ);
201201
title(tLEP,'FontWeight','bold');
202+
set(figEP,'Visible',vis);
202203
% ================================================================= %
203204

204205

@@ -349,6 +350,7 @@
349350
camlight('right');
350351
camlight('left');
351352
lighting gouraud;
353+
set(figEn,'Visible',vis);
352354
% ================================================================= %
353355

354356

@@ -422,6 +424,10 @@
422424
close(vidEPG);
423425
% % close(vidQ);
424426
close(vidEntr);
427+
428+
% Calculate spatio-temporally averaged entrainment for plume and jet
429+
STavg_entr = mean(avg_entr(2:end));
430+
STavg_jentr = mean(avg_jentr(2:end));
425431

426432

427433
% ------------------- ENTRAINMENT TIME SERIES PLOTS ------------------- %
@@ -477,7 +483,7 @@
477483
'DisplayName','Combined');
478484
tlCoeff1 = 'EEE averaged over full plume surface';
479485
tlCoeff2 = sprintf('%s',str);
480-
tlCoeff3 = sprintf('Spatiotemporally averaged entrainment = %.4f',mean(avg_entr(2:end)));
486+
tlCoeff3 = sprintf('Spatiotemporally averaged entrainment = %.4f',STavg_entr);
481487
title(axCoeff,{tlCoeff1;tlCoeff2;tlCoeff3},'FontWeight','bold')
482488
xlabel(axCoeff,'\bfTime (s)')
483489
ylabel(axCoeff,'\bfEEE')
@@ -520,7 +526,7 @@
520526
'DisplayName','Combined');
521527
tlJCoeff1 = 'EEE averaged over jet region';
522528
tlJCoeff2 = sprintf('%s',str);
523-
tlJCoeff3 = sprintf('Spatiotemporally averaged entrainment = %.4f',mean(avg_jentr(2:end)));
529+
tlJCoeff3 = sprintf('Spatiotemporally averaged entrainment = %.4f',STavg_jentr);
524530
title(axJCoeff,{tlJCoeff1;tlJCoeff2;tlJCoeff3},'FontWeight','bold')
525531
xlabel(axJCoeff,'\bfTime (s)')
526532
ylabel(axJCoeff,'\bfEEE')

evolveVolumeFraction.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
cd(postpath)
4848
tVFE = pulsetitle(varVFE,PULSE,time,t,titlerun,FREQ);
4949
title(axVolFrac(1),tVFE,'FontWeight','bold');
50+
set(figVolFrac,'Visible',vis);
5051

5152
% Save current timestep
5253
cd(savepath)

flowDensity3D.m

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,10 @@
179179
caxis(axDens,flowDensity_crange);
180180
tLD = pulsetitle(varD,PULSE,time,t,titlerun,FREQ);
181181
title(tLD,'FontSize',12,'FontWeight','bold');
182-
% ================================================================= %
183-
184-
185-
% --------------------- OVERLAY PLUME OUTLINE --------------------- %
186-
figure(figDens)
187182
hEPD = contourslice(EPG,sdistX*(IMAX-ghostcells),...
188183
sdistY*(KMAX-ghostcells),0,[plumeedge plumeedge]);
189184
set(hEPD,'EdgeColor',[1 1 1],'LineWidth',0.5);
185+
set(figDens,'Visible',vis);
190186
% ================================================================= %
191187

192188

@@ -215,8 +211,9 @@
215211
flowreldens = avgatmsdens_3D_inplume - flowdensity;
216212

217213
% Calculate average relative density of flow at jet height
214+
inplumeJH = inplume(:,:,round(jetheight));
218215
reldensJH = flowreldens(:,:,round(jetheight));
219-
avgRDJH(t) = mean(reldensJH(:));
216+
avgRDJH(t) = mean(reldensJH(inplumeJH));
220217
dlmwrite(fullfile(savepath,sprintf('avgRelDens_JetHeight_%s.txt',...
221218
run)),[time(t) avgRDJH(t)],'-append','delimiter','\t');
222219
% ================================================================= %
@@ -234,14 +231,10 @@
234231
caxis(axRelD,flowBuoyancy_crange);
235232
tLB = pulsetitle(varB,PULSE,time,t,titlerun,FREQ);
236233
title(tLB,'FontSize',12,'FontWeight','bold');
237-
% ================================================================= %
238-
239-
240-
% --------------------- OVERLAY PLUME OUTLINE --------------------- %
241-
figure(figRelD)
242234
hEPB = contourslice(EPG,sdistX*(IMAX-ghostcells),...
243235
sdistY*(KMAX-ghostcells),0,[plumeedge plumeedge]);
244236
set(hEPB,'EdgeColor',[0 0 0],'LineWidth',0.5);
237+
set(figRelD,'Visible',vis);
245238
% ================================================================= %
246239

247240

@@ -313,6 +306,7 @@
313306
negRDJH = NaN(length(allRDJH),1);
314307
negRDJH(negidx) = allRDJH(negidx);
315308
hRDJH = plot(time(2:end),allRDJH,'r',time(2:end),negRDJH,'b','LineWidth',2);
309+
xlim([0 time(end)]);
316310
ylim(flowBuoyancy_crange)
317311
xlabel('\bfTime (s)')
318312
ylabel('\bf\rho_{atmosphere} - \rho_{mixture} (kg/m^3)')

gasTemperature3D.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
tL = pulsetitle(varTG,PULSE,time,t,titlerun,FREQ);
141141
title(tL,'FontSize',12,'FontWeight','bold');
142142
hold on
143+
set(figTemp,'Visible',vis);
143144
% ================================================================= %
144145

145146

massFlux3D.m

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function [ vidMFlux ] = massFlux3D( runpath,vis,viewaz,viewel,ghostcells,...
1+
function [ massratio ] = massFlux3D( runpath,vis,viewaz,viewel,ghostcells,...
22
IMAX,JMAX,KMAX,tickx,ticky,tickz,XRES,YRES,ZRES,labelx,labely,labelz,...
33
labelXunit,labelYunit,labelZunit,run,timesteps,postpath,massflux_alts,...
44
RO_S1,RO_S2,RO_S3,plumeedge,massflux_crange,PULSE,FREQ,time,...
@@ -10,7 +10,7 @@
1010
% Detailed explanation goes here
1111
%
1212
% Functions called: loadTimestep3D; pulsetitle
13-
% Last edit: Taryn Black, 15 April 2016
13+
% Last edit: Taryn Black, 19 April 2016
1414

1515
% Clear directory of appending files from previous processing attempts
1616
cd(savepath)
@@ -45,7 +45,7 @@
4545
% Subtightplot properties
4646
gap = [0.01 0.01];
4747
ht = 0.15;
48-
wd = 0.15;
48+
wd = 0.10;
4949

5050

5151
% ----------------------- FIGURE INITIALIZATION ----------------------- %
@@ -56,7 +56,7 @@
5656

5757
% Mass flux slice: figure and axes properties
5858
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',...
6060
'auto','color','w');
6161
cd(postpath)
6262
axMFlux1 = subtightplot(1,2,1,gap,ht,wd);
@@ -134,7 +134,7 @@
134134

135135
% Preallocate vectors
136136
netMF_alts = zeros(length(massflux_alts),timesteps);
137-
collapse_crit = zeros(1,timesteps);
137+
% collapse_crit = zeros(1,timesteps);
138138

139139

140140
% =================== B E G I N T I M E L O O P =================== %
@@ -192,18 +192,16 @@
192192
logMF(logMF>0) = log10(logMF(logMF>0));
193193
logMF(logMF<0) = -log10(abs(logMF(logMF<0)));
194194

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');
207205

208206

209207
% --------------------- MASS FLUX SLICE FIGURE -------------------- %
@@ -227,13 +225,13 @@
227225
[plumeedge plumeedge]);
228226
set(hEPZ2,'EdgeColor',[1 1 1],'LineWidth',0.5);
229227
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');
233230
PosMF1 = get(axMFlux1,'position');
234231
PosMF2 = get(axMFlux2,'position');
235232
PosMF2(3:4) = PosMF1(3:4);
236233
set(axMFlux2,'position',PosMF2);
234+
set(figMFlux,'Visible',vis);
237235
% ================================================================= %
238236

239237

@@ -244,6 +242,7 @@
244242
hMFZ = plot(netmassflux,1:JMAX-ghostcells,'k','LineWidth',2);
245243
tMFZ = pulsetitle(varMFZ,PULSE,time,t,titlerun,FREQ);
246244
title(axAvgMFZ,tMFZ,'FontWeight','bold');
245+
set(figAvgMFZ,'Visible',vis);
247246
% ================================================================= %
248247

249248

@@ -284,6 +283,16 @@
284283
% End video write and finish video files
285284
cd(savepath)
286285
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');
287296

288297

289298
if strcmp(PULSE,'T') == 1
@@ -302,7 +311,7 @@
302311
hold on
303312
plot(time,netMF_alts);
304313
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))
306315
xlabel(axNetMF,'\bfTime (s)')
307316
ylabel(axNetMF,'\bfNet mass flux (kg/m^2s)')
308317
saveas(figNetMF,fullfile(savepath,sprintf('NetMassFlux_tseries_%s.jpg',run)))
@@ -318,38 +327,37 @@
318327
hNMF = plot(avgNMF,1:JMAX-ghostcells,'-.','Color',[0 0.4 0.7],'LineWidth',3);
319328
set(hNMF,'DisplayName','Time-averaged profile')
320329
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))
322331
hMFZleg = legend(axAvgMFZ,[hNMF hMFZ hJet]);
323332
set(hMFZleg,'FontSize',12,'Location','Northwest')
324333
saveas(figAvgMFZ,fullfile(savepath,sprintf('TimeAvgNetMF_%s.jpg',run)));
325334

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');
333342
% ===================================================================== %
334343

335344

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+
% % ===================================================================== %
353361

354362

355363
cd(postpath)

0 commit comments

Comments
 (0)