NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/matlab_cen/courant_adv.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 %
2 % Load data from files
3 %
4    iter1=2880;
5    iter2=8640;
6    itperhr=60;
7    for iter=iter1:itperhr:iter2
8    filename=['vbar_iter_',num2str(iter),'.v2r']
9 %   filename=input('Enter the name of .v2r file: ','s')
10    [v2r,freq,gridname]=read_v2r(filename);
11    u=v2r(:,2);
12    v=v2r(:,3);
13    if iter == iter1
14       spd=sqrt(u.*u+v.*v);
15    else
16       spd=max(spd,sqrt(u.*u+v.*v));
17    end
18    end
19 %
20 % Calculate nodal and elemental areas and deltax's
21 %
22    gridname=blank(gridname(1:length(gridname)-1));
23    [in,x,y,z,bnd]=loadgrid(gridname);
24    area
25 %
26 % Calculate minimum time-step required to ensure courant number <=.1
27 %
28    deltcour=0.1.*dxnod./spd;
29    deltmin=min(deltcour)
30 %
31 % Make plots
32 %
33    tallfigure
34    whitebg('w')
35    hel=drawelems(in,x,y)
36    set(hel,'color','k')
37    hold on
38    axis('tight')
39    [smina,smaxa,ibw]=colorband_fe(in,x,y,bnd,spd,0.1,1.0,0.1)
40    title(['maximum speed (m/s)'])
41 %
42    tallfigure
43    whitebg('w')
44    hel=drawelems(in,x,y)
45    set(hel,'color','k')
46    hold on
47    axis('tight')
48    [smina,smaxa,ibw]=colorband_fe(in,x,y,bnd,dxnod,5000.0,40000.0,5000.0)
49    title([gridname,': node based deltax (m)'])
50 %
51    tallfigure
52    whitebg('w')
53    hel=drawelems(in,x,y)
54    set(hel,'color','k')
55    hold on
56    axis('tight')
57    [smina,smaxa,ibw]=colorband_fe(in,x,y,bnd,deltcour,600.0,2000.0,100.0)
58    title(['time-step to ensure cour#<0.1: ',num2str(deltmin),' sec'])
59 %
60 % Make plots
61 %
62    tallfigure
63    whitebg('w')
64    subplot(2,2,1)
65    hel=drawelems(in,x,y)
66    set(hel,'color','k')
67    hold on
68    axis('tight')
69    title(gridname)
70    subplot(2,2,2)
71    [smina,smaxa,ibw]=colorband_fe(in,x,y,bnd,spd,0.1,1.0,0.1)
72    hold on
73    axis('tight')
74    title(['maximum speed (m/s)'])
75    subplot(2,2,3)
76    [smina,smaxa,ibw]=colorband_fe(in,x,y,bnd,dxnod,5000.0,40000.0,5000.0)
77    hold on
78    axis('tight')
79    title([gridname,': node based deltax (m)'])
80    subplot(2,2,4)
81    [smina,smaxa,ibw]=colorband_fe(in,x,y,bnd,deltcour,600.0,2000.0,100.0)
82    hold on
83    axis('tight')
84    title(['time-step to ensure cour#<0.1: ',num2str(deltmin),' sec'])
85    newplot=input('New plot? (y/n): ','s');
86 end
Note: See TracBrowser for help on using the browser.