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

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

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


Revision 1.1 - (show annotations) (download)
Thu Apr 20 16:45:12 2006 UTC (18 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint58l_post, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint58e_post, checkpoint58u_post, checkpoint58w_post, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint58r_post, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint58n_post, checkpoint58x_post, checkpoint58t_post, checkpoint58h_post, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint58q_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint58j_post, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint59, checkpoint58f_post, checkpoint58d_post, checkpoint58i_post, checkpoint58g_post, checkpoint58o_post, checkpoint62c, checkpoint62b, 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, checkpoint58k_post, checkpoint58v_post, checkpoint58s_post, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint58p_post, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y, checkpoint58m_post, HEAD
tutorial_plume_on_slope : copied from "verification/plume_on_slope"

1 % This is a matlab script that generates the input data
2 % variable x resolution
3
4 prec='real*8';
5 ieee='b';
6
7 % Dimensions of grid
8 %nx=80;
9 nx=320;
10 ny=1;
11 nz=60;
12 % Nominal depth of model (meters)
13 H=200.0;
14 % Size of domain
15 Lx=6.40e3;
16
17 % Horizontal resolution (m)
18 %Variable resolution
19 res1=2*Lx/(3*nx);
20 L1=Lx/2;
21 L2=Lx - L1;
22 n2=nx - (L1/res1);
23 res2=L2/n2;
24 A=res2 - res1;
25 iswitch1=L1/res1;
26 width=40;
27 dx=zeros(nx,1);
28 for i=1:nx
29 dx(i) = res1 + 0.5*A*( tanh( (i-iswitch1)/width) + 1);
30 %dx(i) = Lx/nx;
31 end
32
33 dy = Lx/nx
34
35 % Flux
36 Qo=200;
37
38 % Stratification
39 gravity=9.81;
40 talpha=2.0e-4;
41 N2=0.0;
42 Tz=N2/(gravity*talpha);
43
44 dz=H/nz;
45 sprintf('delZ = %d * %7.6g,',nz,dz)
46
47 x=zeros(nx,1);
48 x(1) = dx(1);
49 for i=2:nx
50 x(i)=x(i-1) + dx(i);
51 end
52 z=-dz/2:-dz:-H;
53
54 %Tanh function for cooling
55 xswitch = 2.50e3 + Lx/2.0;
56 qwidth = 0.1e3;
57 Q=0.0*rand([nx,ny]);
58 for i=1:nx
59 Q(i,:) = Q(i,:) + Qo*0.5*(tanh((Lx-x(i)-xswitch)/qwidth) + 1);
60 %Q(i,:) = Q(i,:) + Qo*0.5*(tanh((x(i)-xswitch)/qwidth) + 1);
61 end
62 fid=fopen('Qnet.forcing','w',ieee); fwrite(fid,Q,prec); fclose(fid);
63
64 % Temperature profile
65 Tref=Tz*z-mean(Tz*z);
66 [sprintf('Tref =') sprintf(' %8.6g,',Tref)]
67 %t = 0.25*rand([nx,ny,nz]);
68 t=0.01*rand([nx,ny,nz]);
69 for k=1:nz
70 t(:,:,k) = t(:,:,k) + Tref(k);
71 end
72 fid=fopen('T.init','w',ieee); fwrite(fid,t,prec); fclose(fid);
73
74 % Sloping channel
75 % tanh function for slope
76 slope=0.15
77 offset=1.5e3 + Lx/2.0;
78 dmax=-40.0;
79 h1=dmax;
80 h2=-H;
81 hdiff=(h1-h2);
82 xwidth=hdiff/(2.0*slope);
83 d=0.0*rand([nx,ny]);
84 for i=1:nx
85 for j=1:ny
86 %d(i,j) = hdiff/2*( exp((x(i)-offset)/xwidth) - exp(-(x(i)-offset)/xwidth))/ ( exp((x(i)-offset)/xwidth) + exp(-(x(i)-offset)/xwidth)) + hdiff/2 -H;
87 d(i,j) = hdiff/2*(tanh((Lx-x(i)-offset)/xwidth) + 1) - H;
88 end
89 end
90 d(1,:)=0.0;
91 fid=fopen('topog.slope','w',ieee); fwrite(fid,d,prec); fclose(fid);
92 plot(x,d(:,1))
93 fid=fopen('dx.bin','w',ieee); fwrite(fid,dx,prec); fclose(fid);
94

  ViewVC Help
Powered by ViewVC 1.1.22