1 |
cnh |
1.1 |
format compact |
2 |
|
|
path('/u/u0/dimitri/matlab/tools',path); |
3 |
|
|
path('/u/u0/dimitri/matlab/whoi',path); |
4 |
|
|
path('/u/u0/dimitri/matlab/mitgcm',path); |
5 |
|
|
path('/u/adcroft/matlab/bin',path); |
6 |
|
|
|
7 |
|
|
nx=32; |
8 |
|
|
|
9 |
|
|
%for typ={'conf','q=0','q=1','q=1/2','q=7/8','q=i3','tan','tan2','new'} |
10 |
|
|
|
11 |
|
|
for typ={'conf'} |
12 |
|
|
|
13 |
|
|
[dxg,dyg,dxf,dyf,dxc,dyc,dxv,dyu,Ec,Eu,Ev,Ez,latC,lonC,latG,lonG,... |
14 |
|
|
Q11,Q22,Q12, TUu,TUv,TVu,TVv ]=gengrid_fn(nx+1,16,typ{1},'c',0,1); |
15 |
|
|
theta=zeros(nx/2,nx/2); |
16 |
|
|
for i=1:nx/2, for j=1:nx/2 |
17 |
|
|
lat=[latG(i,j) latG(i+1,j)]*180/pi; |
18 |
|
|
lon=[lonG(i,j) lonG(i+1,j)]*180/pi; |
19 |
|
|
a=dist(lat,lon,'sphere'); |
20 |
|
|
lat=[latG(i,j) latG(i,j+1)]*180/pi; |
21 |
|
|
lon=[lonG(i,j) lonG(i,j+1)]*180/pi; |
22 |
|
|
b=dist(lat,lon,'sphere'); |
23 |
|
|
lat=[latG(i+1,j) latG(i,j+1)]*180/pi; |
24 |
|
|
lon=[lonG(i+1,j) lonG(i,j+1)]*180/pi; |
25 |
|
|
c=dist(lat,lon,'sphere'); |
26 |
|
|
theta(i,j)=acos((a^2+b^2-c^2)/2/a/b); |
27 |
|
|
end, end |
28 |
|
|
disp(typ{1}) |
29 |
|
|
disp(minmax(dxg*6371)) |
30 |
|
|
disp(minmax(dxg(1:nx/2,1:nx/2)./dyg(1:nx/2,1:nx/2))) |
31 |
|
|
tmp=theta*180/pi; tmp(1,1)=nan; |
32 |
|
|
disp(minmax(tmp)) |
33 |
|
|
mypcolor(theta*180/pi); colorbar |
34 |
|
|
title(typ{1}) |
35 |
|
|
tmp=typ{1}; tmp(strfind(tmp,'/'))='_'; |
36 |
|
|
eval(['print -dpsc FIG' tmp]) |
37 |
|
|
|
38 |
|
|
end |
39 |
|
|
|
40 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
41 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
42 |
|
|
|
43 |
|
|
clear all, close all, nx=32; genx; |
44 |
|
|
pn='/u/u0/dimitri/MITgcm/verification/hs94.cs-32x32x5/input/'; |
45 |
|
|
PN='/u/u0/dimitri/cubed_sphere/cs-conf-c-32-128/'; |
46 |
|
|
|
47 |
|
|
long=readbin([pn 'LONG.bin'],[nx 6 nx],1,'real*8'); |
48 |
|
|
latg=readbin([pn 'LATG.bin'],[nx 6 nx],1,'real*8'); |
49 |
|
|
LONG=zeros(nx,6,nx); LATG=zeros(nx,6,nx); |
50 |
|
|
for i=1:6 |
51 |
|
|
tmp=readbin([PN 'LONG.' myint2str(i,3) '.bin'],[nx+1 nx+1],1,'real*8'); |
52 |
|
|
LONG(:,i,:)=tmp(1:nx,1:nx); |
53 |
|
|
tmp=readbin([PN 'LATG.' myint2str(i,3) '.bin'],[nx+1 nx+1],1,'real*8'); |
54 |
|
|
LATG(:,i,:)=tmp(1:nx,1:nx); |
55 |
|
|
end |
56 |
|
|
for i=1:6 |
57 |
|
|
subplot(3,2,i) |
58 |
|
|
plot(squeeze(long(:,i,:)),squeeze(latg(:,i,:)),'bo', ... |
59 |
|
|
squeeze(LONG(:,i,:)),squeeze(LATG(:,i,:)),'k.') |
60 |
|
|
title(i) |
61 |
|
|
end |
62 |
|
|
|
63 |
|
|
clf |
64 |
|
|
subplot(211), fld=[pn 'LONG.bin']; plotfld, title('LONG') |
65 |
|
|
subplot(212), fld=[pn 'LATG.bin']; plotfld, title('LATG') |
66 |
|
|
|
67 |
|
|
lonc=readbin([pn 'LONC.bin'],[nx 6 nx],1,'real*8'); |
68 |
|
|
latc=readbin([pn 'LATC.bin'],[nx 6 nx],1,'real*8'); |
69 |
|
|
LONC=zeros(nx,6,nx); LATC=zeros(nx,6,nx); |
70 |
|
|
for i=1:6 |
71 |
|
|
LONC(:,i,:)=readbin([PN 'LONC.' myint2str(i,3) '.bin'],[nx nx],1,'real*8'); |
72 |
|
|
LATC(:,i,:)=readbin([PN 'LATC.' myint2str(i,3) '.bin'],[nx nx],1,'real*8'); |
73 |
|
|
end |
74 |
|
|
for i=1:6 |
75 |
|
|
subplot(3,2,i) |
76 |
|
|
plot(squeeze(lonc(:,i,:)),squeeze(latc(:,i,:)),'bo', ... |
77 |
|
|
squeeze(LONC(:,i,:)),squeeze(LATC(:,i,:)),'k.') |
78 |
|
|
title(i) |
79 |
|
|
end |
80 |
|
|
|
81 |
|
|
for nm={'DXC','DYC','DXF','DYF','DXG','DYG','DXV','DYU','RA','RAS','RAW','RAZ'} |
82 |
|
|
fld=tile_fld(PN,nm{1},nx); |
83 |
|
|
writebin([PN nm{1} '.bin'],fld,1,'real*8'); |
84 |
|
|
subplot(311), fld=[pn nm{1} '.bin']; plotfld, title([pn nm{1}]), tmp1=tmp; |
85 |
|
|
subplot(312), fld=[PN nm{1} '.bin']; plotfld, title([PN nm{1}]), tmp2=tmp; |
86 |
|
|
subplot(313), mypcolor(tmp2'-tmp1'); colorbar, title('difference') |
87 |
|
|
disp(minmax((tmp1-tmp2)./tmp2)), pause |
88 |
|
|
end |