Warning, /verification/seaice_obcs/input/mk_input.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit adb13907 on 2012-12-19 02:48:52 UTC
3b88786c4e Dimi*0001 % Generate input files for MITgcm/verification/seaice_obcs
0002 % the pkg/seaice + pkg/obcs verification experiment
adb13907c3 Dimi*0003 % by carving them out of verification/lab_sea/tr_run.salt_plume
41fb919ba6 Dimi*0004
a71b5ece1c Dimi*0005 % readbin.m, writebin.m, and myint2str.m
0006 % are in MITgcm/utils/matlab/cs_grid/read_cs
0007
adb13907c3 Dimi*0008 % first run lab_sea/tr_run.salt_plume with
0009 % endTime=43200., dumpFreq = 3600.
0010
3b88786c4e Dimi*0011 % preamble
adb13907c3 Dimi*0012 %cd MITgcm/verification/seaice_obcs/input
0013 nx=20; ny=16; nz=23; nt=11; ix=8:17; iy=4:11;
3b88786c4e Dimi*0014 pn='../../lab_sea/tr_run.salt_plume/';
41fb919ba6 Dimi*0015
adb13907c3 Dimi*0016 % pickup.0000000001.data
0017 tmp=readbin([pn 'pickup.0000000001.data'],[nx ny 187],1,'real*8');
0018 writebin('pickup.0000000001.data',tmp(ix,iy,:),1,'real*8');
0019
0020 % pickup_seaice.0000000001.data
0021 tmp=readbin([pn 'pickup_seaice.0000000001.data'],[nx ny 8],1,'real*8');
0022 writebin('pickup_seaice.0000000001.data',tmp(ix,iy,:),1,'real*8');
41fb919ba6 Dimi*0023
3b88786c4e Dimi*0024 % U/V/T/S lateral boundary conditions
41fb919ba6 Dimi*0025 for f={'T','S','U','V'}
0026 x1=ix(1); x2=ix(end); y1=iy(1); y2=iy(end);
0027 if strcmp(f{1},'U'), x1=ix(2); end
0028 if strcmp(f{1},'V'), y1=iy(2); end
3b88786c4e Dimi*0029 for t=0:nt
41fb919ba6 Dimi*0030 fn=[pn f{1} '.' myint2str(t,10) '.data'];
adb13907c3 Dimi*0031 if t==0
0032 fn=[pn f{1} '.' myint2str(1,10) '.data'];
0033 end
41fb919ba6 Dimi*0034 tmp=readbin(fn,[nx ny nz]);
0035 for d={'N','S','E','W'}
0036 fo=['OB' d{1} lower(f{1}) '.seaice_obcs'];
0037 switch d{1}
0038 case 'N', writebin(fo,tmp(ix,y2,:),1,'real*4',t);
0039 case 'S', writebin(fo,tmp(ix,y1,:),1,'real*4',t);
0040 case 'E', writebin(fo,tmp(x2,iy,:),1,'real*4',t);
0041 case 'W', writebin(fo,tmp(x1,iy,:),1,'real*4',t);
0042 end
0043 end
0044 end
0045 end
0046
3b88786c4e Dimi*0047 % sea ice lateral boundary conditions
41fb919ba6 Dimi*0048 fld={'AREA','HEFF','HSALT','HSNOW','UICE','VICE'};
0049 nme={'a','h','sl','sn','uice','vice'};
0050 for f=1:length(fld)
0051 x1=ix(1); x2=ix(end); y1=iy(1); y2=iy(end);
0052 if strcmp(fld{f},'UICE'), x1=ix(2); end
0053 if strcmp(fld{f},'VICE'), y1=iy(2); end
adb13907c3 Dimi*0054 for t=0:nt
0055 fldf=fld{f};
0056 if f==3
0057 fldf='SITRACER02';
0058 end
0059 fn=[pn fldf '.' myint2str(t,10) '.data'];
0060 if t==0
0061 fn=[pn fldf '.' myint2str(1,10) '.data'];
0062 end
41fb919ba6 Dimi*0063 tmp=readbin(fn,[nx ny]);
0064 for d={'N','S','E','W'}
0065 fo=['OB' d{1} nme{f} '.seaice_obcs'];
0066 switch d{1}
3b88786c4e Dimi*0067 case 'N', writebin(fo,tmp(ix,y2,:),1,'real*4',t-1);
0068 case 'S', writebin(fo,tmp(ix,y1,:),1,'real*4',t-1);
0069 case 'E', writebin(fo,tmp(x2,iy,:),1,'real*4',t-1);
0070 case 'W', writebin(fo,tmp(x1,iy,:),1,'real*4',t-1);
41fb919ba6 Dimi*0071 end
0072 end
0073 end
0074 end
3b88786c4e Dimi*0075
0076 % bathymetry
0077 tmp=readbin([pn 'bathy.labsea1979'],[nx ny]);
0078 writebin('bathy.seaice_obcs',tmp(ix,iy));