/[MITgcm]/MITgcm_contrib/climode_work_with_jj/3d_gendata/gendata.m
ViewVC logotype

Annotation of /MITgcm_contrib/climode_work_with_jj/3d_gendata/gendata.m

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


Revision 1.1 - (hide annotations) (download)
Mon Aug 2 17:42:09 2004 UTC (20 years, 11 months ago) by cnh
Branch: MAIN
CVS Tags: HEAD
Saving files that create 3d initial temp and altered data which reads 3d temp

1 cnh 1.1 % This is a matlab script that generates the input data
2    
3     % Dimensions of grid
4     nx=80;
5     ny=42;
6     nz=8;
7     % Nominal depth of model (meters)
8     H=4500;
9     % Scale of bump (m)
10     L=25e3;
11     % Height of bump (m)
12     dh=0.90*H;
13     % Horizontal resolution (m)
14     dx=5e3;
15     % Rotation
16     f=1e-4;
17     % Stratification
18     N=1.5 * f*L/H;
19    
20     % Gravity
21     g=9.81;
22     % E.O.S.
23     alpha=2.e-4;
24    
25     Tz=N^2/(g*alpha)
26    
27     dz=H/nz;
28     sprintf('delZ = %d * %7.6g,',nz,dz)
29    
30     x=(1:nx)*dx;x=x-mean(x);
31     y=(1:ny)*dx;y=y-mean(y);
32     z=-dz/2:-dz:-H;
33    
34     [Y,X]=meshgrid(y,x);
35    
36     % Temperature profile
37     phi=sprintf(' %8.6g',Tz*z-mean(Tz*z));
38     Tref=str2num(phi);
39     [sprintf('Tref =') sprintf(' %8.6g,',Tz*z-mean(Tz*z))]
40    
41     ieee='b';
42     accuracy='real*8';
43    
44     % Create three dimensional temperature profile
45     t3d=zeros(nx,ny,nz);
46     for k=1:nz
47     t3d(:,:,k)=Tref(k);
48     end
49     fid=fopen('theta.bin','w',ieee); fwrite(fid,t3d,accuracy); fclose(fid);
50    
51     % Gaussian bump
52     h=-H+dh*exp( -(X.^2+Y.^2)/(2*(L^2)) );
53     fid=fopen('topog.bump','w',ieee); fwrite(fid,h,accuracy); fclose(fid);
54    
55     % Side walls + bump
56     h(:,1)=0;
57     h(:,ny)=0;
58     fid=fopen('topog.bumpchannel','w',ieee); fwrite(fid,h,accuracy); fclose(fid);
59    
60     % Simple channel
61     h(:,1)=0;
62     h(:,2:ny-1)=-H;
63     h(:,ny)=0;
64     fid=fopen('topog.channel','w',ieee); fwrite(fid,h,accuracy); fclose(fid);

  ViewVC Help
Powered by ViewVC 1.1.22