Back to home page

MITgcm

 
 

    


Warning, /verification/vermix/input/gendata.m is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit 5d0ebecf on 2009-11-12 16:08:42 UTC
d9cc6e8cf4 Mart*0001 % This is a matlab script that generates the input data
                0002 % variable x resolution
                0003 
                0004 prec='real*8';
                0005 ieee='b';
                0006 
                0007 % Dimensions of grid
e5513e974e Davi*0008 nx=1;
d9cc6e8cf4 Mart*0009 ny=1;
e5513e974e Davi*0010 nz=26;
                0011 % Vertical grid (meters)
5d0ebecff7 Davi*0012 dz =[10 10 10 10 10 11 12 14 16 18 21 24 27 31 35 40 40 40 40 40 40 40 40 40 40 40];
e5513e974e Davi*0013 sprintf('delR = %d * %7.6g,',nz,dz)
                0014 zi = [0 cumsum(dz)];
                0015 z = 0.5*(zi(1:end-1)+zi(2:end));
d9cc6e8cf4 Mart*0016 
e5513e974e Davi*0017 % Initial temperature
d9cc6e8cf4 Mart*0018 gravity=9.81;
                0019 talpha=2.0e-4;
e5513e974e Davi*0020 N2=2.e-5;
d9cc6e8cf4 Mart*0021 Tz=N2/(gravity*talpha);
                0022 
e5513e974e Davi*0023 Tref=-Tz*(z - zi(end))+2;
5d0ebecff7 Davi*0024 sprintf('Tref ='), sprintf(' %8.6g,',Tref)
e5513e974e Davi*0025 fid=fopen('T_26.init','w',ieee); fwrite(fid,Tref,prec); fclose(fid);
d9cc6e8cf4 Mart*0026 
e5513e974e Davi*0027 % Flux
                0028 Q=zeros(72,1);
                0029 Q(1:18) = 350;
                0030 Q(25:66) = -350*3/7;
                0031 fid=fopen('Qnet_72.forcing','w',ieee); fwrite(fid,Q,prec); fclose(fid);
                0032 
                0033 %
                0034 taux = 0.1*ones([nx,ny],72);
                0035 fid=fopen('taux_72.forcing','w',ieee); fwrite(fid,taux,prec); fclose(fid);
                0036 
                0037 %%%%%
                0038 tke = 1e-6*ones(1,nz);
                0039 tke(1,1) = 1e-3;
d9cc6e8cf4 Mart*0040 fid=fopen('TKE.init','w',ieee); fwrite(fid,tke,prec); fclose(fid);
                0041 
9640adf825 Mart*0042 % double diffusive initial conditions: 
                0043 % salt fingers in upper layers (dt>0,ds>0,Rrho=talpha*dt/sbeta*ds > 1)
                0044 % diffusive convection in lower layers (dt<0,ds<0,Rrho=talpha*dt/sbeta*ds < 1)
                0045 sbeta = 7.e-4;
e5513e974e Davi*0046 tdd = max(Tref,8-Tref);
9640adf825 Mart*0047 Rrho = 0*tdd+1.1;
                0048 Rrho(8:end) = 0.5;
                0049 Sz2=talpha*diff(tdd)/sbeta./Rrho(1:end-1);
                0050 sdd = cumsum([34,Sz2]);
                0051 
e5513e974e Davi*0052 fid=fopen('T.doublediff','w',ieee); fwrite(fid,tdd,prec); fclose(fid);
d9cc6e8cf4 Mart*0053 
e5513e974e Davi*0054 fid=fopen('S.doublediff','w',ieee); fwrite(fid,sdd,prec); fclose(fid);