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