1 |
% Generate input files for MITgcm/verification/seaice_obcs |
2 |
% the pkg/seaice + pkg/obcs verification experiment |
3 |
% by carving them out of verification/lab_sea/tr_run.salt_plume |
4 |
|
5 |
% readbin.m, writebin.m, and myint2str.m |
6 |
% are in MITgcm/utils/matlab/cs_grid/read_cs |
7 |
|
8 |
% first run lab_sea/tr_run.salt_plume with |
9 |
% endTime=43200., dumpFreq = 3600. |
10 |
|
11 |
% preamble |
12 |
%cd MITgcm/verification/seaice_obcs/input |
13 |
nx=20; ny=16; nz=23; nt=11; ix=8:17; iy=4:11; |
14 |
pn='../../lab_sea/tr_run.salt_plume/'; |
15 |
|
16 |
% pickup.0000000001.data |
17 |
tmp=readbin([pn 'pickup.0000000001.data'],[nx ny 187],1,'real*8'); |
18 |
writebin('pickup.0000000001.data',tmp(ix,iy,:),1,'real*8'); |
19 |
|
20 |
% pickup_seaice.0000000001.data |
21 |
tmp=readbin([pn 'pickup_seaice.0000000001.data'],[nx ny 8],1,'real*8'); |
22 |
writebin('pickup_seaice.0000000001.data',tmp(ix,iy,:),1,'real*8'); |
23 |
|
24 |
% U/V/T/S lateral boundary conditions |
25 |
for f={'T','S','U','V'} |
26 |
x1=ix(1); x2=ix(end); y1=iy(1); y2=iy(end); |
27 |
if strcmp(f{1},'U'), x1=ix(2); end |
28 |
if strcmp(f{1},'V'), y1=iy(2); end |
29 |
for t=0:nt |
30 |
fn=[pn f{1} '.' myint2str(t,10) '.data']; |
31 |
if t==0 |
32 |
fn=[pn f{1} '.' myint2str(1,10) '.data']; |
33 |
end |
34 |
tmp=readbin(fn,[nx ny nz]); |
35 |
for d={'N','S','E','W'} |
36 |
fo=['OB' d{1} lower(f{1}) '.seaice_obcs']; |
37 |
switch d{1} |
38 |
case 'N', writebin(fo,tmp(ix,y2,:),1,'real*4',t); |
39 |
case 'S', writebin(fo,tmp(ix,y1,:),1,'real*4',t); |
40 |
case 'E', writebin(fo,tmp(x2,iy,:),1,'real*4',t); |
41 |
case 'W', writebin(fo,tmp(x1,iy,:),1,'real*4',t); |
42 |
end |
43 |
end |
44 |
end |
45 |
end |
46 |
|
47 |
% sea ice lateral boundary conditions |
48 |
fld={'AREA','HEFF','HSALT','HSNOW','UICE','VICE'}; |
49 |
nme={'a','h','sl','sn','uice','vice'}; |
50 |
for f=1:length(fld) |
51 |
x1=ix(1); x2=ix(end); y1=iy(1); y2=iy(end); |
52 |
if strcmp(fld{f},'UICE'), x1=ix(2); end |
53 |
if strcmp(fld{f},'VICE'), y1=iy(2); end |
54 |
for t=0:nt |
55 |
fldf=fld{f}; |
56 |
if f==3 |
57 |
fldf='SITRACER02'; |
58 |
end |
59 |
fn=[pn fldf '.' myint2str(t,10) '.data']; |
60 |
if t==0 |
61 |
fn=[pn fldf '.' myint2str(1,10) '.data']; |
62 |
end |
63 |
tmp=readbin(fn,[nx ny]); |
64 |
for d={'N','S','E','W'} |
65 |
fo=['OB' d{1} nme{f} '.seaice_obcs']; |
66 |
switch d{1} |
67 |
case 'N', writebin(fo,tmp(ix,y2,:),1,'real*4',t-1); |
68 |
case 'S', writebin(fo,tmp(ix,y1,:),1,'real*4',t-1); |
69 |
case 'E', writebin(fo,tmp(x2,iy,:),1,'real*4',t-1); |
70 |
case 'W', writebin(fo,tmp(x1,iy,:),1,'real*4',t-1); |
71 |
end |
72 |
end |
73 |
end |
74 |
end |
75 |
|
76 |
% bathymetry |
77 |
tmp=readbin([pn 'bathy.labsea1979'],[nx ny]); |
78 |
writebin('bathy.seaice_obcs',tmp(ix,iy)); |