| 1 | % cd ~/mitgcm/bbl/MITgcm | % cd ~/mitgcm/bbl/MITgcm | 
| 2 |  | lon=0:.48:11.6; lat=-70:.16:-67.7; dpt=72:144:3600; | 
| 3 |  | Depth=readbin('run/Depth.data',[25 15]); | 
| 4 |  | colormap(cmap), cx=[29.99 30.1]; | 
| 5 |  |  | 
| 6 |  | % find bottom | 
| 7 |  | kbot=ones(25,15); | 
| 8 |  | s1=35+readbin(['run.bbl/SALTanom.' myint2str(216,10) '.data'],[25 15 25]); | 
| 9 |  | for k=2:25 | 
| 10 |  | kbot(find(s1(:,:,k)>0))=k; | 
| 11 |  | end | 
| 12 |  |  | 
| 13 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 14 | % compare baseline, downslope, and bbl | % compare baseline, downslope, and bbl | 
| 15 |  | colormap(cmap), cx=[29.99 30.1]; | 
| 16 |  | s1=zeros(25,15,25); s2=s1; s3=s1; | 
| 17 | for ts=216:216:21600 | for ts=216:216:21600 | 
| 18 | s1=35+readbin(['run/SALTanom.' myint2str(ts,10) '.data'],[25 15 25]); | s1(:,:,1:25)=35+readbin(['run/SALTanom.' myint2str(ts,10) '.data'],[25 15 25]); | 
| 19 | s2=35+readbin(['run.down_slope/SALTanom.' myint2str(ts,10) '.data'],[25 15 25]); | s2(:,:,1:25)=35+readbin(['run.down_slope/SALTanom.' myint2str(ts,10) '.data'],[25 15 25]); | 
| 20 | s3=35+readbin(['run.bbl/SALTanom.' myint2str(ts,10) '.data'],[25 15 25]); | s3(:,:,1:25)=35+readbin(['run.bbl/SALTanom.' myint2str(ts,10) '.data'],[25 15 25]); | 
| 21 | clf, subplot(311) | clf, subplot(311) | 
| 22 | mypcolor(1:15,25:-1:1,squeeze(s1(10,:,:))'); | mypcolor(lat,-dpt/1e3,squeeze(s1(10,:,:))'); caxis(cx), thincolorbar | 
|  | caxis([30 30.1]), thincolorbar |  | 
| 23 | title(['baseline salinity section on day ' int2str(ts*1200/60/60/24)]) | title(['baseline salinity section on day ' int2str(ts*1200/60/60/24)]) | 
| 24 |  | hold on, plot(lat,-Depth(10,:)/1e3,'r.-'), ylabel('depth (km)') | 
| 25 | subplot(312) | subplot(312) | 
| 26 | mypcolor(1:15,25:-1:1,squeeze(s2(10,:,:))'); | mypcolor(lat,-dpt/1e3,squeeze(s2(10,:,:))'); caxis(cx), thincolorbar | 
|  | caxis([30 30.1]), thincolorbar |  | 
| 27 | title(['downslope salinity section on day ' int2str(ts*1200/60/60/24)]) | title(['downslope salinity section on day ' int2str(ts*1200/60/60/24)]) | 
| 28 |  | hold on, plot(lat,-Depth(10,:)/1e3,'r.-'), ylabel('depth (km)') | 
| 29 | subplot(313) | subplot(313) | 
| 30 | mypcolor(1:15,25:-1:1,squeeze(s3(10,:,:))'); | mypcolor(lat,-dpt/1e3,squeeze(s3(10,:,:))'); caxis(cx), thincolorbar | 
|  | caxis([30 30.1]), thincolorbar |  | 
| 31 | title(['bbl salinity section on day ' int2str(ts*1200/60/60/24)]) | title(['bbl salinity section on day ' int2str(ts*1200/60/60/24)]) | 
| 32 | pause(.1) | hold on, plot(lat,-Depth(10,:)/1e3,'r.-'), ylabel('depth (km)') | 
| 33 |  | xlabel('latitude (deg)'), pause(.1) | 
| 34 | end | end | 
| 35 |  |  | 
| 36 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 37 | % look at some diagnostics from bbl integration | % look at some diagnostics from bbl integration | 
|  | kbot=ones(25,15); |  | 
|  | s1=35+readbin(['run.bbl/SALTanom.' myint2str(216,10) '.data'],[25 15 25]); |  | 
|  | for k=2:25 |  | 
|  | kbot(find(s1(:,:,k)>0))=k; |  | 
|  | end |  | 
| 38 | for ts=216:216:21600 | for ts=216:216:21600 | 
| 39 | s1=35+readbin(['run.bbl/SALTanom.' myint2str(ts,10) '.data'],[25 15 25]); | s1=35+readbin(['run.bbl/SALTanom.' myint2str(ts,10) '.data'],[25 15 25]); | 
| 40 | clf, subplot(321), caxis([30 30.1]), mypcolor(1:15,25:-1:1,squeeze(s1(10,:,:))'); | clf, subplot(321), mypcolor(lat,-dpt/1e3,squeeze(s1(10,:,:))'); caxis(cx), thincolorbar | 
|  | caxis([30 30.1]), thincolorbar |  | 
| 41 | title(['salinity section on day ' int2str(ts*1200/60/60/24)]) | title(['salinity section on day ' int2str(ts*1200/60/60/24)]) | 
| 42 | s2=kbot; for i=1:25, for j=1:15, s2(i,j)=s1(i,j,kbot(i,j)); end, end | s2=kbot; for i=1:25, for j=1:15, s2(i,j)=s1(i,j,kbot(i,j)); end, end | 
| 43 | subplot(322), mypcolor(s2'); caxis([30 30.1]), thincolorbar | subplot(322), mypcolor(s2'); caxis(cx), thincolorbar | 
| 44 | title('salinity at bottom grid') | title('salinity of bottom grid box') | 
| 45 | s3=readbin(['run.bbl/BBLsalt.' myint2str(ts,10) '.data'],[25 15]); | s3=readbin(['run.bbl/BBLsalt.' myint2str(ts,10) '.data'],[25 15]); | 
| 46 | subplot(323), mypcolor(s3'); caxis([30 30.1]), thincolorbar | subplot(323), mypcolor(s3'); caxis(cx), thincolorbar | 
| 47 | title('bbl salinity') | title('salinity of bbl') | 
| 48 | subplot(324), mypcolor(s3'-s2'); thincolorbar | subplot(324), mypcolor(s3'-s2'); thincolorbar | 
| 49 | title('bbl salinity minus bottom salinity') | title('bbl salinity minus bottom salinity') | 
| 50 | ts=readbin(['run.bbl/BBLtendS.' myint2str(ts,10) '.data'],[25 15]); | tendS=readbin(['run.bbl/BBLtendS.' myint2str(ts,10) '.data'],[25 15]); | 
| 51 | subplot(325), mypcolor(ts'); thincolorbar | subplot(325), mypcolor(tendS'); caxis([-1 1]*3e-9), thincolorbar | 
| 52 | title('salinity tendency'), pause(.1) | title('bottom salinity tendency due to bbl'), pause(.1) | 
| 53 |  | end | 
| 54 |  |  | 
| 55 |  | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 56 |  | % check that tendency integrates to zero | 
| 57 |  | RAC=readbin('run.bbl/RAC.data',[25 15]); | 
| 58 |  | hFacC=readbin('run.bbl/hFacC.data',[25 15 25]); | 
| 59 |  | for i=1:25 | 
| 60 |  | for j=1:15 | 
| 61 |  | RAC(i,j)=RAC(i,j)*hFacC(i,j,kbot(i,j)); | 
| 62 |  | end | 
| 63 |  | end | 
| 64 |  | for ts=216:216:21600 | 
| 65 |  | eta=readbin(['run.bbl/BBLeta.' myint2str(ts,10) '.data'],[25 15]); | 
| 66 |  | tendS=readbin(['run.bbl/BBLtendS.' myint2str(ts,10) '.data'],[25 15]); | 
| 67 |  | tmp=RAC.*tendS; | 
| 68 |  | disp([ts sum(tmp(:))]), pause(1) | 
| 69 | end | end |