/[MITgcm]/MITgcm/verification/isomip/input.icefront/gendata.m
ViewVC logotype

Contents of /MITgcm/verification/isomip/input.icefront/gendata.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Fri Apr 27 09:02:11 2012 UTC (12 years ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64o, checkpoint64a, checkpoint63r, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint64n, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint64b, checkpoint63m, checkpoint64e, checkpoint63q, checkpoint64d, checkpoint64c, checkpoint64g, checkpoint64f, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint63n, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint64i, checkpoint63o, checkpoint63p, checkpoint64h, checkpoint63s, checkpoint64k, checkpoint64, checkpoint65, checkpoint64j, checkpoint64m, checkpoint64l, HEAD
Changes since 1.1: +3 -3 lines
read mds hFacC.*.data instead HFacC from grid.*.nc

1 % This is a matlab script that generates the input data
2
3 % the configuation approximately the ISOMIP experiment no. 1
4 % require matlab functions for equation of state
5
6 % Dimensions of grid
7 nx=50; nxi=20;
8 ny=100; nyi=[51:100];
9 nz=30;
10 deltaZ = 30;
11
12 dlat = 0.1; dy=6.4e6*dlat./pi;
13 dlon = 0.3; dx=dlon;
14
15 %eos = 'linear';
16 eos = 'jmd95z';
17 %eos = 'mdjwf';
18
19 acc = 'real*8';
20
21 long = [0:dlon:10-dlon];
22 lonc = long+dlon/2;
23 latg = [-80:dlat:-70-dlat];
24 latc = latg+dlat/2;
25
26 % Nominal depth of model (meters)
27 H = -900;
28 Hmin = -700; % deepest point of cavern
29 Hmax = -200; % shallowest point of cavern
30 dHdx = (Hmax-Hmin)/4;
31
32 bathy = ones(nx,ny)*H;
33 bathy(1,:) = 0;
34 bathy(:,1) = 0;
35 %fid=fopen('bathy.box','w','b'); fwrite(fid,bathy,acc);fclose(fid);
36
37
38 dz = deltaZ*ones(1,nz);
39 zgp1 = [0,cumsum(dz)];
40 zc = .5*(zgp1(1:end-1)+zgp1(2:end));
41 zg = zgp1(1:end-1);
42 dz = diff(zgp1);
43 sprintf('delZ = %d * %7.6g,',nz,dz)
44
45 % Gravity
46 gravity=9.81;
47 rhoConst = 1030;
48 % compute potential field underneath ice shelf
49 talpha = 2e-4;
50 sbeta = 7.4e-4;
51 tref = -1.9*ones(nz,1);
52 t = tref;
53 sref = 34.4*ones(nz,1);
54 s = sref;
55 gravity = 9.81;
56 k=1;
57 dzm = abs([zg(1)-zc(1) .5*diff(zc)]);
58 dzp = abs([.5*diff(zc) zc(end)-zg(end)]);
59 p = abs(zc)*gravity*rhoConst*1e-4;
60 dp = p;
61 kp = 0;
62 while std(dp) > 1e-13
63 phiHydF(k) = 0;
64 p0 = p;
65 kp = kp+1
66 for k = 1:nz
67 switch eos
68 case 'linear'
69 drho = rhoConst*(1-talpha*(t(k)-tref(k))+sbeta*(s(k)-sref(k)))-rhoConst;
70 case 'jmd95z'
71 drho = densjmd95(s(k),t(k),p(k))-rhoConst;
72 case 'mdjwf'
73 drho = densmdjwf(s(k),t(k),p(k))-rhoConst;
74 otherwise
75 error(sprintf('unknown EOS: %s',eos))
76 end
77 phiHydC(k) = phiHydF(k) + dzm(k)*gravity*drho/rhoConst;
78 phiHydF(k+1) = phiHydC(k) + dzp(k)*gravity*drho/rhoConst;
79 end
80 switch eos
81 case 'mdjwf'
82 p = (gravity*rhoConst*abs(zc) + phiHydC*rhoConst)/gravity/rhoConst;
83 end
84 dp = p-p0;
85 end
86
87 icetopo = ones(nx,1)*min(Hmax,Hmin + dHdx*(latc-latg(1)));
88 icetopo(:,nyi)=0;
89 fid=fopen('icetopo.exp1','w','b'); fwrite(fid,icetopo,acc);fclose(fid);
90 frontdepth=zeros(nx,ny);frontdepth(:,nyi(1))=-icetopo(:,nyi(1)-1);
91 fid=fopen('frontdepth.xuyun','w','b'); fwrite(fid,frontdepth,acc);fclose(fid);
92 frontcircum=zeros(nx,ny);
93 frontcircum(:,nyi(1))=deltaZ./dy;
94 fid=fopen('frontcircum.xuyun','w','b'); fwrite(fid,frontcircum,acc);fclose(fid);
95
96 % After modifying the code in calc_phi_hyd.F on Apr26,2012 this is the
97 % consistent way of computing phi0surf. For this, we need the grid
98 % information (hFacC's). For convenience, it's taken from a previous model
99 % run.
100 %
101 % The way of computing phi0surf consistent with code prior to Apr26,2012
102 % is recovered by setting drloc*dphi=0
103 hf=rdmds('../tr_run.icefront/hFacC');
104 msk=sum(hf,3); msk(msk>0)=1;
105 phi0surf = zeros(nx,ny);
106 for ix=1:nx
107 for iy=1:ny
108 k=max(find(abs(zg)<abs(icetopo(ix,iy))));
109 if isempty(k)
110 k=0;
111 end
112 if k>0
113 kp1=min(k+1,nz);
114 drloc=1-hf(ix,iy,k);
115 %drloc=(abs(icetopo(ix,iy))-abs(zg(k)))/dz(k);
116 dphi = phiHydF(kp1)-phiHydF(k);
117 phi0surf(ix,iy) = (phiHydF(k)+drloc*dphi)*rhoConst*msk(ix,iy);
118 end
119 end
120 end
121 fid=fopen(['phi0surf.exp1.' eos],'w','b'); fwrite(fid,phi0surf,acc);fclose(fid);
122

  ViewVC Help
Powered by ViewVC 1.1.22