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

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

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


Revision 1.1 - (hide annotations) (download)
Sat Dec 8 00:36:34 2012 UTC (11 years, 5 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64b
change (for now, only fwd test) offline_exf_seaice experiment:
 re-entrant channel with idealized costline (trapezoidal shape) at southern
 boundary to explore seaice dynamics and thermodynamics with simple forcing.

1 jmc 1.1
2     kwr=1;
3     nx=80; ny=42; nr=3; nt=2;
4    
5     xc=[1:nx]; xc=xc-mean(xc);
6     yc=[1:ny]-.5;
7    
8     %------------------------------------------------------
9    
10     windx=10.;
11     H0=-100.;
12    
13     namf='channel.bin';
14     depth=H0*ones(nx,ny); depth(:,1)=0.;
15     %if kwr > 0,
16     % fprintf('write to file: %s\n',namf);
17     % fid=fopen(namf,'w','b'); fwrite(fid,depth,'real*8'); fclose(fid);
18     %end
19    
20     namf='bathy_3c.bin';
21     msk=abs(xc)'*ones(1,ny)+ones(nx,1)*yc;
22     depth=H0*ones(nx,ny); depth(:,1)=0.;
23     depth(find(msk < 24))=0.;
24     y2d=ones(nx,1)*yc;
25     depth(find(y2d > ny/2))=H0;
26     if kwr > 0,
27     fprintf('write to file: %s\n',namf);
28     fid=fopen(namf,'w','b'); fwrite(fid,depth,'real*8'); fclose(fid);
29     end
30    
31     namf='windx.bin';
32     wnd=windx*ones(nx,ny,nt);
33     if kwr > 0,
34     fprintf('write to file: %s\n',namf);
35     fid=fopen(namf,'w','b'); fwrite(fid,wnd,'real*8'); fclose(fid);
36     end
37    
38     %- file name convention: "const_{xx}.bin" <-> uniform value = xx (in percent)
39     namf='const_00.bin';
40     fld=0*ones(nx,ny,nt);
41     if kwr > 0,
42     fprintf('write to file: %s\n',namf);
43     fid=fopen(namf,'w','b'); fwrite(fid,fld,'real*8'); fclose(fid);
44     end
45    
46     namf='const100.bin'; w0=1.;
47     var=w0*ones(nx,ny);
48     if kwr > 0,
49     fprintf('write to file: %s\n',namf);
50     fid=fopen(namf,'w','b'); fwrite(fid,var,'real*8'); fclose(fid);
51     end
52    
53     namf='const+20.bin'; w0=0.2;
54     var=w0*ones(nx,ny);
55     if kwr > 0,
56     fprintf('write to file: %s\n',namf);
57     fid=fopen(namf,'w','b'); fwrite(fid,var,'real*8'); fclose(fid);
58     end
59    
60     %namf='const+40.bin';
61     %u0=0.4;
62     %var=u0*ones(nx,ny);
63     %if kwr > 0,
64     % fprintf('write to file: %s\n',namf);
65     % fid=fopen(namf,'w','b'); fwrite(fid,var,'real*8'); fclose(fid);
66     %end
67    
68     %namf='const-10.bin';
69     %v0=-0.1;
70     %var=v0*ones(nx,ny);
71     %if kwr > 0,
72     % fprintf('write to file: %s\n',namf);
73     % fid=fopen(namf,'w','b'); fwrite(fid,var,'real*8'); fclose(fid);
74     %end
75     %------------------------------------------------------
76    
77     dsw0=100;
78     namf=['dsw_',int2str(dsw0),'.bin'];
79     fld=dsw0*ones(nx,ny,nt);
80     if kwr > 0,
81     fprintf('write to file: %s\n',namf);
82     fid=fopen(namf,'w','b'); fwrite(fid,fld,'real*8'); fclose(fid);
83     end
84    
85     dlw0=250;
86     namf=['dlw_',int2str(dlw0),'.bin'];
87     fld=dlw0*ones(nx,ny,nt);
88     if kwr > 0,
89     fprintf('write to file: %s\n',namf);
90     fid=fopen(namf,'w','b'); fwrite(fid,fld,'real*8'); fclose(fid);
91     end
92    
93     cel2K=273.15; dtx=4; %- dtx = amplitude of air temp variations in X-dir
94     ta_x=cel2K + dtx*sin(pi*(1+2*xc'/nx));
95     ta=repmat(ta_x,[1 ny nt]);
96     namf=['tair_',int2str(dtx),'x.bin'];
97     if kwr > 0,
98     fprintf('write to file: %s\n',namf);
99     fid=fopen(namf,'w','b'); fwrite(fid,ta,'real*8'); fclose(fid);
100     end;
101    
102     cvapor_fac = 640380.000 ;
103     cvapor_exp = 5107.400 ;
104     atmrho = 1.200 ;
105     rh=70; %- specific humid <--> 70.% relative humid
106     tmpbulk = cvapor_fac*exp(-cvapor_exp./ta_x);
107     qa_x = (rh/100.)*tmpbulk/atmrho ;
108     qa=repmat(qa_x,[1 ny nt]);
109     namf=['qa',int2str(rh),'_',int2str(dtx),'x.bin'];
110     if kwr > 0,
111     fprintf('write to file: %s\n',namf);
112     fid=fopen(namf,'w','b'); fwrite(fid,qa,'real*8'); fclose(fid);
113     end;
114    
115     %- salinity
116     sCst=30;
117     so=sCst*ones(nx,ny,nt);
118     namf='socn.bin';
119     %if kwr > 0,
120     % fprintf('write to file: %s\n',namf);
121     % fid=fopen(namf,'w','b'); fwrite(fid,so,'real*8'); fclose(fid);
122     %end;
123    
124     muTf = 5.4e-2;
125     tfreeze=-muTf*sCst;
126     fprintf('T-freeze = %10.6f\n',tfreeze);
127     to_y=(yc-2)/ny;
128     to_y=tfreeze+0.5-to_y.*to_y;
129     to=repmat(to_y,[nx 1 nt]);
130     namf='tocn.bin';
131     if kwr > 0,
132     fprintf('write to file: %s\n',namf);
133     fid=fopen(namf,'w','b'); fwrite(fid,to,'real*8'); fclose(fid);
134     end;
135    
136     %-- make some plots to check: ----------------
137    
138     hScal=[-1.1 0.1]*abs(H0);
139     figure(1); clf;
140     subplot(211);
141     var=depth;
142     imagesc(xc,yc,var'); set(gca,'YDir','normal');
143     %caxis(hScal);
144     %change_colmap(-1);
145     colorbar;
146     title('Depth [m]');
147    
148     subplot(413);
149     var=depth;
150     j1=2;
151     j2=ny/2;
152     j3=j2+1;
153     plot(xc,var(:,j1),'k-')
154     hold on; j=j+1;
155     plot(xc,var(:,j2),'ro-')
156     plot(xc,var(:,j3),'b-')
157     hold off;
158     axis([-nx/2 nx/2 hScal]);
159     grid
160     legend(int2str(j1),int2str(j2),int2str(j3));
161     title('Depth @ j= cst');
162    
163     subplot(414);
164     i=nx/2;
165     plot(yc,var(i,:),'k-')
166     axis([0 ny H0*1.1 -H0*.1]);
167     grid
168     title(['Depth @ i=',int2str(i)]);
169    
170     %--
171     dewPt=(qa_x*atmrho)/cvapor_fac;
172     dewPt=-cvapor_exp./log(dewPt);
173    
174     figure(2);clf;
175     subplot(211)
176     plot(xc,ta_x-cel2K,'r-'); hold on;
177     plot(xc,dewPt-cel2K,'b-');
178     plot(xc,tfreeze*ones(nx,1),'k-');
179     hold off;
180     AA=axis; axis([-nx/2 nx/2 AA(3:4)]);
181     legend('ta','dew');
182     grid
183     title(['del-Temp-X= ',int2str(dtx),' ; RH= ',int2str(rh),' ; Air Temp (^oC)']);
184     subplot(212)
185     plot(yc,to_y,'b-'); hold on;
186     plot(yc,tfreeze*ones(ny,1),'k-');
187     hold off;
188     AA=axis; axis([0 ny AA(3:4)]);
189     grid
190     title('Ocean Temp ^oC');

  ViewVC Help
Powered by ViewVC 1.1.22