/[MITgcm]/MITgcm/verification/internal_wave/input/gendata.m
ViewVC logotype

Annotation of /MITgcm/verification/internal_wave/input/gendata.m

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


Revision 1.1 - (hide annotations) (download)
Thu Jun 29 19:29:04 2000 UTC (23 years, 10 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint47e_post, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, release1_p13_pre, checkpoint50c_post, checkpoint46f_post, checkpoint48e_post, checkpoint50c_pre, checkpoint44f_post, checkpoint46b_post, checkpoint43a-release1mods, release1_p13, checkpoint40pre3, checkpoint40pre1, checkpoint40pre7, checkpoint40pre6, checkpoint48i_post, checkpoint40pre9, checkpoint40pre8, checkpoint46l_pre, checkpoint50d_pre, chkpt44d_post, checkpoint50, release1_p8, release1_p9, checkpoint50d_post, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint50b_pre, checkpoint44e_pre, release1_b1, checkpoint48b_post, checkpoint43, checkpoint48c_pre, checkpoint47d_pre, checkpoint38, release1_chkpt44d_post, checkpoint47a_post, checkpoint48d_pre, checkpoint47i_post, branch-atmos-merge-shapiro, checkpoint47d_post, checkpoint46d_pre, checkpoint40pre2, checkpoint48d_post, release1-branch_tutorials, checkpoint48f_post, checkpoint45d_post, checkpoint46j_pre, chkpt44a_post, checkpoint44h_pre, checkpoint48h_post, checkpoint40pre4, checkpoint46a_post, checkpoint47g_post, checkpoint46j_post, checkpoint46k_post, checkpoint46b_pre, chkpt44c_pre, checkpoint48a_post, checkpoint45a_post, checkpoint50a_post, branch-atmos-merge-freeze, branch-atmos-merge-start, checkpoint44e_post, release1_p12, release1_p10, release1_p11, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint47j_post, pre38tag1, branch-exfmods-tag, checkpoint44g_post, checkpoint46e_pre, checkpoint48c_post, checkpoint45b_post, release1-branch-end, c37_adj, release1_final_v1, checkpoint46c_pre, checkpoint46, checkpoint47b_post, checkpoint44b_post, checkpoint46h_pre, checkpoint46m_post, checkpoint46a_pre, checkpoint45c_post, checkpoint44h_post, pre38-close, checkpoint46g_post, release1_p12_pre, checkpoint39, checkpoint33, checkpoint32, checkpoint31, checkpoint30, checkpoint37, checkpoint36, checkpoint35, checkpoint34, checkpoint50e_pre, checkpoint40pre5, checkpoint47f_post, checkpoint50e_post, chkpt44a_pre, checkpoint46i_post, checkpoint46c_post, branch-atmos-merge-zonalfilt, checkpoint46e_post, release1_beta1, checkpoint44b_pre, checkpoint42, checkpoint40, checkpoint41, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint46h_post, chkpt44c_post, checkpoint47h_post, checkpoint44f_pre, branch-atmos-merge-phase5, branch-atmos-merge-phase4, branch-atmos-merge-phase7, branch-atmos-merge-phase6, branch-atmos-merge-phase1, branch-atmos-merge-phase3, branch-atmos-merge-phase2, checkpoint46d_post, checkpoint50b_post, release1-branch_branchpoint, checkpoint48g_post
Branch point for: branch-exfmods-curt, release1_final, release1-branch, release1, release1_50yr, branch-atmos-merge, pre38, release1_coupled
Added new example for testing OBCs.

1 adcroft 1.1 % This is a matlab script that generates the input data
2     % variable x resolution
3     prec='real*8';
4     ieee='b';
5    
6    
7     % Dimensions of grid
8     nx=60;
9     ny=3;
10     nz=20;
11     % Nominal depth of model (meters)
12     H=200.0;
13     % Size of domain
14     Lx=13.3e3;
15    
16     % Horizontal resolution (m)
17     dx=zeros(nx,1);
18     for i=1:nx
19     dx(i) = Lx/(nx+1);
20     end
21    
22     dy = Lx/nx
23     % Stratification
24     gravity=9.81;
25     talpha=2.0e-4;
26     N2=1e-6;
27    
28     Tz=N2/(gravity*talpha);
29    
30     dz=H/nz;
31     sprintf('delZ = %d * %7.6g,',nz,dz)
32    
33     x=zeros(nx,1);
34     x(1) = dx(1);
35     for i=2:nx
36     x(i)=x(i-1) + dx(i);
37     end
38     z=-dz/2:-dz:-H;
39    
40     %[Y,X]=meshgrid(y,x);
41    
42     % Temperature profile
43     Tref=Tz*z-mean(Tz*z);
44     [sprintf('Tref =') sprintf(' %8.6g,',Tref)]
45     t=0.0*rand([nx,ny,nz]);
46     for k=1:nz
47     t(:,:,k) = t(:,:,k) + Tref(k);
48     end
49     fid=fopen('T.init','w',ieee); fwrite(fid,t,prec); fclose(fid);
50    
51     % Sloping channel
52     slope=0.0
53     offset=2.5e3;
54     dmax=-40.0;
55     d=0.0*rand([nx,ny]);
56     for i=1:nx
57     for j=1:ny
58     d(i,j) = -H;
59     d(i,j) = d(i,j) + slope*(x(i) - offset);
60     if d(i,j) < -H ;
61     d(i,j) = -H;
62     end
63     if d(i,j) > dmax;
64     d(i,j) = dmax;
65     end
66     end
67     end
68     %d(nx,:)=0.0;
69     fid=fopen('topog.slope','w',ieee); fwrite(fid,d,prec); fclose(fid);
70     plot(x,d(:,2))
71    
72     fid=fopen('delXvar','w',ieee); fwrite(fid,dx,prec); fclose(fid);
73    
74     %convex slope
75     nxslope=(dmax + H)/(slope)
76     d1=zeros(nx,ny);
77     hamp=(H-dmax)/5.0
78     pi=4.0*atan(1.0)
79     for i=1:nx
80     for j=1:ny
81     if x(i) < (offset + nxslope)
82     if x(i) < offset
83     d1(i,j) = d(i,j);
84     else
85     d1(i,j) = -H;
86     d1(i,j) = d(i,j) + hamp*sin(pi*(x(i)-offset)/nxslope);
87     if d1(i,j) < -H ;
88     d1(i,j) = -H;
89     end
90     if d1(i,j) > dmax;
91     d1(i,j) = dmax;
92     end
93     end
94     else
95     d1(i,j) = d(i,j);
96     end
97     end
98     end
99     %d1(end-1:end,:)=d1(1:2,:); % debug by aja
100     fid=fopen('topog.convex','w',ieee); fwrite(fid,d1,prec); fclose(fid);
101     hold on
102     plot(x,d1(:,2),'g')
103    
104     %convex slope
105     d2=zeros(nx,ny);
106     for i=1:nx
107     for j=1:ny
108     if x(i) < (offset + nxslope)
109     if x(i) < offset
110     d2(i,j) = d(i,j);
111     else
112     d2(i,j) = -H;
113     d2(i,j) = d(i,j) - hamp*sin(pi*(x(i)-offset)/nxslope);
114     if d2(i,j) < -H ;
115     d2(i,j) = -H;
116     end
117     if d2(i,j) > dmax;
118     d2(i,j) = dmax;
119     end
120     end
121     else
122     d2(i,j) = d(i,j);
123     end
124     end
125     end
126     %d2(end-1:end,:)=d2(1:2,:); % debug by aja
127     fid=fopen('topog.concave','w',ieee); fwrite(fid,d2,prec); fclose(fid);
128     hold on
129     plot(x,d2(:,2),'r')
130    
131    
132     fid=fopen('delXvar','w',ieee); fwrite(fid,dx,prec); fclose(fid);

  ViewVC Help
Powered by ViewVC 1.1.22