-
Notifications
You must be signed in to change notification settings - Fork 0
/
TimcompHoldyy2.m
executable file
·432 lines (315 loc) · 9.28 KB
/
TimcompHoldyy2.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
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
%plots multiple line graphs with dual axis option
clear cdan AX exax;
timdiv=1; %factor for changing time to minutes=60 or hours=3600 seconds=1
cdan(1).c=[1 0 0]; %red
cdan(2).c=[0 0.5 0.1]; %dark green
cdan(4).c=[0 0 1]; %blue
cdan(5).c=[0.5 0.5 0.5]; %grey
cdan(3).c=[0 0 0];
cdan(6).c=[0.7 0.8 0]; %yellowish
size(cdan);
scdan=ans(2);
pdan(1).p='-';
pdan(2).p=':';
titsbaurufull;
tit(1).tit='Droplet conc. = 60 /cm^3';
tit(2).tit='Droplet conc. = 360 /cm^3';
tit(3).tit='Droplet conc. = 960 /cm^3';
clear conm llab;
nplots=input('Enter number of plots :');
group=10; %switch for showing different sets of results
dualax=1; %switch =1 to use dual axis graphs
expo=0; %switch to export file as jpeg
exdir='bauru\homogen\processrates\ISGmrsJust3-2'; %filepath to export to
fontnam='times-roman';
lorr(1)=1; %switches for left or right axis 0=left 1=right - put 1st right hand axis line in lorr(1)
lorr(2)=0;
lorr(3)=0;
lorr(4)=0;
lorr(5)=0;
lorr(6)=0;
laxlab='Total Process Rate (kg/m^2/s)';
raxlab='Total Mixing Ratio (kg/m^2)';
if expo==1
fsize=10; %fontsize - choose 7 if you want to read it, 3 if exporting to file
else
fsize=10;
end
if group==10
conm(1).c=88;
conm(2).c=90;
conm(3).c=89;
conm(4).c=91;
%conm(5).c=92;
%conm(6).c=91;
%conm(7).c=93;
%llab(1).l='Ice No conc' %44
llab(2).l='Ice Deposition'; %90
llab(3).l='Primary Nucleation '; %89
llab(1).l='Hallet Mossop'; %88
%llab(4).l='Contact Nucleation'; %92
llab(4).l='Ice Accreting Water'; %91
%llab(5).l='Freezing'; %93
%lorr(1)=1;
%laxlab='';
%raxlab='Max No. Conc. (/kg)';
dualax=1;
end
if group==9
conm(1).c=44;
conm(2).c=45;
conm(3).c=46;
llab(1).l='Max No. Conc. of Ice (/kg)';
llab(2).l='Max No. Conc. of Graupel (/kg)';
llab(3).l='Max No. Conc. of Snow (/kg)';
laxlab='Max No. Conc. (/kg)';
raxlab='Max No. Conc. (/kg)';
end
if group==8
conm(1).c=69;
conm(2).c=79;
llab(1).l='IACR-G';
llab(2).l='PGFR';
end
if group==7
conm(1).c=23;
conm(2).c=6;
llab(1).l='Rain';
llab(2).l='W flux';
elseif group==6
%showing total sink of liq
conm(1).c=21;
conm(2).c=[91 72 77 64 68 60 90];
llab(1).l='Liq';
llab(2).l='Sinks of liq.';
elseif group==1
%showing depletion of liquid water - depletion for low CCN due to rain acc. water & from ISG acc. water for high CCN - more water left for high CCN
conm(1).c=21;
conm(2).c=[91 72 77];
conm(3).c=64;
%conm(4).c=[68 60 90];
conm(4).c=62;
%conm(6).c=108;
llab(1).l='Liq. W.';
llab(2).l='I+S+G Acc. W.';
llab(3).l='R Acc. W.';
%llab(4).l='I+S+G Dep.';
llab(4).l='Auto-con';
%llab(6).l='dQcond/dt';
elseif group==2
%showing different types of graupel formation - from rain for low CCN & from water and snow for high
conm(1).c=21;
conm(2).c=[73 78]; %does sum of cols 73 & 78
conm(3).c=69;
conm(4).c=72;
llab(1).l='Liq W';
llab(2).l='G Auto+G Acc S';
llab(3).l='I Acc.R-G';
llab(4).l='G Acc.W';
elseif group==3
%showing different rain production modes - from auto and acc. low CCN and from graupel high CCN
conm(1).c=23;
conm(2).c=[61 65 66];
conm(3).c=62;
%conm(5).c=63;
conm(4).c=64;
llab(1).l='Total Rain MR';
llab(2).l='Melting I+S+G';
llab(3).l='Auto-con';
%llab(5).l='G Shedding';
llab(4).l='R Acc. W';
elseif group==4
%showing amounts of ice, snow and graupel
laxlab='Tot.MR(snow&graupel) (kg/m^2)';
raxlab='Tot.MR (ice) (kg/m^2)';
conm(1).c=22;
conm(2).c=24;
conm(3).c=25;
llab(1).l='Ice';
llab(2).l='Snow';
llab(3).l='Graupel';
elseif group==5
%showing different rain production modes - from auto and acc. low CCN and from graupel high CCN
raxlab='Total Mixing Ratio (kg/m^2)';
conm(1).c=23;
conm(2).c=62;
conm(3).c=63;
conm(4).c=85
llab(1).l='Rain';
llab(2).l='Auto-con';
llab(3).l='G Shedding';
llab(4).l='Rain Evp.';
end
scrsz=get(0,'ScreenSize');
posit=[9 50 scrsz(3)/1.01 scrsz(4)/1.2];
hfig=figure('name','Combination plot','position',posit,'name',strcat('Combination Plot of group:',int2str(group)));
size(conm);
sconm=ans(2);
pnames;
%nplots=12;
%con=input('Enter col no.: ');
%fact=input('Please enter scale factor: ');
scrsz=get(0,'ScreenSize');
clear minsx maxsx minsy maxsy H1;
maxovall=0;
maxovallR=0; %for right hand axis
clear pser;
for i=1:nplots
size(conm);
sicm=ans(2);
maxxx(i)=max(SerDan(i).SER(:,1));
for mc=1:sicm
size(conm(mc).c);
sisum=ans(2);
for isum=1:sisum %do sum for lines with e.g. [62 63 64]
if isum==1
pser(i).ser(:,mc)=SerDan(i).SER(:,conm(mc).c(isum));
else
pser(i).ser(:,mc)=pser(i).ser(:,mc)+SerDan(i).SER(:,conm(mc).c(isum));
end
end
if lorr(mc)==0
if max(pser(i).ser(:,mc))>maxovall
maxovall=max(pser(i).ser(:,mc));
end
else
if max(pser(i).ser(:,mc))>maxovallR
maxovallR=max(pser(i).ser(:,mc)); %max for right hand axis
end
end
end
end;
maxy=maxovall*1.1;
maxyR=maxovallR*1.1;
maxx=max(maxxx)/timdiv;
exist posit;
a=ans;
if a==0;
posit=[1 scrsz(4)/2 scrsz(3)/2 scrsz(4)/2.2];
end;
jmax=12;
for k=1:1
%cons=int2str(con);
%figure('name',strcat('Column:',cons,' v.time'),'Position',posit);
for j=(k-1)*jmax+1:min(jmax,nplots);
plotnum=rem(j,jmax);
if plotnum==0;
plotnum=jmax;
end
if nplots==1
a=1;
else
a=2;
end
b=ceil(min(nplots,jmax)/2);
a=3;
b=1;
%hold on;
subplot(a,b,plotnum);
hold on;
hs(j).h=newplot;
times=SerDan(j).SER(:,1)./timdiv;
cdanc=0;
pdanc=1;
if dualax==1
[AX H1(2).h H1(1).h]=plotyy(times,pser(j).ser(:,2),times,pser(j).ser(:,1));
cmstart=3;
else
cmstart=1;
end
for mc=cmstart:sicm
cdanc=cdanc+1;
pdanc=pdanc+1;
if cdanc==scdan+1;
cdanc=1;
end
if pdanc==3
pdanc=1;
end
size(SerDan(j).SER(:,1));
stim=ans(1);
size(pser(j).ser(:,mc));
spser=ans(1);
if lorr(mc)==0 %if is to be normally plotted on left
H1(mc).h = plot(times,pser(j).ser(1:min(stim,spser),mc));
else
axes(AX(2)); %if is to be plotted on right
hold on;
H1(mc).h = plot(times,pser(j).ser(1:min(stim,spser),mc));
axes(AX(1)); %reset back to left as AX may not exist for lorr=0
hold on;
end
set(H1(mc).h,'LineStyle',pdan(pdanc).p);
set(H1(mc).h,'color',cdan(cdanc).c);
set(H1(1).h,'linewidth',1.7);
if dualax==1
set(H1(2).h,'linewidth',1.7);
set(H1(3).h,'linewidth',1.7);
end
end
if j==12 %add legend only on last plot
end
lh=legend([H1.h],llab.l,2);
set(lh,'Fontsize',8);
set(lh,'fontname',fontnam);
exist AX;
if ans==1
exax=1;
set(AX,'xlim',[0 maxx]);
set(AX(1),'ylim',[0 maxy]);
set(get(AX(1),'Ylabel'),'String',laxlab,'fontsize',fsize,'fontname',fontnam);
%if max(lorr==1)
set(get(AX(2),'Ylabel'),'String',raxlab,'fontsize',fsize,'fontname',fontnam);
%end
set(AX,'Fontsize',fsize);
set(AX,'fontname',fontnam);
if j==11 | j==12
end
ex=floor(log10(maxy)); %exponent
nu=maxy/10^ex; %number
if nu<=2
spa=0.5*10^ex;
elseif nu<=5
spa=1*10^ex;
else
spa=2*10^ex;
end
%set tick marks cuz Matlab makes them go weird!?
yts=[0 spa spa*2 spa*3 spa*4];
set(AX(1),'ytick',yts);
%maxyR=8e5;
%if max(lorr)==1
set(AX(2),'ylim',[0 maxyR]);
ex=floor(log10(maxyR)); %exponent
nu=maxyR/10^ex; %number
if nu<=2
spa2=0.5*10^ex;
elseif nu<=5
spa2=1*10^ex;
else
spa2=2*10^ex;
end
yts2=[0 spa2 spa2*2 spa2*3 spa2*4];
set(AX(2),'ytick',yts2);
%end
else
set(hs(j).h,'xlim',[0 maxx]);
set(hs(j).h,'ylim',[0 maxy]);
set(hs(j).h,'fontsize',fsize);
set(hs(j).h,'fontname',fontnam);
exax=0;
end
%axis([minx maxx miny maxy]);
if j==nplots
xlabel('Time (mins)','Fontsize',fsize+1,'fontname',fontnam);
end
%xlabel('Time (s)','Fontsize',fsize+1,'fontname',fontnam,'position',[maxx/1.1 -maxy/5]);
title(tit(j).tit,'Fontsize',fsize+1,'fontname',fontnam);
end
end
if expo==1
exname=strcat('c:\matlabR12\work\',exdir);
set(hfig,'paperpositionmode','auto');
print(hfig,'-djpeg','-r150',exname);
close(hfig);
end