[27032] | 1 | Index: ../trunk-jpl/test/MITgcm/tools/lookat_4003.m
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/test/MITgcm/tools/lookat_4003.m (revision 26938)
|
---|
| 4 | +++ ../trunk-jpl/test/MITgcm/tools/lookat_4003.m (revision 26939)
|
---|
| 5 | @@ -2,6 +2,89 @@
|
---|
| 6 | p1=[pn 'RunUncoupled/'];
|
---|
| 7 | p2=[pn 'run/'];
|
---|
| 8 |
|
---|
| 9 | +for ts=30:34
|
---|
| 10 | + v1=readbin([p2 'R_shelfIce1_' myint2str(ts,10) '.data'],[3 200]);
|
---|
| 11 | + v2=readbin([p2 'R_shelfIce2_' myint2str(ts,10) '.data'],[3 200]);
|
---|
| 12 | + u=readbin([p2 'U.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 13 | + v=readbin([p2 'V.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 14 | + w=readbin([p2 'W.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 15 | + clf, subplot(511), plot(v1(2,:)), title(ts)
|
---|
| 16 | + subplot(512), plot(v2(2,:)-v1(2,:)), title('draft change')
|
---|
| 17 | + subplot(513), mypcolor(1:200,-1:-1:-90,squeeze(u(2,:,:))'); title('U'), colorbar
|
---|
| 18 | + subplot(514), mypcolor(1:200,-1:-1:-90,squeeze(v(2,:,:))'); title('V'), colorbar
|
---|
| 19 | + subplot(515), mypcolor(1:200,-1:-1:-90,squeeze(w(2,:,:))'); title('W'), colorbar
|
---|
| 20 | + pause
|
---|
| 21 | +end
|
---|
| 22 | +
|
---|
| 23 | +
|
---|
| 24 | + clf
|
---|
| 25 | + subplot(311), mypcolor(v1), title(ts)
|
---|
| 26 | + subplot(312), mypcolor(v2), title(ts)
|
---|
| 27 | + subplot(313), mypcolor(v2-v1)
|
---|
| 28 | +
|
---|
| 29 | +for ts=1:10
|
---|
| 30 | + v1=readbin([p2 'SHICE_fwFlux.' myint2str(ts,10) '.data'],[3 200]);
|
---|
| 31 | + clf
|
---|
| 32 | + subplot(311), mypcolor(v1), title(ts), colorbar
|
---|
| 33 | +pause
|
---|
| 34 | +end
|
---|
| 35 | +
|
---|
| 36 | +
|
---|
| 37 | + v2=readbin([p2 'SHICE_fwFlux.' myint2str(ts,10) '.data'],[3 200]);
|
---|
| 38 | +
|
---|
| 39 | +
|
---|
| 40 | +clf
|
---|
| 41 | +for ts=5, disp(ts)
|
---|
| 42 | + T=readbin([p2 'T.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 43 | + S=readbin([p2 'S.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 44 | + U=readbin([p2 'U.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 45 | + V=readbin([p2 'V.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 46 | + W=readbin([p2 'W.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 47 | + for k=1:90, disp(k)
|
---|
| 48 | + clf
|
---|
| 49 | + subplot(321), plot(S(2,:,k)), title('S')
|
---|
| 50 | + subplot(322), plot(T(2,:,k)), title('T')
|
---|
| 51 | + subplot(323), plot(U(2,:,k)), title('U')
|
---|
| 52 | + subplot(324), plot(V(2,:,k)), title('V')
|
---|
| 53 | + subplot(325), plot(W(2,:,k)), title('W')
|
---|
| 54 | + pause
|
---|
| 55 | + end
|
---|
| 56 | +end
|
---|
| 57 | +
|
---|
| 58 | +
|
---|
| 59 | +clf
|
---|
| 60 | +for ts=1:8, disp(ts)
|
---|
| 61 | + T=readbin([p2 'T.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 62 | + S=readbin([p2 'S.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 63 | + U=readbin([p2 'U.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 64 | + V=readbin([p2 'V.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 65 | + W=readbin([p2 'W.' myint2str(ts,10) '.data'],[3 200 90]);
|
---|
| 66 | + clf
|
---|
| 67 | + subplot(321), mypcolor(squeeze(S(2,:,:))'), title('S'), colorbar
|
---|
| 68 | + subplot(322), mypcolor(squeeze(T(2,:,:))'), title('T'), colorbar
|
---|
| 69 | + subplot(323), mypcolor(squeeze(U(2,:,:))'), title('U'), colorbar
|
---|
| 70 | + subplot(324), mypcolor(squeeze(V(2,:,:))'), title('V'), colorbar
|
---|
| 71 | + subplot(325), mypcolor(squeeze(W(2,:,:))'), title('W'), colorbar
|
---|
| 72 | + pause
|
---|
| 73 | +end
|
---|
| 74 | +
|
---|
| 75 | +
|
---|
| 76 | +
|
---|
| 77 | +
|
---|
| 78 | +
|
---|
| 79 | +
|
---|
| 80 | +ts=8;
|
---|
| 81 | +v1=readbin([p2 'R_shelfIce1_' myint2str(ts,10) '.data'],[3 200]);
|
---|
| 82 | +v2=readbin([p2 'R_shelfIce2_' myint2str(ts,10) '.data'],[3 200]);
|
---|
| 83 | +clf
|
---|
| 84 | +subplot(311), mypcolor(v1); title('R_shelfIce1'), colorbar
|
---|
| 85 | +subplot(312), mypcolor(v2); title('R_shelfIce2'), colorbar
|
---|
| 86 | +subplot(313), mypcolor(v2-v1); title('diff'), colorbar
|
---|
| 87 | +
|
---|
| 88 | +figure(2)
|
---|
| 89 | +clf
|
---|
| 90 | +plot(1:200,v1(2,:),'o-',1:200,v2(2,:),'o-',1:200,v2(2,:)-v1(2,:),'o-')
|
---|
| 91 | +
|
---|
| 92 | ts=0;
|
---|
| 93 | fld='R_shelfIce1_';
|
---|
| 94 | v1=readbin([p2 fld myint2str(ts,10) '.data'],[3 200]);
|
---|
| 95 | Index: ../trunk-jpl/test/NightlyRun/test4004.m
|
---|
| 96 | ===================================================================
|
---|
| 97 | --- ../trunk-jpl/test/NightlyRun/test4004.m (nonexistent)
|
---|
| 98 | +++ ../trunk-jpl/test/NightlyRun/test4004.m (revision 26939)
|
---|
| 99 | @@ -0,0 +1,427 @@
|
---|
| 100 | +%Test Name: IceOceanCoupling Dan Goldberg'd setup
|
---|
| 101 | +%ISSM/MITgcm coupled set-up
|
---|
| 102 | +%
|
---|
| 103 | +%Script control parameters
|
---|
| 104 | +steps=1:10;
|
---|
| 105 | +
|
---|
| 106 | +%To download and recompile MITgcm from scratch:
|
---|
| 107 | +!rm -rf ${ISSM_DIR}/test/MITgcm/install
|
---|
| 108 | +!rm -rf ${ISSM_DIR}/test/MITgcm/build/*
|
---|
| 109 | +!rm -rf Models
|
---|
| 110 | +
|
---|
| 111 | +%Organizer
|
---|
| 112 | +!mkdir Models
|
---|
| 113 | +org=organizer('repository','Models','prefix','IceOcean.','steps',steps);
|
---|
| 114 | +
|
---|
| 115 | +presentdirectory=pwd;
|
---|
| 116 | +
|
---|
| 117 | +% {{{ Parameters:
|
---|
| 118 | +if perform(org,'Parameters'),
|
---|
| 119 | + Nx=3; % number of longitude cells
|
---|
| 120 | + Ny=200; % number of latitude cells
|
---|
| 121 | + Nz=90; % number of MITgcm vertical cells
|
---|
| 122 | + nPx=1; % number of MITgcm processes to use in x direction
|
---|
| 123 | + nPy=8; % number of MITgcm processes to use in y direction
|
---|
| 124 | + xgOrigin=0; % origin of longitude
|
---|
| 125 | + ygOrigin=-75.5; % origin of latitude
|
---|
| 126 | + dLong=.125; % longitude grid spacing
|
---|
| 127 | + dLat=dLong/16; % latitude grid spacing
|
---|
| 128 | + delZ=10; % thickness of vertical levels (m)
|
---|
| 129 | + gravity= 9.81; % gravity (m^2/s)
|
---|
| 130 | + rho_ice=917;
|
---|
| 131 | + rho_water=1030;
|
---|
| 132 | + di=rho_ice/rho_water;
|
---|
| 133 | + prec = 'real*8'; % precision of MITgcm input binary files
|
---|
| 134 | +
|
---|
| 135 | + % bathymetry and ice sheet geometry
|
---|
| 136 | + H = -900; % water depth in the ice shelf cavity
|
---|
| 137 | + Hmin = -600; % deepest point of cavern
|
---|
| 138 | + Hmax = -300; % shallowest point of cavern
|
---|
| 139 | + jEnd = Ny*3/4; % where ice-shelf ends
|
---|
| 140 | + j2 = jEnd+1;
|
---|
| 141 | +
|
---|
| 142 | + % initial ocean conditions
|
---|
| 143 | + T_sfc = -2;
|
---|
| 144 | + T_bot = -1.9;
|
---|
| 145 | + S_sfc = 34.2;
|
---|
| 146 | + S_bot = 34.3;
|
---|
| 147 | +
|
---|
| 148 | + savedata(org, Nx, Ny, nPx, nPy, Nz, dLong, dLat, delZ, xgOrigin, ygOrigin, ...
|
---|
| 149 | + rho_ice, rho_water, di, H, Hmin, Hmax, jEnd, j2, gravity, prec, ...
|
---|
| 150 | + T_sfc,T_bot,S_sfc,S_bot);
|
---|
| 151 | +end
|
---|
| 152 | +% }}}
|
---|
| 153 | +% {{{ Bathymetry:
|
---|
| 154 | +if perform(org,'Bathymetry'),
|
---|
| 155 | +
|
---|
| 156 | + loaddata(org,'Parameters');
|
---|
| 157 | +
|
---|
| 158 | + %create lat,lon
|
---|
| 159 | + latg = ygOrigin+[0:Ny-1]*dLat;
|
---|
| 160 | + latc = latg+dLat/2;
|
---|
| 161 | + long = xgOrigin+[0:Nx-1]*dLong;
|
---|
| 162 | + lonc = long+dLong/2;
|
---|
| 163 | + [lat lon]=meshgrid(latc,lonc);
|
---|
| 164 | + zC=-delZ*([1:Nz]-0.5);
|
---|
| 165 | + zF=-delZ*[0:Nz];
|
---|
| 166 | +
|
---|
| 167 | + %create bathymetry:
|
---|
| 168 | + bathymetry = ones(Nx,Ny)*H;
|
---|
| 169 | + bathymetry(:,end) = 0;
|
---|
| 170 | +
|
---|
| 171 | + %save bathymetry file for MITgcm
|
---|
| 172 | + savedata(org,lat,lon,bathymetry);
|
---|
| 173 | +
|
---|
| 174 | +end
|
---|
| 175 | +% }}}
|
---|
| 176 | +% {{{ IceSheetGeometry:
|
---|
| 177 | +if perform(org,'IceSheetGeometry'),
|
---|
| 178 | +
|
---|
| 179 | + loaddata(org,'Parameters');
|
---|
| 180 | + loaddata(org,'Bathymetry');
|
---|
| 181 | + latmin=min(lat(:));
|
---|
| 182 | + latmax=max(lat(:));
|
---|
| 183 | +
|
---|
| 184 | + dHdy = (Hmax-Hmin)/dLat/(jEnd-2); %Slope of ice shelf
|
---|
| 185 | + draft=bathymetry;
|
---|
| 186 | + for i=1:Nx
|
---|
| 187 | + draft(i,:)=Hmin+dHdy*[-1:Ny-2]*dLat;
|
---|
| 188 | + end
|
---|
| 189 | + draft(:,j2:Ny)=0;
|
---|
| 190 | +
|
---|
| 191 | + ice_mask=ones(Nx,Ny);
|
---|
| 192 | + ice_mask(:,j2:Ny)=0;
|
---|
| 193 | + iceshelf_mask=ice_mask;
|
---|
| 194 | + thickness=abs(draft)/di;
|
---|
| 195 | +
|
---|
| 196 | + savedata(org,ice_mask,iceshelf_mask,draft,thickness);
|
---|
| 197 | +
|
---|
| 198 | + close all, figure(2), clf
|
---|
| 199 | + subplot(411), pcolorcen(bathymetry); colorbar, title('bathymetry')
|
---|
| 200 | + subplot(412), pcolorcen(ice_mask); colorbar, title('ice and iceshelf mask')
|
---|
| 201 | + subplot(413), pcolorcen(draft); colorbar, title('draft')
|
---|
| 202 | + subplot(414), pcolorcen(thickness); colorbar, title('thickness')
|
---|
| 203 | +
|
---|
| 204 | +end
|
---|
| 205 | +% }}}
|
---|
| 206 | +
|
---|
| 207 | +%Configure MITgcm
|
---|
| 208 | +% {{{ GetMITgcm:
|
---|
| 209 | +if perform(org,'GetMITgcm'),
|
---|
| 210 | + system([pwd '/../MITgcm/get_mitgcm.sh']);
|
---|
| 211 | +end
|
---|
| 212 | +% }}}
|
---|
| 213 | +% {{{ BuildMITgcm:
|
---|
| 214 | +if perform(org,'BuildMITgcm'),
|
---|
| 215 | + system(['../MITgcm/build_4003.sh generic ' pwd '/../MITgcm']);
|
---|
| 216 | +end
|
---|
| 217 | +% }}}
|
---|
| 218 | +addpath(recursivepath([pwd '/../MITgcm']));
|
---|
| 219 | +% {{{ RunUncoupledMITgcm:
|
---|
| 220 | +if perform(org,'RunUncoupledMITgcm'),
|
---|
| 221 | +
|
---|
| 222 | + loaddata(org,'Parameters');
|
---|
| 223 | + loaddata(org,'Bathymetry');
|
---|
| 224 | + loaddata(org,'IceSheetGeometry');
|
---|
| 225 | +
|
---|
| 226 | + % rename previous run directory and create new one
|
---|
| 227 | + if exist ('run.old')
|
---|
| 228 | + !\rm -rf run.old
|
---|
| 229 | + end
|
---|
| 230 | + if exist ('run')
|
---|
| 231 | + !\mv run run.old
|
---|
| 232 | + end
|
---|
| 233 | + !\mkdir run
|
---|
| 234 | + !\cp ../MITgcm/build/mitgcmuv run
|
---|
| 235 | + !\cp ../MITgcm/input_4003/* run
|
---|
| 236 | + !\cp ../MITgcm/input_4003/eedata_uncoupled run/eedata
|
---|
| 237 | +
|
---|
| 238 | + % {{{ Construct MITgcm binary input files
|
---|
| 239 | + namF='run/bathy_flat.bin';
|
---|
| 240 | + fid=fopen(namF,'w','b'); fwrite(fid,bathymetry,prec);fclose(fid);
|
---|
| 241 | +
|
---|
| 242 | + namF='run/shelficeTopo.Lin.bin';
|
---|
| 243 | + fid=fopen(namF,'w','b'); fwrite(fid,draft,prec);fclose(fid);
|
---|
| 244 | +
|
---|
| 245 | + del_T = (T_bot - T_sfc)/(59*delZ);
|
---|
| 246 | + tref=zeros(1,Nz);
|
---|
| 247 | + for k = 1:Nz;
|
---|
| 248 | + tref(k) = T_sfc + del_T*((k-20)*delZ);
|
---|
| 249 | + tref(k)= max(T_sfc,min(tref(k),T_bot));
|
---|
| 250 | + end
|
---|
| 251 | + namF='run/temp_obc.bin';
|
---|
| 252 | + tref=[tref; tref; tref];
|
---|
| 253 | + fid=fopen(namF,'w','b'); fwrite(fid,tref,prec);fclose(fid);
|
---|
| 254 | +
|
---|
| 255 | + del_S = (S_bot - S_sfc)/(59*delZ);
|
---|
| 256 | + sref=zeros(1,Nz);
|
---|
| 257 | + for k = 1:Nz;
|
---|
| 258 | + sref(k) = S_sfc + del_S*((k-20)*delZ);
|
---|
| 259 | + sref(k)= max(S_sfc,min(sref(k),S_bot));
|
---|
| 260 | + end
|
---|
| 261 | + namF='run/salt_obc.bin';
|
---|
| 262 | + sref=[sref; sref; sref];
|
---|
| 263 | + fid=fopen(namF,'w','b'); fwrite(fid,sref,prec);fclose(fid);
|
---|
| 264 | +
|
---|
| 265 | + zax=[1:Nz];
|
---|
| 266 | + v1=2.5e-2;
|
---|
| 267 | + var=1+Nz-2*zax; var=var/(Nz-1);
|
---|
| 268 | + vobc=v1*var;
|
---|
| 269 | + namF='run/vVel_obc.bin';
|
---|
| 270 | + vobc=[vobc; vobc; vobc];
|
---|
| 271 | + fid=fopen(namF,'w','b'); fwrite(fid,vobc,prec);fclose(fid);
|
---|
| 272 | +
|
---|
| 273 | + var=zeros(Nx,Ny,Nz);
|
---|
| 274 | + for i=1:Nx, for j=1:Ny
|
---|
| 275 | + var(i,j,:)=tref(1,:);
|
---|
| 276 | + end, end
|
---|
| 277 | + namF='run/temp_ini.bin';
|
---|
| 278 | + fid=fopen(namF,'w','b'); fwrite(fid,var,prec);fclose(fid);
|
---|
| 279 | +
|
---|
| 280 | + for i=1:Nx, for j=1:Ny
|
---|
| 281 | + var(i,j,:)=sref(1,:);
|
---|
| 282 | + end, end
|
---|
| 283 | + namF='run/salt_ini.bin';
|
---|
| 284 | + fid=fopen(namF,'w','b'); fwrite(fid,var,prec);fclose(fid);
|
---|
| 285 | + % }}}
|
---|
| 286 | +
|
---|
| 287 | + cd run
|
---|
| 288 | + eval(['!mpirun -np ' int2str(nPx*nPy) ' ./mitgcmuv']);
|
---|
| 289 | + cd ..
|
---|
| 290 | +end
|
---|
| 291 | +% }}}
|
---|
| 292 | +
|
---|
| 293 | +%Configure ISSM
|
---|
| 294 | +% {{{ CreateMesh:
|
---|
| 295 | +if perform(org,'CreateMesh'),
|
---|
| 296 | +
|
---|
| 297 | + loaddata(org,'Parameters');
|
---|
| 298 | +
|
---|
| 299 | + %create model:
|
---|
| 300 | + md=model();
|
---|
| 301 | +
|
---|
| 302 | + %Grab lat,long from MITgcm:
|
---|
| 303 | + long=readbin('run/XC.data',[Nx Ny]);
|
---|
| 304 | + lat=readbin('run/YC.data',[Nx Ny]);
|
---|
| 305 | +
|
---|
| 306 | + %project lat,long:
|
---|
| 307 | + [x,y]=ll2xy(lat(:),long(:),-1);
|
---|
| 308 | + index=[];
|
---|
| 309 | + % C D
|
---|
| 310 | + % A B
|
---|
| 311 | + for j=1:(Ny-1),
|
---|
| 312 | + for i=1:(Nx-1),
|
---|
| 313 | + A=(j-1)*(Nx)+i;
|
---|
| 314 | + B=(j-1)*(Nx)+i+1;
|
---|
| 315 | + C=j*(Nx)+i;
|
---|
| 316 | + D=j*(Nx)+i+1;
|
---|
| 317 | + index(end+1,:)=[A B C];
|
---|
| 318 | + index(end+1,:)=[C B D];
|
---|
| 319 | + end
|
---|
| 320 | + end
|
---|
| 321 | +
|
---|
| 322 | + %fill mesh and model:
|
---|
| 323 | + md=meshconvert(md,index,x,y);
|
---|
| 324 | + md.mesh.lat=lat(:);
|
---|
| 325 | + md.mesh.long=long(:);
|
---|
| 326 | +
|
---|
| 327 | + savemodel(org,md);
|
---|
| 328 | +
|
---|
| 329 | +end
|
---|
| 330 | +% }}}
|
---|
| 331 | +% {{{ MeshGeometry:
|
---|
| 332 | +if perform(org,'MeshGeometry'),
|
---|
| 333 | +
|
---|
| 334 | + loaddata(org,'Parameters');
|
---|
| 335 | + loaddata(org,'CreateMesh');
|
---|
| 336 | + loaddata(org,'Bathymetry');
|
---|
| 337 | + loaddata(org,'IceSheetGeometry');
|
---|
| 338 | +
|
---|
| 339 | + %start filling some of the fields
|
---|
| 340 | + md.geometry.bed=bathymetry(:);
|
---|
| 341 | + md.geometry.thickness=thickness(:);
|
---|
| 342 | + md.geometry.base=-917/1028*md.geometry.thickness;
|
---|
| 343 | + md.geometry.surface=md.geometry.base+md.geometry.thickness;
|
---|
| 344 | +
|
---|
| 345 | + %nothing passes icefront:
|
---|
| 346 | + pos=find((~ice_mask(:) & ice_mask(:)~=0) | thickness(:)==0);
|
---|
| 347 | + md.geometry.thickness(pos)=1;
|
---|
| 348 | + md.geometry.surface(pos)=(1-di)*md.geometry.thickness(pos);
|
---|
| 349 | + md.geometry.base(pos)=-di*md.geometry.thickness(pos);
|
---|
| 350 | +
|
---|
| 351 | + %level sets:
|
---|
| 352 | + md.mask.ice_levelset=iceshelf_mask(:);
|
---|
| 353 | + pos=find(md.mask.ice_levelset==1); md.mask.ice_levelset(pos)=-1;
|
---|
| 354 | + pos=find(md.mask.ice_levelset==0); md.mask.ice_levelset(pos)=1;
|
---|
| 355 | + md.mask.ocean_levelset=-ones(md.mesh.numberofvertices,1);
|
---|
| 356 | +
|
---|
| 357 | + savemodel(org,md);
|
---|
| 358 | +
|
---|
| 359 | +end
|
---|
| 360 | +% }}}
|
---|
| 361 | +% {{{ ParameterizeIce:
|
---|
| 362 | +if perform(org,'ParameterizeIce'),
|
---|
| 363 | +
|
---|
| 364 | + loaddata(org,'MeshGeometry');
|
---|
| 365 | +
|
---|
| 366 | + %miscellaneous
|
---|
| 367 | + md.miscellaneous.name='test4004';
|
---|
| 368 | +
|
---|
| 369 | + %initial velocity:
|
---|
| 370 | + md.initialization.vx=zeros(md.mesh.numberofvertices,1);
|
---|
| 371 | + md.initialization.vy=zeros(md.mesh.numberofvertices,1);
|
---|
| 372 | + md.initialization.vz=zeros(md.mesh.numberofvertices,1);
|
---|
| 373 | +
|
---|
| 374 | + %friction:
|
---|
| 375 | + md.friction.coefficient=0*ones(md.mesh.numberofvertices,1);
|
---|
| 376 | + pos=find(md.mask.ocean_levelset>0);
|
---|
| 377 | + md.friction.coefficient(pos)=5;
|
---|
| 378 | + md.friction.p=ones(md.mesh.numberofelements,1);
|
---|
| 379 | + md.friction.q=ones(md.mesh.numberofelements,1);
|
---|
| 380 | +
|
---|
| 381 | + %temperatures and surface mass balance:
|
---|
| 382 | + md.initialization.temperature=(273.15-22)*ones(md.mesh.numberofvertices,1);
|
---|
| 383 | + md.initialization.pressure=md.materials.rho_ice*md.constants.g*(md.geometry.surface-md.geometry.base);
|
---|
| 384 | + md.smb.mass_balance = 0*ones(md.mesh.numberofvertices,1);
|
---|
| 385 | +
|
---|
| 386 | + %Flow law
|
---|
| 387 | + md.materials.rheology_B=paterson(md.initialization.temperature);
|
---|
| 388 | + md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
|
---|
| 389 | + md.damage.D=zeros(md.mesh.numberofvertices,1);
|
---|
| 390 | + md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
|
---|
| 391 | +
|
---|
| 392 | + %the spcs going
|
---|
| 393 | + md.stressbalance.spcvx=NaN*ones(md.mesh.numberofvertices,1);
|
---|
| 394 | + md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
|
---|
| 395 | + md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
|
---|
| 396 | + md.stressbalance.referential=NaN*ones(md.mesh.numberofvertices,6);
|
---|
| 397 | + md.stressbalance.loadingforce=0*ones(md.mesh.numberofvertices,3);
|
---|
| 398 | + md.masstransport.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
|
---|
| 399 | +
|
---|
| 400 | + %get some flux at the ice divide:
|
---|
| 401 | + pos=find(md.mesh.lat==min(md.mesh.lat));
|
---|
| 402 | + md.masstransport.spcthickness(pos)=md.geometry.thickness(pos);
|
---|
| 403 | + md.stressbalance.spcvy(pos)=800;
|
---|
| 404 | + md.stressbalance.spcvx(pos)=0;
|
---|
| 405 | +
|
---|
| 406 | + %deal with boundaries, excluding icefront:
|
---|
| 407 | + pos=find(md.mesh.long==min(md.mesh.long) | md.mesh.long==max(md.mesh.long));
|
---|
| 408 | + md.stressbalance.spcvx(pos)=0;
|
---|
| 409 | +
|
---|
| 410 | + point1=find(md.mesh.y==min(md.mesh.y)); point2=find(md.mesh.x==max(md.mesh.x));
|
---|
| 411 | + costheta=(md.mesh.x(point2)-md.mesh.x(point1))/sqrt((md.mesh.x(point2)-md.mesh.x(point1)).^2+(md.mesh.y(point2)-md.mesh.y(point1)).^2);
|
---|
| 412 | + sintheta=(md.mesh.y(point2)-md.mesh.y(point1))/sqrt((md.mesh.x(point2)-md.mesh.x(point1)).^2+(md.mesh.y(point2)-md.mesh.y(point1)).^2);
|
---|
| 413 | + md.stressbalance.referential(:,1:3)=repmat([costheta,sintheta,0],md.mesh.numberofvertices,1);
|
---|
| 414 | + md.stressbalance.referential(:,4:6)=repmat([-sintheta,costheta,0],md.mesh.numberofvertices,1);
|
---|
| 415 | +
|
---|
| 416 | + md.basalforcings.groundedice_melting_rate=zeros(md.mesh.numberofvertices,1);
|
---|
| 417 | + md.basalforcings.floatingice_melting_rate=zeros(md.mesh.numberofvertices,1);
|
---|
| 418 | + md.thermal.spctemperature=[md.initialization.temperature; 1]; %impose observed temperature on surface
|
---|
| 419 | + md.basalforcings.geothermalflux=.064*ones(md.mesh.numberofvertices,1);
|
---|
| 420 | +
|
---|
| 421 | + %flow equations:
|
---|
| 422 | + md=setflowequation(md,'SSA','all');
|
---|
| 423 | +
|
---|
| 424 | + savemodel(org,md);
|
---|
| 425 | +end
|
---|
| 426 | +% }}}
|
---|
| 427 | +
|
---|
| 428 | +%Run MITgcm/ISSM
|
---|
| 429 | +% {{{ RunCoupledMITgcmISSM:
|
---|
| 430 | +if perform(org,'RunCoupledMITgcmISSM'),
|
---|
| 431 | +
|
---|
| 432 | + loaddata(org,'Parameters');
|
---|
| 433 | + loaddata(org,'Bathymetry');
|
---|
| 434 | + loaddata(org,'IceSheetGeometry');
|
---|
| 435 | + loaddata(org,'ParameterizeIce');
|
---|
| 436 | +
|
---|
| 437 | + % {{{ prepare ISSM
|
---|
| 438 | + md.transient.isoceancoupling=1;
|
---|
| 439 | + md.transient.isgroundingline=0;
|
---|
| 440 | + md.transient.isthermal=0;
|
---|
| 441 | + md.groundingline.migration='SubelementMigration';
|
---|
| 442 | + md.groundingline.melt_interpolation='NoMeltOnPartiallyFloating';
|
---|
| 443 | + md.groundingline.friction_interpolation='SubelementFriction2';
|
---|
| 444 | + md.masstransport.stabilization=1;
|
---|
| 445 | + md.timestepping.coupling_time=1/24/365/100; % 1/100 hour in decimal years
|
---|
| 446 | + md.timestepping.time_step=1/24/365/100; % 1/100 hour in decimal years
|
---|
| 447 | + md.timestepping.final_time=23/24/365; % hour 23 in decimal years
|
---|
| 448 | + md.cluster=generic('name',oshostname(),'np',2);
|
---|
| 449 | + md.cluster.npocean=nPx*nPy;
|
---|
| 450 | + md.cluster.np=2;
|
---|
| 451 | + md.cluster.executionpath=[pwd '/run'];
|
---|
| 452 | + md.transient.requested_outputs={'default','MaskOceanLevelset'};
|
---|
| 453 | + md.masstransport.requested_outputs={'default','BasalforcingsFloatingiceMeltingRate'};
|
---|
| 454 | + % }}}
|
---|
| 455 | + % {{{ prepare MITgcm
|
---|
| 456 | + % rename previous run directory and create new one
|
---|
| 457 | + if exist ('run.old')
|
---|
| 458 | + !\rm -rf run.old
|
---|
| 459 | + end
|
---|
| 460 | + if exist ('run')
|
---|
| 461 | + !\mv run run.old
|
---|
| 462 | + end
|
---|
| 463 | + !\mkdir run
|
---|
| 464 | + !\cp ../MITgcm/build/mitgcmuv run
|
---|
| 465 | + !\cp ../MITgcm/input_4003/* run
|
---|
| 466 | +
|
---|
| 467 | + % {{{ Construct MITgcm binary input files
|
---|
| 468 | + namF='run/bathy_flat.bin';
|
---|
| 469 | + fid=fopen(namF,'w','b'); fwrite(fid,bathymetry,prec);fclose(fid);
|
---|
| 470 | +
|
---|
| 471 | + namF='run/shelficeTopo.Lin.bin';
|
---|
| 472 | + fid=fopen(namF,'w','b'); fwrite(fid,draft,prec);fclose(fid);
|
---|
| 473 | +
|
---|
| 474 | + del_T = (T_bot - T_sfc)/(59*delZ);
|
---|
| 475 | + tref=zeros(1,Nz);
|
---|
| 476 | + for k = 1:Nz;
|
---|
| 477 | + tref(k) = T_sfc + del_T*((k-20)*delZ);
|
---|
| 478 | + tref(k)= max(T_sfc,min(tref(k),T_bot));
|
---|
| 479 | + end
|
---|
| 480 | + namF='run/temp_obc.bin';
|
---|
| 481 | + tref=[tref; tref; tref];
|
---|
| 482 | + fid=fopen(namF,'w','b'); fwrite(fid,tref,prec);fclose(fid);
|
---|
| 483 | +
|
---|
| 484 | + del_S = (S_bot - S_sfc)/(59*delZ);
|
---|
| 485 | + sref=zeros(1,Nz);
|
---|
| 486 | + for k = 1:Nz;
|
---|
| 487 | + sref(k) = S_sfc + del_S*((k-20)*delZ);
|
---|
| 488 | + sref(k)= max(S_sfc,min(sref(k),S_bot));
|
---|
| 489 | + end
|
---|
| 490 | + namF='run/salt_obc.bin';
|
---|
| 491 | + sref=[sref; sref; sref];
|
---|
| 492 | + fid=fopen(namF,'w','b'); fwrite(fid,sref,prec);fclose(fid);
|
---|
| 493 | +
|
---|
| 494 | + zax=[1:Nz];
|
---|
| 495 | + v1=2.5e-2;
|
---|
| 496 | + var=1+Nz-2*zax; var=var/(Nz-1);
|
---|
| 497 | + vobc=v1*var;
|
---|
| 498 | + namF='run/vVel_obc.bin';
|
---|
| 499 | + vobc=[vobc; vobc; vobc];
|
---|
| 500 | + fid=fopen(namF,'w','b'); fwrite(fid,vobc,prec);fclose(fid);
|
---|
| 501 | +
|
---|
| 502 | + var=zeros(Nx,Ny,Nz);
|
---|
| 503 | + for i=1:Nx, for j=1:Ny
|
---|
| 504 | + var(i,j,:)=tref(1,:);
|
---|
| 505 | + end, end
|
---|
| 506 | + namF='run/temp_ini.bin';
|
---|
| 507 | + fid=fopen(namF,'w','b'); fwrite(fid,var,prec);fclose(fid);
|
---|
| 508 | +
|
---|
| 509 | + for i=1:Nx, for j=1:Ny
|
---|
| 510 | + var(i,j,:)=sref(1,:);
|
---|
| 511 | + end, end
|
---|
| 512 | + namF='run/salt_ini.bin';
|
---|
| 513 | + fid=fopen(namF,'w','b'); fwrite(fid,var,prec);fclose(fid);
|
---|
| 514 | + % }}}
|
---|
| 515 | + % }}}
|
---|
| 516 | +
|
---|
| 517 | + md=solveiceocean(md,'Transient','runtimename',false);
|
---|
| 518 | +
|
---|
| 519 | + savemodel(org,md);
|
---|
| 520 | +
|
---|
| 521 | + plotmodel(md,'data',md.results.TransientSolution(end).Vel,'data',md.results.TransientSolution(end).Thickness)
|
---|
| 522 | +
|
---|
| 523 | +%eval(['!mpiexec -np ' int2str(md.cluster.np) ' ' md.cluster.codepath '/issm_ocean.exe TransientSolution ' pwd ' ' md.miscellaneous.name ' ']);
|
---|
| 524 | +%eval(['!mpiexec -np ' int2str(md.cluster.np) ' ' md.cluster.codepath '/issm_ocean.exe TransientSolution ' pwd ' ' md.miscellaneous.name ' : -np ' int2str(nPx*nPy) ' ./mitgcmuv']);
|
---|
| 525 | +end
|
---|
| 526 | +% }}}
|
---|