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

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

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


Revision 1.2 - (show annotations) (download)
Thu May 22 19:59:28 2003 UTC (17 years, 2 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint57m_post, checkpoint52l_pre, checkpoint57g_pre, checkpoint57s_post, checkpoint58b_post, checkpoint57b_post, checkpoint57g_post, checkpoint56b_post, checkpoint57y_post, checkpoint52j_pre, checkpoint51o_pre, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint54d_post, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint54e_post, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62c, checkpoint51l_post, checkpoint57r_post, checkpoint57d_post, checkpoint57i_post, checkpoint52k_post, checkpoint59, checkpoint58, checkpoint55, checkpoint54, checkpoint57, checkpoint56, checkpoint51, checkpoint53, checkpoint52, checkpoint58f_post, checkpoint52f_post, checkpoint58d_post, checkpoint58a_post, checkpoint57z_post, checkpoint54f_post, checkpoint51f_post, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint58y_post, checkpoint51d_post, checkpoint51t_post, checkpoint58t_post, checkpoint51n_post, checkpoint55i_post, checkpoint58m_post, checkpoint57l_post, checkpoint52i_pre, checkpoint51s_post, checkpoint57t_post, checkpoint55c_post, checkpoint51j_post, checkpoint52e_pre, checkpoint57v_post, checkpoint57f_post, checkpoint52e_post, checkpoint51n_pre, checkpoint53d_post, checkpoint64, checkpoint65, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint57a_post, checkpoint57h_pre, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint52b_pre, checkpoint54b_post, checkpoint58w_post, checkpoint57h_post, checkpoint51l_pre, checkpoint52m_post, checkpoint57y_pre, checkpoint55g_post, checkpoint51q_post, checkpoint51b_pre, checkpoint52b_post, checkpoint52c_post, checkpoint51h_pre, checkpoint58o_post, checkpoint57c_post, checkpoint50f_post, checkpoint50f_pre, checkpoint58p_post, checkpoint58q_post, checkpoint52f_pre, checkpoint55d_post, checkpoint58e_post, checkpoint54a_pre, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint53c_post, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint55d_pre, checkpoint57c_pre, checkpoint58r_post, checkpoint55j_post, branchpoint-genmake2, checkpoint54a_post, checkpoint55h_post, checkpoint58n_post, checkpoint51r_post, checkpoint51i_post, checkpoint57e_post, checkpoint55b_post, checkpoint51b_post, checkpoint51c_post, checkpoint53a_post, checkpoint65o, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint55f_post, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint52d_post, checkpoint53g_post, checkpoint57p_post, checkpint57u_post, checkpoint50g_post, checkpoint57q_post, eckpoint57e_pre, checkpoint58k_post, checkpoint52a_pre, checkpoint62b, checkpoint58v_post, checkpoint50h_post, checkpoint52i_post, checkpoint50i_post, checkpoint51i_pre, checkpoint52h_pre, checkpoint56a_post, checkpoint64y, checkpoint64x, checkpoint58l_post, checkpoint64z, checkpoint53f_post, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint57h_done, checkpoint52j_post, checkpoint57j_post, checkpoint57f_pre, checkpoint61f, checkpoint58g_post, branch-netcdf, checkpoint52l_post, checkpoint58x_post, checkpoint61n, checkpoint52n_post, checkpoint53b_pre, checkpoint58h_post, checkpoint56c_post, checkpoint58j_post, checkpoint51e_post, checkpoint57a_pre, checkpoint55a_post, checkpoint57o_post, checkpoint51o_post, checkpoint61q, checkpoint57k_post, checkpoint51f_pre, checkpoint61z, checkpoint53b_post, checkpoint52a_post, checkpoint57w_post, checkpoint61e, checkpoint58i_post, checkpoint51g_post, ecco_c52_e35, checkpoint57x_post, checkpoint58c_post, checkpoint58u_post, checkpoint51m_post, checkpoint53d_pre, checkpoint58s_post, checkpoint55e_post, checkpoint61g, checkpoint61d, checkpoint54c_post, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint51a_post, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint51p_post, checkpoint61x, checkpoint61y, checkpoint51u_post, HEAD
Branch point for: branch-genmake2, branch-nonh, tg2-branch, netcdf-sm0, checkpoint51n_branch
Changes since 1.1: +7 -7 lines
Made several changes to improve utility in testscript and relevence in general.
 o switched from sNy=3 to sNy=1 (did not change numerical results)
 o activated slope (gendata.m had code but slope was set to zero)
 o switched from linear FS to non-linear FS
 o switch to Crank-Nicholson time-stepping for FS
 o increased time-step by factor of 50 (so that expt does something during test)
 o turned off salt stepping
 o re-generated results/output.txt

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=1;
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.03
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(:,1))
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 plot(x,d1(:,1),'g')
102
103 %convex slope
104 d2=zeros(nx,ny);
105 for i=1:nx
106 for j=1:ny
107 if x(i) < (offset + nxslope)
108 if x(i) < offset
109 d2(i,j) = d(i,j);
110 else
111 d2(i,j) = -H;
112 d2(i,j) = d(i,j) - hamp*sin(pi*(x(i)-offset)/nxslope);
113 if d2(i,j) < -H ;
114 d2(i,j) = -H;
115 end
116 if d2(i,j) > dmax;
117 d2(i,j) = dmax;
118 end
119 end
120 else
121 d2(i,j) = d(i,j);
122 end
123 end
124 end
125 %d2(end-1:end,:)=d2(1:2,:); % debug by aja
126 fid=fopen('topog.concave','w',ieee); fwrite(fid,d2,prec); fclose(fid);
127 hold on
128 plot(x,d2(:,1),'r')
129 hold off
130
131
132 fid=fopen('delXvar','w',ieee); fwrite(fid,dx,prec); fclose(fid);

  ViewVC Help
Powered by ViewVC 1.1.22