Warning, /verification/tutorial_deep_convection/input/gendata.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
f2d1a7e97e Jean*0001 % This is a matlab script that generates the input data
0002
0003 % Dimensions of grid
64147b2a20 Jean*0004 nx=100;
0005 ny=100;
0006 nz=50;
f2d1a7e97e Jean*0007 % Nominal depth of model (meters)
0008 H=1000;
0009 % Size of domain
64147b2a20 Jean*0010 Lx=2.0e3;
0011 % Radius of cooling disk (m)
0012 Rc=600.;
f2d1a7e97e Jean*0013 % Horizontal resolution (m)
0014 dx=Lx/nx;
0015 % Rotation
64147b2a20 Jean*0016 f=1.e-4;
f2d1a7e97e Jean*0017 % Stratification
64147b2a20 Jean*0018 N=0.0*(f*Rc/H);
0019 % surface temperature
0020 Ts=20.;
0021 % Flux : Cooling disk & noise added to cooling
0022 Qo=800; Q1=10;
f2d1a7e97e Jean*0023
0024 % Gravity
64147b2a20 Jean*0025 g=10.;
f2d1a7e97e Jean*0026 % E.O.S.
0027 alpha=2.e-4;
0028
0029 Tz=N^2/(g*alpha)
0030
0031 dz=H/nz;
0032 sprintf('delZ = %d * %7.6g,',nz,dz)
0033
0034 x=(1:nx)*dx;x=x-mean(x);
0035 y=(1:ny)*dx;y=y-mean(y);
0036 z=-dz/2:-dz:-H;
0037
0038 % Temperature profile
64147b2a20 Jean*0039 Tref=Ts+Tz*z-mean(Tz*z);
0040 [sprintf('Tref =') sprintf(' %8.6g,',Tref)]
0041
0042 % Surface heat flux : refine the grid (by 3 x 3) to assign mean heat flux
0043 Q=Qo+Q1*(0.5+rand([nx,ny]));
0044 Qc=zeros(nx,ny);
0045 xc=x'*ones(1,ny); yc=ones(nx,1)*y;
0046 for j=-1:1, for i=-1:1,
0047 xs=xc+dx*i/3 ; ys=yc+dx*j/3; r2=xs.*xs+ys.*ys;
0048 qs=Q/9; qs( find(r2 > Rc*Rc) )=0.;
0049 Qc=Qc+qs;
0050 end ; end
213f3ebfc9 Jean*0051 %fid=fopen('Qnet_p64.bin','w','b'); fwrite(fid,Qc,'real*8'); fclose(fid);
0052 fid=fopen('Qnet_p32.bin','w','b'); fwrite(fid,Qc,'real*4'); fclose(fid);
f2d1a7e97e Jean*0053
64147b2a20 Jean*0054 var=2*pi*[0:1000]/1000; xl=Rc*cos(var); yl=Rc*sin(var);
0055 figure(1);clf;
0056 var=Qc; var(find(var==0))=NaN;
eeb4ec3285 Jean*0057 imagesc(x,y,var'); set(gca,'YDir','normal');
64147b2a20 Jean*0058 caxis([-15 820]);
0059 %change_colmap(-1);
0060 colorbar
0061 grid;
0062 hold on
0063 L=line(xl,yl);
0064 set(L,'color',[0 0 0]);
0065 hold off ;