/[MITgcm]/MITgcm_contrib/icefront/2D_example/input/gendata.m
ViewVC logotype

Contents of /MITgcm_contrib/icefront/2D_example/input/gendata.m

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


Revision 1.1 - (show annotations) (download)
Mon Mar 19 23:43:55 2012 UTC (13 years, 3 months ago) by yunx
Branch: MAIN
CVS Tags: HEAD
Checking in an example 2D (x-z) tidewater glacier configuration
of pkg/icefront with subglacial runoff.

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=200;
8 ny=1;
9 nz=100;
10 deltaZ = 5;
11
12 eos = 'jmd95z';
13
14 acc = 'real*8';
15
16 % Nominal depth of model (meters)
17 H = -500;
18
19 bathy = ones(nx,ny)*H;
20 % bathy(end,:) = 0;
21 % fid=fopen('bathy.box','w','b'); fwrite(fid,bathy,acc);fclose(fid);
22
23 dz = deltaZ*ones(1,nz);
24 zgp1 = [0,cumsum(dz)];
25 zc = .5*(zgp1(1:end-1)+zgp1(2:end));
26 zg = zgp1(1:end-1);
27 dz = diff(zgp1);
28 sprintf('delZ = %d * %7.6g,',nz,dz)
29
30 % Gravity
31 gravity=9.81;
32 rhoConst = 1030;
33 % compute potential field underneath ice shelf
34 talpha = 2e-4;
35 sbeta = 7.4e-4;
36 tref = -1.9*ones(nz,1);
37 t = tref;
38 sref = 34*ones(nz,1);
39 s = sref;
40 gravity = 9.81;
41 k=1;
42 dzm = abs([zg(1)-zc(1) .5*diff(zc)]);
43 dzp = abs([.5*diff(zc) zc(end)-zg(end)]);
44 p = abs(zc)*gravity*rhoConst*1e-4;
45 dp = p;
46 kp = 0;
47 while std(dp) > 1e-13
48 phiHydF(k) = 0;
49 p0 = p;
50 kp = kp+1
51 for k = 1:nz
52 switch eos
53 case 'linear'
54 drho = rhoConst*(1-talpha*(t(k)-tref(k))+sbeta*(s(k)-sref(k)))-rhoConst;
55 case 'jmd95z'
56 drho = densjmd95(s(k),t(k),p(k))-rhoConst;
57 case 'mdjwf'
58 drho = densmdjwf(s(k),t(k),p(k))-rhoConst;
59 otherwise
60 error(sprintf('unknown EOS: %s',eos))
61 end
62 phiHydC(k) = phiHydF(k) + dzm(k)*gravity*drho/rhoConst;
63 phiHydF(k+1) = phiHydC(k) + dzp(k)*gravity*drho/rhoConst;
64 end
65 switch eos
66 case 'mdjwf'
67 p = (gravity*rhoConst*abs(zc) + phiHydC*rhoConst)/gravity/rhoConst;
68 end
69 dp = p-p0;
70 end
71
72 icetopo = zeros(nx,ny);
73 icetopo(end,:) = -495;
74 fid=fopen('icetopo.exp1','w','b'); fwrite(fid,icetopo,acc);fclose(fid);
75 fid=fopen('pload.exp1','w','b'); fwrite(fid,-icetopo,acc);fclose(fid);
76 phi0surf = zeros(nx,ny);
77 for ix=1:nx
78 for iy=1:ny
79 k=max(find(abs(zg)<abs(icetopo(ix,iy))));
80 if isempty(k)
81 k=0;
82 end
83 if k>0
84 phi0surf(ix,iy) = phiHydF(k)*rhoConst;
85 end
86 end
87 end
88 fid=fopen(['phi0surf.exp1.' eos],'w','b'); fwrite(fid,phi0surf,acc);fclose(fid);
89

  ViewVC Help
Powered by ViewVC 1.1.22