/[MITgcm]/MITgcm_contrib/high_res_cube/eddy_flux/run_calcUVB2_ttcp.m
ViewVC logotype

Contents of /MITgcm_contrib/high_res_cube/eddy_flux/run_calcUVB2_ttcp.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Sat Oct 2 21:03:14 2004 UTC (20 years, 9 months ago) by edhill
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +200 -14 lines
 o add script and testing for [uvstb]^2 and uv diagnostics

1 %
2 % Ed Hill
3 % Mon Aug 2 23:43:41 EDT 2004
4 %
5
6 matlab -nojvm -nodisplay
7
8 clear all ; close all
9
10 % Get the 1-yr list of days
11 load ilist
12 deltatT = 1200; % model time step size (s)
13 tavefreq = 259200; % averaging period (s)
14 startDate = datenum(1992,1,1); % model integration starting date
15 for iy = 1992:2004
16 fid = fopen(sprintf('ilist_%d.txt',iy),'w');
17 for it = 1:length(ilist)
18 iter = ilist(it);
19 dv = datevec(startDate + (iter*deltatT-tavefreq/2)/60/60/24);
20 newyear = dv(1);
21 if newyear == iy
22 a = sprintf('%10.10d %d',iter,dv(1));
23 fprintf(fid,'%s\n',a);
24 end
25 end
26 fclose(fid);
27 end
28
29
30 clear all ; close all
31 nlay = 50;
32 ne = 510;
33
34 Spat = 'Stave/data/Stave.%10.10d.data';
35 Tpat = 'Ttave/data/Ttave.%10.10d.data';
36 Upat = '_Veltave/data/uVeltave.%10.10d.data';
37 Vpat = '_Veltave/data/vVeltave.%10.10d.data';
38
39 load ilist
40
41 calcUVBave(Spat, Tpat, Upat, Vpat, ilist, nlay, ne)
42
43
44
45 #======= split into 4 nodes (3 each) =======
46 cat ilist_199[2-4].txt | awk '{print $1}' > ilist_92--94
47 cat ilist_199[5-7].txt | awk '{print $1}' > ilist_95--97
48 cat ilist_199[89].txt ilist_2000.txt | awk '{print $1}' > ilist_98--00
49 cat ilist_200[1-3].txt | awk '{print $1}' > ilist_01--03
50 wc -l ilist_??--??
51 scp ilist_??--?? ta54:
52
53 #======= split into 6 nodes (2 each) =======
54 cat ilist_1992.txt ilist_1993.txt | awk '{print $1}' > ilist_40
55 cat ilist_1994.txt ilist_1995.txt | awk '{print $1}' > ilist_41
56 cat ilist_1996.txt ilist_1997.txt | awk '{print $1}' > ilist_42
57 cat ilist_1998.txt ilist_1999.txt | awk '{print $1}' > ilist_43
58 cat ilist_2000.txt ilist_2001.txt | awk '{print $1}' > ilist_44
59 cat ilist_2002.txt ilist_2003.txt | awk '{print $1}' > ilist_45
60 wc -l ilist_4[0-5]
61 scp ilist_4[0-5] ta54:
62
63
64 % /scratch/edhill/matlab_r13/bin/matlab -nojvm -nodisplay
65 matlab -nojvm -nodisplay
66 clear all ; close all
67 nlay = 50;
68 ne = 510;
69
70 Spat = 'c5l/Stave/data/Stave.%10.10d.data';
71 Tpat = 'c5l/Ttave/data/Ttave.%10.10d.data';
72 Upat = 'c5l/_Veltave/data/uVeltave.%10.10d.data';
73 Vpat = 'c5l/_Veltave/data/vVeltave.%10.10d.data';
74 load ilist
75
76 !/sbin/ifconfig eth0 | grep 'inet addr:' | sed -e 's|\.| |g' | awk '{print $5}' > myip
77 load myip
78 ips = [ myip 201 200 200 200 ]
79
80 calcUVBave_ttcp(ips, Spat, Tpat, Upat, Vpat, ilist, nlay, ne)
81
82
83
84 % Testing only
85 matlab -nojvm
86 clear all ; close all
87
88 ufid = fopen('uVeltave.0000000432.data', 'r', 'ieee-be');
89 vfid = fopen('vVeltave.0000000432.data', 'r', 'ieee-be');
90
91 ne = 510;
92 nps = 6 * ne*ne;
93 tx = 85;
94 ty = 85;
95 nt = ne*ne*6/(tx*ty);
96 ucube = unmangleJPL1( ...
97 reshape(fread(ufid, nps, 'real*4'),tx*nt,ty), ne, tx );
98 vcube = unmangleJPL1( ...
99 reshape(fread(vfid, nps, 'real*4'),tx*nt,ty), ne, tx );
100
101 % Fill the (ne+1)*(ne+1) grid with T,S,B values
102 ni = ne; nip1 = ni + 1;
103 nj = ne; njp1 = nj + 1;
104 ucubep1 = zeros( [ nip1 njp1 6 ] );
105 vcubep1 = zeros( [ nip1 njp1 6 ] );
106 for icf = 1:6
107 ucubep1(2:nip1,2:njp1,icf) = ucube(:,:,icf);
108 vcubep1(2:nip1,2:njp1,icf) = vcube(:,:,icf);
109 end
110
111 % Do the upwind-edge U,V exchanges
112 ucubep1(1,2:njp1,1) = vcube(ni:-1:1,nj,5); % -
113 surf(ucubep1(1:10,:,1)), shading interp, view(2)
114
115 ucubep1(2:nip1,1,1) = ucube(1:ni,nj,6); % -
116 surf(ucubep1(:,1:10,1)), shading interp, view(2)
117
118 ucubep1(1,2:njp1,2) = ucube(ni,1:nj,1); % -
119 surf(ucubep1(1:10,:,2)), shading interp, view(2)
120
121 ucubep1(2:nip1,1,2) = -vcube(ni,nj:-1:1,6); % -
122 surf(ucubep1(:,1:10,2)), shading interp, view(2)
123
124 ucubep1(1,2:njp1,3) = ucube(ni:-1:1,nj,1); % -
125 surf(ucubep1(1:10,:,3)), shading interp, view(2)
126
127 ucubep1(2:nip1,1,3) = ones(size( ucube(1:ni,nj,2) ));
128 ucubep1(2:nip1,1,3) = ucube(1:ni,nj,2); % - ?????? +++
129 surf(ucubep1(:,1:5,3)), shading interp, view(2)
130
131 ucubep1(1,2:njp1,4) = ucube(ni,1:nj,3); % -
132 surf(ucubep1(1:10,:,4)), shading interp, view(2)
133
134 ucubep1(2:nip1,1,4) = -vcube(ni,nj:-1:1,2); % -
135 surf(ucubep1(:,1:10,4)), shading interp, view(2)
136
137 ucubep1(1,2:njp1,5) = vcube(ni:-1:1,nj,3); % -
138 surf(ucubep1(1:10,:,5)), shading interp, view(2)
139
140 ucubep1(2:nip1,1,5) = ucube(1:ni,nj,4); % -
141 surf(ucubep1(:,1:10,5)), shading interp, view(2)
142
143 ucubep1(1,2:njp1,6) = ucube(ni,1:nj,5); % -
144 surf(ucubep1(1:10,:,6)), shading interp, view(2)
145
146 ucubep1(2:nip1,1,6) = -vcube(ni,nj:-1:1,4); % -
147 surf(ucubep1(:,1:10,6)), shading interp, view(2)
148
149
150 vcubep1(1,2:njp1,1) = -ucube(ni:-1:1,nj,5); % -
151 surf(vcubep1(1:10,:,1)), shading interp, view(2)
152
153 vcubep1(2:nip1,1,1) = vcube(1:ni,nj,6); % -
154 surf(vcubep1(:,1:10,1)), shading interp, view(2)
155
156 vcubep1(1,2:njp1,2) = vcube(ni,1:nj,1); % -
157 surf(vcubep1(1:10,:,2)), shading interp, view(2)
158
159 vcubep1(2:nip1,1,2) = ucube(ni,nj:-1:1,6); % -
160 surf(vcubep1(:,1:10,2)), shading interp, view(2)
161
162 vcubep1(1,2:njp1,3) = -ucube(ni:-1:1,nj,1); % - ?????? +++
163 surf(vcubep1(1:4,:,3)), shading interp, view(2)
164
165 vcubep1(2:nip1,1,3) = vcube(1:ni,nj,2); % - ?????? +++
166 surf(vcubep1(:,1:5,3)), shading interp, view(2)
167
168 vcubep1(1,2:njp1,4) = vcube(ni,1:nj,3); % -
169 surf(vcubep1(1:10,:,4)), shading interp, view(2)
170
171 vcubep1(2:nip1,1,4) = ucube(ni,nj:-1:1,2); % -
172 surf(vcubep1(:,1:10,4)), shading interp, view(2)
173
174 vcubep1(1,2:njp1,5) = -ucube(ni:-1:1,nj,3); % -
175 surf(vcubep1(1:10,:,5)), shading interp, view(2)
176
177 vcubep1(2:nip1,1,5) = vcube(1:ni,nj,4); % -
178 surf(vcubep1(:,1:10,5)), shading interp, view(2)
179
180 vcubep1(1,2:njp1,6) = vcube(ni,1:nj,5); % -
181 surf(vcubep1(1:10,:,6)), shading interp, view(2)
182
183 vcubep1(2:nip1,1,6) = ucube(ni,nj:-1:1,4); % -
184 surf(vcubep1(:,1:10,6)), shading interp, view(2)
185
186 % Do the "n+1" U exchanges
187 ucubep1(1,2:njp1,1) = vcube(ni:-1:1,nj,5); % -
188 ucubep1(2:nip1,1,1) = ucube(1:ni,nj,6); % -
189 ucubep1(1,2:njp1,2) = ucube(ni,1:nj,1); % -
190 ucubep1(2:nip1,1,2) = -vcube(ni,nj:-1:1,6); % -
191 ucubep1(1,2:njp1,3) = ucube(ni:-1:1,nj,1); % -
192 ucubep1(2:nip1,1,3) = ucube(1:ni,nj,2); % - ?????? +++
193 ucubep1(1,2:njp1,4) = ucube(ni,1:nj,3); % -
194 ucubep1(2:nip1,1,4) = -vcube(ni,nj:-1:1,2); % -
195 ucubep1(1,2:njp1,5) = vcube(ni:-1:1,nj,3); % -
196 ucubep1(2:nip1,1,5) = ucube(1:ni,nj,4); % -
197 ucubep1(1,2:njp1,6) = ucube(ni,1:nj,5); % -
198 ucubep1(2:nip1,1,6) = -vcube(ni,nj:-1:1,4); % -
199
200 % Do the "n+1" V exchanges
201 vcubep1(1,2:njp1,1) = -ucube(ni:-1:1,nj,5); % -
202 vcubep1(2:nip1,1,1) = vcube(1:ni,nj,6); % -
203 vcubep1(1,2:njp1,2) = vcube(ni,1:nj,1); % -
204 vcubep1(2:nip1,1,2) = ucube(ni,nj:-1:1,6); % -
205 vcubep1(1,2:njp1,3) = -ucube(ni:-1:1,nj,1); % - ?????? +++
206 vcubep1(2:nip1,1,3) = vcube(1:ni,nj,2); % - ?????? +++
207 vcubep1(1,2:njp1,4) = vcube(ni,1:nj,3); % -
208 vcubep1(2:nip1,1,4) = ucube(ni,nj:-1:1,2); % -
209 vcubep1(1,2:njp1,5) = -ucube(ni:-1:1,nj,3); % -
210 vcubep1(2:nip1,1,5) = vcube(1:ni,nj,4); % -
211 vcubep1(1,2:njp1,6) = vcube(ni,1:nj,5); % -
212 vcubep1(2:nip1,1,6) = ucube(ni,nj:-1:1,4); % -
213
214
215
216 matlab -nojvm
217 clear all ; close all
218
219 ufid = fopen('uVeltave.0000000432.data', 'r', 'ieee-be');
220 vfid = fopen('vVeltave.0000000432.data', 'r', 'ieee-be');
221
222 ne = 510;
223 nps = 6 * ne*ne;
224 tx = 85;
225 ty = 85;
226 nt = ne*ne*6/(tx*ty);
227 ucube = unmangleJPL1( ...
228 reshape(fread(ufid, nps, 'real*4'),tx*nt,ty), ne, tx );
229 vcube = unmangleJPL1( ...
230 reshape(fread(vfid, nps, 'real*4'),tx*nt,ty), ne, tx );
231 fclose(ufid);
232 fclose(vfid);
233
234 % ucube(find(ucube == 0.0)) = NaN;
235 % vcube(find(vcube == 0.0)) = NaN;
236
237 % surf(ucube(:,:,1)), view(2), shading interp
238 % ucn = ucube;
239 % ucn(find(ucn == 0.0)) = NaN;
240 % figure(1)
241 % surf(ucn(:,:,1)), view(2), shading interp
242 % figure(2)
243 % surf(ucn(1:10,:,1)), view(2), shading interp
244 % u = permute(ucn,[2,1,3]);
245 % surf(u(:,:,1)), view(2), shading interp
246
247
248 % Fill the (ne+1)*(ne+1) grid with U,V values
249 ni = ne; nip1 = ni + 1;
250 nj = ne; njp1 = nj + 1;
251 ucubep1 = ones( [ nip1 nj 6 ] );
252 vcubep1 = ones( [ ni njp1 6 ] );
253 for icf = 1:6
254 ucubep1(1:ni,1:nj,icf) = ucube(:,:,icf);
255 vcubep1(1:ni,1:nj,icf) = vcube(:,:,icf);
256 end
257
258 % Do the "n+1" U exchanges
259 subplot(2,1,1), surf(ucubep1((nip1-10):nip1,:,1)), view(2), shading interp
260 ucubep1(nip1,:,1) = ucube(1,:,2); % -
261 subplot(2,1,2), surf(ucubep1((nip1-10):nip1,:,1)), view(2), shading interp
262
263 subplot(2,1,1), surf(ucubep1((nip1-10):nip1,:,2)), view(2), shading interp
264 ucubep1(nip1,:,2) = vcube(ne:-1:1,1,4); % -
265 subplot(2,1,2), surf(ucubep1((nip1-10):nip1,:,2)), view(2), shading interp
266
267 subplot(2,1,1), surf(ucubep1((nip1-10):nip1,:,3)), view(2), shading interp
268 ucubep1(nip1,:,3) = ucube(1,:,4); % -
269 subplot(2,1,2), surf(ucubep1((nip1-10):nip1,:,3)), view(2), shading interp
270
271 subplot(2,1,1), surf(ucubep1((nip1-10):nip1,:,4)), view(2), shading interp
272 ucubep1(nip1,:,4) = vcube(ne:-1:1,1,6); % -
273 subplot(2,1,2), surf(ucubep1((nip1-10):nip1,:,4)), view(2), shading interp
274
275 subplot(2,1,1), surf(ucubep1((nip1-10):nip1,:,5)), view(2), shading interp
276 ucubep1(nip1,:,5) = ucube(1,:,6); % -
277 subplot(2,1,2), surf(ucubep1((nip1-10):nip1,:,5)), view(2), shading interp
278
279 subplot(2,1,1), surf(ucubep1((nip1-10):nip1,:,6)), view(2), shading interp
280 ucubep1(nip1,:,6) = vcube(ne:-1:1,1,2); % -
281 subplot(2,1,2), surf(ucubep1((nip1-10):nip1,:,6)), view(2), shading interp
282
283
284 % Do the "n+1" V exchanges
285 subplot(1,2,1), surf(vcubep1(:,(njp1-10):nip1,1)), view(2), shading interp
286 vcubep1(:,nip1,1) = ucube(1,ne:-1:1,3); % -
287 subplot(1,2,2), surf(vcubep1(:,(nip1-10):nip1,1)), view(2), shading interp
288
289 subplot(1,2,1), surf(vcubep1(:,(nip1-10):nip1,2)), view(2), shading interp
290 vcubep1(:,nip1,2) = vcube(1,:,3); % -
291 subplot(1,2,2), surf(vcubep1(:,(nip1-10):nip1,2)), view(2), shading interp
292
293 subplot(1,2,1), surf(vcubep1(:,(nip1-10):nip1,3)), view(2), shading interp
294 vcubep1(:,nip1,3) = ucube(1,ne:-1:1,5); % -
295 subplot(1,2,2), surf(vcubep1(:,(nip1-10):nip1,3)), view(2), shading interp
296
297 subplot(1,2,1), surf(vcubep1(:,(nip1-10):nip1,4)), view(2), shading interp
298 vcubep1(:,nip1,4) = vcube(:,1,5); % -
299 subplot(1,2,2), surf(vcubep1(:,(nip1-10):nip1,4)), view(2), shading interp
300
301 subplot(1,2,1), surf(vcubep1(:,(nip1-10):nip1,5)), view(2), shading interp
302 vcubep1(:,nip1,5) = ucube(1,ne:-1:1,1); % -
303 subplot(1,2,2), surf(vcubep1(:,(nip1-10):nip1,5)), view(2), shading interp
304
305 subplot(1,2,1), surf(vcubep1(:,(nip1-10):nip1,6)), view(2), shading interp
306 vcubep1(:,nip1,6) = vcube(:,1,1); % -
307 subplot(1,2,2), surf(vcubep1(:,(nip1-10):nip1,6)), view(2), shading interp
308
309
310 % Do the "n+1" U exchanges
311 ucubep1(nip1,:,1) = ucube(1,:,2); % -
312 ucubep1(nip1,:,2) = vcube(ne:-1:1,1,4); % -
313 ucubep1(nip1,:,3) = ucube(1,:,4); % -
314 ucubep1(nip1,:,4) = vcube(ne:-1:1,1,6); % -
315 ucubep1(nip1,:,5) = ucube(1,:,6); % -
316 ucubep1(nip1,:,6) = vcube(ne:-1:1,1,2); % -
317
318 % Do the "n+1" V exchanges
319 vcubep1(:,nip1,1) = ucube(1,ne:-1:1,3); % -
320 vcubep1(:,nip1,2) = vcube(1,:,3); % -
321 vcubep1(:,nip1,3) = ucube(1,ne:-1:1,5); % -
322 vcubep1(:,nip1,4) = vcube(:,1,5); % -
323 vcubep1(:,nip1,5) = ucube(1,ne:-1:1,1); % -
324 vcubep1(:,nip1,6) = vcube(:,1,1); % -
325
326 masku = 1.0 - abs(diff(double(ucubep1(:,:,:) == 0.0),1,1));
327 % surf(masku(:,:,1)), view(2), shading interp
328
329 maskv = 1.0 - abs(diff(double(vcubep1(:,:,:) == 0.0),1,2));
330 % surf(maskv(:,:,1)), view(2), shading interp
331
332 diffu = 0.5*diff(ucubep1(:,:,:),1,1);
333 diffv = 0.5*diff(vcubep1(:,:,:),1,2);
334 uont = ucube(:,:,:) + masku.*diffu;
335 vont = vcube(:,:,:) + maskv.*diffv;
336
337 surf(uont(:,:,1)), view(2), shading interp
338 uontn = uont;
339 uontn(find(uontn == 0.0)) = NaN;
340 surf(uontn(:,:,1)), view(2), shading interp
341
342 surf(vont(:,:,1)), view(2), shading interp
343 vontn = vont;
344 vontn(find(vontn == 0.0)) = NaN;
345 surf(vontn(:,:,1)), view(2), shading interp
346
347
348
349 matlab -nojvm -nodisplay
350 clear all ; close all
351 nlay = 50;
352 ne = 510;
353
354 Spat = 'Stave/data/Stave.%10.10d.data';
355 Tpat = 'Ttave/data/Ttave.%10.10d.data';
356 Upat = '_Veltave/data/uVeltave.%10.10d.data';
357 Vpat = '_Veltave/data/vVeltave.%10.10d.data';
358
359 load ilist
360
361 calcUVB2_NFS(Spat, Tpat, Upat, Vpat, ilist, nlay, ne)
362
363

  ViewVC Help
Powered by ViewVC 1.1.22