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

Annotation of /MITgcm_contrib/icefront/2D_example/input/genibcao.m

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


Revision 1.1 - (hide annotations) (download)
Mon Mar 19 23:43:55 2012 UTC (13 years, 4 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 yunx 1.1 % This is a matlab script that generates the input data
2     % variable x resolution
3    
4     % Initialize...
5     clear
6     if 0
7     load IBCAO_2km.mat
8     LON=LON-90;
9     aaa=find(LON>180);
10     LON(aaa)=LON(aaa)-360;
11     XC=[2:1451];YC=[1451:2900];
12     LON=LON(XC,YC);
13     LAT=LAT(XC,YC);
14     IBCAO=IBCAO(XC,YC);
15     end
16    
17     prec='real*8';
18     ieee='b';
19    
20     % Dimensions of grid
21     nx=200;
22     ny=1;
23     nz=100;
24     % Nominal depth of model (meters)
25     H=500.0;
26    
27     % Horizontal resolution (m)
28     % dx
29     iswitch=80;
30     dx=zeros(nx,1);
31     for i=1:nx
32     dx(i) = 35 + 16*tanh((iswitch-i)/50);
33     xG(i)=sum(dx(1:i));
34     end
35     Lx=sum(dx(:))
36     sum(dx(51:end))
37     plot(dx)
38     %dy = Lx/nx
39     writebin('dx.bin',dx,1,prec);
40    
41    
42     break
43     % dlon
44     re = 6378137.0d0;
45     slat=70.4;
46     dlon2dx=re*2*pi*cosd(slat)/360;
47     dx2dlon=1./dlon2dx;
48     dlon=zeros(nx,1);
49     lonG=zeros(nx+1,1);
50     lonC=zeros(nx,1);
51     lonG(nx+1)=-50.6;
52     for i=nx:-1:1
53     dlon(i)=dx(i).*dx2dlon;
54     lonG(i)=lonG(i+1)-dlon(i);
55     lonC(i)=0.5*lonG(i+1)+0.5*lonG(i);
56     end
57     latC(1)=70.42;
58     dlat=dlon./8;
59     for i=1:nx-1
60     latC(i+1)=latC(i)-dlat(i);
61     end
62     latC=latC';
63     Llon=sum(dlon(:));
64     writebin('dlon.bin',dlon,1,prec);
65     break
66     % Interpolate bathymetry to my gridC
67     %[tri,w]=interp_TS(lonC,latC,LON,LAT);
68     % z = IBCAO(:).';
69     % ibcao_store_2d = sum(z(tri) .* w,2);
70     % ibcao_store_2d(nx)=0.0;
71     % writebin('bathy_store_2D.ibcao',ibcao_jks_2d,1,prec);
72     bathy=-500*ones(200,1);
73     bathy(nx)=0;
74     writebin('bathy_store_2D.500',bathy,1,prec);
75    
76     % ICEFRONT depth and circum files
77     frontdepth=zeros(nx,ny);
78     frontdepth(nx-1)=bathy(nx-1);
79     frontlength=zeros(nx,ny);
80     frontlength(nx-1)=1./dx(nx-1);
81     writebin('frontdepth.bin',frontdepth,1,prec);
82     writebin('frontlength.bin',frontlength,1,prec);
83    

  ViewVC Help
Powered by ViewVC 1.1.22