/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_diags/diags_set_D.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/gcmfaces_diags/diags_set_D.m

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


Revision 1.9 - (hide annotations) (download)
Mon Jan 19 16:34:41 2015 UTC (10 years, 6 months ago) by gforget
Branch: MAIN
Changes since 1.8: +118 -16 lines
- re-organize horizontal convergence computation.
- add optional output of budget in extensive form (kg/s,J/s,g/s).

1 gforget 1.1
2     %select kBudget:
3     if ~isempty(setDiagsParams);
4     kBudget=setDiagsParams{1};
5     else;
6     kBudget=1;
7     end;
8    
9 gforget 1.9 doMoreBudgetOutput=0;
10    
11 gforget 1.2 %override default file name:
12     %---------------------------
13     tmp1=setDiags;
14     if kBudget>1;
15     tmp1=sprintf('D%02i',kBudget);
16 gforget 1.1 end;
17 gforget 1.2 fileMat=['diags_set_' tmp1];
18 gforget 1.1
19     if userStep==1;%diags to be computed
20     listDiags=['glo_vol_ocn glo_vol_tot glo_vol_ice glo_bp'];
21     listDiags=[listDiags ' north_vol_ocn north_vol_tot north_vol_ice north_bp'];
22     listDiags=[listDiags ' south_vol_ocn south_vol_tot south_vol_ice south_bp'];
23     listDiags=[listDiags ' glo_heat_ocn glo_heat_tot glo_heat_ice'];
24     listDiags=[listDiags ' north_heat_ocn north_heat_tot north_heat_ice'];
25     listDiags=[listDiags ' south_heat_ocn south_heat_tot south_heat_ice'];
26     listDiags=[listDiags ' glo_salt_ocn glo_salt_tot glo_salt_ice'];
27     listDiags=[listDiags ' north_salt_ocn north_salt_tot north_salt_ice'];
28     listDiags=[listDiags ' south_salt_ocn south_salt_tot south_salt_ice'];
29 gforget 1.2
30 gforget 1.1 elseif userStep==2;%input files and variables
31     listFlds={ 'ETAN','SIheff','SIhsnow','THETA ','SALT ','PHIBOT'};
32     listFlds={listFlds{:},'SIatmFW ','oceFWflx','SItflux','TFLUX','SFLUX','oceSPflx','SRELAX'};
33     listFlds={listFlds{:},'oceQnet ','SIatmQnt','SIaaflux','SIsnPrcp','SIacSubl'};
34     listFlds={listFlds{:},'TRELAX','WTHMASS','WSLTMASS','oceSflux','oceQsw','oceSPtnd'};
35     if kBudget>1;
36     listFlds={listFlds{:},'ADVr_TH','DFrE_TH','DFrI_TH','ADVr_SLT','DFrE_SLT','DFrI_SLT','WVELMASS'};
37     end;
38 gforget 1.4 listFlds={listFlds{:},'SDIAG1','SDIAG2','SDIAG3'};
39 gforget 1.1 listFlds={listFlds{:},'UVELMASS','VVELMASS','AB_gT','AB_gS'};
40     listFlds={listFlds{:},'ADVx_TH ','ADVy_TH ','DFxE_TH ','DFyE_TH '};
41     listFlds={listFlds{:},'ADVx_SLT','ADVy_SLT','DFxE_SLT','DFyE_SLT'};
42     listFlds={listFlds{:},'ADVxHEFF','ADVyHEFF','DFxEHEFF','DFyEHEFF'};
43     listFlds={listFlds{:},'ADVxSNOW','ADVySNOW','DFxESNOW','DFyESNOW'};
44     listFldsNames=deblank(listFlds);
45     %
46     listFiles={'rate_budg2d_snap_set1','budg2d_hflux_set1','budg2d_zflux_set1','budg2d_zflux_set2'};
47     if kBudget==1;
48     listFiles={listFiles{:},'rate_budg2d_snap_set2','budg2d_hflux_set2'};
49     else;
50     tmp1=sprintf('rate_budg2d_snap_set3_%02i',kBudget);
51     tmp2=sprintf('budg2d_zflux_set3_%02i',kBudget);
52     tmp3=sprintf('budg2d_hflux_set3_%02i',kBudget);
53     listFiles={listFiles{:},tmp1,tmp2,tmp3};
54     end;
55 gforget 1.5 listSubdirs={[dirMat 'BUDG/' ],[dirMat '../BUDG/' ],[dirModel 'diags/BUDG/']};
56 gforget 1.2
57 gforget 1.1 elseif userStep==3;%computational part;
58 gforget 1.2
59     %preliminary tests
60     test1=isempty(dir([dirModel 'diags/BUDG/budg2d_snap_set1*']));
61 gforget 1.5 test2=isempty(dir([dirMat 'BUDG/rate_budg2d_snap_set1*']))&...
62     isempty(dir([dirMat '../BUDG/rate_budg2d_snap_set1*']));
63 gforget 1.2 if (strcmp(setDiags,'D')&test1&test2);
64     fprintf('\n abort : global and regional budgets, due to missing \n');
65     fprintf(['\n ' dirModel 'diags/BUDG/budg2d_snap_set1* \n']);
66     return;
67     end;
68    
69     if (strcmp(setDiags,'D')&test2);
70     fprintf('\n abort : global and regional budgets, due to missing \n');
71     fprintf(['\n ' dirModel 'diags/BUDG/rate_budg2d_snap_set1* \n']);
72     return;
73     end;
74 gforget 1.1
75     %override default file name:
76     %---------------------------
77     tmp1=setDiags;
78     if kBudget>1;
79     tmp1=sprintf('D%02i',kBudget);
80     end;
81     fileMat=['diags_set_' tmp1 '_' num2str(tt) '.mat'];
82    
83     %fill in optional fields:
84     %------------------------
85     if isempty(who('TRELAX')); TRELAX=0*mygrid.XC; end;
86     if isempty(who('SRELAX')); SRELAX=0*mygrid.XC; end;
87     if isempty(who('AB_gT')); AB_gT=0*mygrid.XC; end;
88     if isempty(who('AB_gS')); AB_gS=0*mygrid.XC; end;
89     if isempty(who('oceSPtnd')); oceSPtnd=0*mygrid.XC; end;
90     if isempty(who('oceSPflx')); oceSPflx=0*mygrid.XC; end;
91     if isempty(who('PHIBOT')); PHIBOT=0*mygrid.XC; end;
92 gforget 1.4
93     %aliases from development phase (applies to 2012 core runs)
94     %---------------------------------------------------------
95     if ~isempty(who('SDIAG1')); SRELAX=SDIAG1; end;
96     if ~isempty(who('SDIAG2')); SIatmFW=SDIAG2; end;
97     if ~isempty(who('SDIAG3')); SItflux=SDIAG3; end;
98    
99 gforget 1.1
100     %=======MASS=========
101    
102 gforget 1.9 if doMoreBudgetOutput;
103     %indexing and sign convention:
104     %- MITgcm: fluxes are >0 downward, k=1 start at free surface
105     %- here, similarly: >0 downward, k=1 free surface k=2 sea floor
106     budgO.specs.top='free surface';
107     if kBudget>1; budgO.specs.top=['interface no. ' num2str(kBudget)]; end;
108     budgO.specs.bottom='sea floor';
109     budgI.specs.top='ocn-ice to atm interface';
110     budgI.specs.bottom='free surface';
111    
112     %here we output tendencies and fluxes in kg/s
113     budgMo=budgO; budgMi=budgI;
114     budgMo.specs.units='kg/s';%ocean only
115     budgMi.specs.units='kg/s';%ice only
116     %here we output tendencies and fluxes in Watts
117     budgHo=budgO; budgHi=budgI;
118     budgHo.specs.units='W';%ocean only
119     budgHi.specs.units='W';%ice only
120     %here we output tendencies and fluxes in g/s
121     budgSo=budgO; budgSi=budgI;
122     budgSo.specs.units='g/s';%ocean only
123     budgSi.specs.units='g/s';%ice only
124     end;
125    
126 gforget 1.1 %compute mapped budget:
127     %----------------------
128    
129     %mass = myparms.rhoconst * sea level
130     contOCN=ETAN*myparms.rhoconst;
131     contICE=(SIheff*myparms.rhoi+SIhsnow*myparms.rhosn);
132     %for deep ocean layer :
133     if kBudget>1&myparms.useNLFS<2;
134     contOCN=0;
135     elseif kBudget>1;%rstar case
136     tmp1=mk3D(mygrid.DRF,mygrid.hFacC).*mygrid.hFacC;
137     tmp2=sum(tmp1(:,:,kBudget:length(mygrid.RC)),3)./mygrid.Depth;
138     contOCN=tmp2.*ETAN*myparms.rhoconst;
139     end;
140     %
141     contTOT=contOCN+contICE;
142 gforget 1.9 %
143     if doMoreBudgetOutput;
144     budgMo.tend=mygrid.RAC.*contOCN;%kg/s
145     budgMi.tend=mygrid.RAC.*contICE;%kg/s
146     end;
147    
148 gforget 1.1 %vertical divergence (air-sea fluxes or vertical advection)
149     zdivOCN=oceFWflx;
150     zdivICE=SIatmFW-oceFWflx;
151     %in virtual salt flux we omit :
152     if ~myparms.useRFWF; zdivOCN=0*zdivOCN; end;
153     %for deep ocean layer :
154     if kBudget>1; zdivOCN=-WVELMASS*myparms.rhoconst; end;
155     %
156     zdivTOT=zdivOCN+zdivICE;
157 gforget 1.9 %
158     if doMoreBudgetOutput;
159     budgMo.trW=mygrid.RAC.*zdivOCN; budgMo.trW(:,:,2)=0;%kg/s
160     budgMi.trW=mygrid.RAC.*(zdivICE+zdivOCN); budgMi.trW(:,:,2)=mygrid.RAC.*zdivOCN;%kg/s
161     end;
162    
163 gforget 1.1 %horizontal divergence (advection and ice diffusion)
164 gforget 1.9 dxg=mk3D(mygrid.DXG,VVELMASS); dyg=mk3D(mygrid.DYG,UVELMASS);
165     tmpUo=myparms.rhoconst*dyg.*UVELMASS;
166     tmpVo=myparms.rhoconst*dxg.*VVELMASS;
167     hdivOCN=calc_UV_conv(tmpUo,tmpVo); %for 2D, already vertically integrated, fields
168     tmpUi=(myparms.rhoi*DFxEHEFF+myparms.rhosn*DFxESNOW+myparms.rhoi*ADVxHEFF+myparms.rhosn*ADVxSNOW);
169     tmpVi=(myparms.rhoi*DFyEHEFF+myparms.rhosn*DFyESNOW+myparms.rhoi*ADVyHEFF+myparms.rhosn*ADVySNOW);
170     hdivICE=calc_UV_conv(tmpUi,tmpVi); %dh needed is alerady in DFxEHEFF etc
171 gforget 1.1 hdivTOT=hdivOCN+hdivICE;
172 gforget 1.9 if doMoreBudgetOutput;
173     budgMo.trU=tmpUo; budgMo.trV=tmpVo;%kg/s
174     budgMi.trU=tmpUi; budgMi.trV=tmpVi;%kg/s
175     end;
176 gforget 1.1
177     %bottom pressure for comparison:
178     bp=myparms.rhoconst/9.81*PHIBOT;
179    
180     %compute global integrals:
181     %-------------------------
182     msk=mygrid.mskC(:,:,kBudget);
183     glo_vol_tot=calc_budget_mean_mask(contTOT,zdivTOT,hdivTOT,msk);
184     glo_vol_ocn=calc_budget_mean_mask(contOCN,zdivOCN,hdivOCN,msk);
185     glo_vol_ice=calc_budget_mean_mask(contICE,zdivICE,hdivICE,msk);
186     glo_bp=nansum(bp.*msk.*mygrid.RAC)/nansum(msk.*mygrid.RAC);
187    
188     %compute northern hemisphere integrals:
189     msk=mygrid.mskC(:,:,kBudget).*(mygrid.YC>0);
190     north_vol_tot=calc_budget_mean_mask(contTOT,zdivTOT,hdivTOT,msk);
191     north_vol_ocn=calc_budget_mean_mask(contOCN,zdivOCN,hdivOCN,msk);
192     north_vol_ice=calc_budget_mean_mask(contICE,zdivICE,hdivICE,msk);
193     north_bp=nansum(bp.*msk.*mygrid.RAC)/nansum(msk.*mygrid.RAC);
194    
195     %and southern hemisphere integrals:
196     msk=mygrid.mskC(:,:,kBudget).*(mygrid.YC<=0);
197     south_vol_tot=calc_budget_mean_mask(contTOT,zdivTOT,hdivTOT,msk);
198     south_vol_ocn=calc_budget_mean_mask(contOCN,zdivOCN,hdivOCN,msk);
199     south_vol_ice=calc_budget_mean_mask(contICE,zdivICE,hdivICE,msk);
200     south_bp=nansum(bp.*msk.*mygrid.RAC)/nansum(msk.*mygrid.RAC);
201    
202     %=======HEAT=======
203 gforget 1.9
204 gforget 1.1 contOCN=myparms.rcp*THETA-myparms.rcp*AB_gT;
205     contICE=-myparms.flami*(SIheff*myparms.rhoi+SIhsnow*myparms.rhosn);
206     contTOT=contOCN+contICE;
207 gforget 1.9 %
208     if doMoreBudgetOutput;
209     budgHo.tend=mygrid.RAC.*contOCN;%Watt
210     budgHi.tend=mygrid.RAC.*contICE;%Watt
211     end;
212    
213 gforget 1.1 %vertical divergence (air-sea fluxes or vertical adv/dif)
214     zdivOCN=TFLUX;
215     zdivICE=-(SItflux+TFLUX-TRELAX);
216     %in linear surface we omit :
217     if ~myparms.useNLFS; zdivOCN=zdivOCN-myparms.rcp*WTHMASS; end;
218     %in virtual salt flux we omit :
219     if ~myparms.useRFWF|~myparms.useNLFS; zdivICE=zdivICE+SIaaflux; end;
220     %working approach for real fresh water (?) and virtual salt flux
221     if 0; zdivICE=-oceQnet-SIatmQnt-myparms.flami*(SIsnPrcp-SIacSubl); end;
222     %for deep ocean layer :
223     if kBudget>1;
224     zdivOCN=-(ADVr_TH+DFrE_TH+DFrI_TH)./mygrid.RAC*myparms.rcp;
225     dd=mygrid.RF(kBudget); msk=mygrid.mskC(:,:,kBudget);
226     swfrac=0.62*exp(dd/0.6)+(1-0.62)*exp(dd/20);
227     if dd<-200; swfrac=0; end;
228     zdivOCN=zdivOCN+swfrac*oceQsw;%.*msk;
229     end;
230     %
231     zdivTOT=zdivOCN+zdivICE;
232 gforget 1.9 %
233     if doMoreBudgetOutput;
234     budgHo.trW=mygrid.RAC.*zdivOCN; budgHo.trW(:,:,2)=0;%kg/s
235     budgHi.trW=mygrid.RAC.*(zdivICE+zdivOCN); budgHi.trW(:,:,2)=mygrid.RAC.*zdivOCN;%kg/s
236     end;
237    
238 gforget 1.1 %horizontal divergence (advection and diffusion)
239 gforget 1.9 tmpUo=myparms.rcp*(ADVx_TH+DFxE_TH); tmpVo=myparms.rcp*(ADVy_TH+DFyE_TH);
240     hdivOCN=calc_UV_conv(tmpUo,tmpVo);
241     tmpUi=-myparms.flami*(myparms.rhoi*DFxEHEFF+myparms.rhosn*DFxESNOW+myparms.rhoi*ADVxHEFF+myparms.rhosn*ADVxSNOW);
242     tmpVi=-myparms.flami*(myparms.rhoi*DFyEHEFF+myparms.rhosn*DFyESNOW+myparms.rhoi*ADVyHEFF+myparms.rhosn*ADVySNOW);
243     hdivICE=calc_UV_conv(tmpUi,tmpVi); %no dh needed here
244 gforget 1.1 hdivTOT=hdivOCN+hdivICE;
245 gforget 1.9 if doMoreBudgetOutput;
246     budgHo.trU=tmpUo; budgHo.trV=tmpVo;%Watt
247     budgHi.trU=tmpUi; budgHi.trV=tmpVi;%Watt
248     end;
249 gforget 1.1
250     %compute global integrals:
251     %-------------------------
252     msk=mygrid.mskC(:,:,kBudget);
253     glo_heat_tot=calc_budget_mean_mask(contTOT,zdivTOT,hdivTOT,msk);
254     glo_heat_ocn=calc_budget_mean_mask(contOCN,zdivOCN,hdivOCN,msk);
255     glo_heat_ice=calc_budget_mean_mask(contICE,zdivICE,hdivICE,msk);
256    
257     %compute northern hemisphere integrals:
258     msk=mygrid.mskC(:,:,kBudget).*(mygrid.YC>0);
259     north_heat_tot=calc_budget_mean_mask(contTOT,zdivTOT,hdivTOT,msk);
260     north_heat_ocn=calc_budget_mean_mask(contOCN,zdivOCN,hdivOCN,msk);
261     north_heat_ice=calc_budget_mean_mask(contICE,zdivICE,hdivICE,msk);
262    
263     %and southern hemisphere integrals:
264     msk=mygrid.mskC(:,:,kBudget).*(mygrid.YC<=0);
265     south_heat_tot=calc_budget_mean_mask(contTOT,zdivTOT,hdivTOT,msk);
266     south_heat_ocn=calc_budget_mean_mask(contOCN,zdivOCN,hdivOCN,msk);
267     south_heat_ice=calc_budget_mean_mask(contICE,zdivICE,hdivICE,msk);
268    
269     %=======SALT=======
270 gforget 1.9
271 gforget 1.1 contOCN=myparms.rhoconst*SALT-myparms.rhoconst*AB_gS;
272     contICE=myparms.SIsal0*myparms.rhoi*SIheff;
273     contTOT=contOCN+contICE;
274 gforget 1.9 %
275     if doMoreBudgetOutput;
276     budgSo.tend=mygrid.RAC.*contOCN;%g/s
277     budgSi.tend=mygrid.RAC.*contICE;%g/s
278     end;
279    
280 gforget 1.1 %vertical divergence (air-sea fluxes or vertical adv/dif)
281     zdivOCN=SFLUX+oceSPflx;
282     zdivICE=-zdivOCN+SRELAX;
283     %in linear surface we omit :
284     if ~myparms.useNLFS; zdivOCN=zdivOCN-myparms.rhoconst*WSLTMASS; end;
285     %working approach for real fresh water (?) and virtual salt flux
286     if ~myparms.useRFWF|~myparms.useNLFS; zdivICE=-oceSflux; end;
287     %for deep ocean layer :
288     if kBudget>1;
289     zdivOCN=-(ADVr_SLT+DFrE_SLT+DFrI_SLT)./mygrid.RAC*myparms.rhoconst;
290     zdivOCN=zdivOCN+oceSPtnd;%.*msk;
291     end;
292     zdivTOT=zdivOCN+zdivICE;
293 gforget 1.9 %
294     if doMoreBudgetOutput;
295     budgSo.trW=mygrid.RAC.*zdivOCN; budgSo.trW(:,:,2)=0;%kg/s
296     budgSi.trW=0*mygrid.RAC; budgSi.trW(:,:,2)=budgSo.trW(:,:,1);%kg/s
297     end;
298    
299 gforget 1.1 %horizontal divergence (advection and diffusion)
300 gforget 1.9 tmpUo=myparms.rhoconst*(ADVx_SLT+DFxE_SLT);
301     tmpVo=myparms.rhoconst*(ADVy_SLT+DFyE_SLT);
302     hdivOCN=calc_UV_conv(tmpUo,tmpVo);
303     tmpUi=myparms.SIsal0*(myparms.rhoi*DFxEHEFF+myparms.rhoi*ADVxHEFF);
304     tmpVi=myparms.SIsal0*(myparms.rhoi*DFyEHEFF+myparms.rhoi*ADVyHEFF);
305     hdivICE=calc_UV_conv(tmpUi,tmpVi); %no dh needed here
306 gforget 1.1 hdivTOT=hdivOCN+hdivICE;
307 gforget 1.9 if doMoreBudgetOutput;
308     budgSo.trU=tmpUo; budgSo.trV=tmpVo;%g/s
309     budgSi.trU=tmpUi; budgSi.trV=tmpVi;%g/s
310     end;
311 gforget 1.1
312     %compute global integrals:
313     %-------------------------
314     msk=mygrid.mskC(:,:,kBudget);
315     glo_salt_tot=calc_budget_mean_mask(contTOT,zdivTOT,hdivTOT,msk);
316     glo_salt_ocn=calc_budget_mean_mask(contOCN,zdivOCN,hdivOCN,msk);
317     glo_salt_ice=calc_budget_mean_mask(contICE,zdivICE,hdivICE,msk);
318    
319     %compute northern hemisphere integrals:
320     msk=mygrid.mskC(:,:,kBudget).*(mygrid.YC>0);
321     north_salt_tot=calc_budget_mean_mask(contTOT,zdivTOT,hdivTOT,msk);
322     north_salt_ocn=calc_budget_mean_mask(contOCN,zdivOCN,hdivOCN,msk);
323     north_salt_ice=calc_budget_mean_mask(contICE,zdivICE,hdivICE,msk);
324    
325     %and southern hemisphere integrals:
326     msk=mygrid.mskC(:,:,kBudget).*(mygrid.YC<=0);
327     south_salt_tot=calc_budget_mean_mask(contTOT,zdivTOT,hdivTOT,msk);
328     south_salt_ocn=calc_budget_mean_mask(contOCN,zdivOCN,hdivOCN,msk);
329     south_salt_ice=calc_budget_mean_mask(contICE,zdivICE,hdivICE,msk);
330 gforget 1.2
331 gforget 1.9 if doMoreBudgetOutput;
332     %list of budgets to output
333     listbudg={'budgMo','budgHo','budgSo'};
334     if kBudget==1; listbudg={listbudg{:},'budgMi','budgHi','budgSi'}; end;
335     %the actual output
336     for iibudg=1:length(listbudg);
337     %set directory name
338     dirbudg=dirMat;
339     if ~isempty(strfind(dirMat,['diags_set_' setDiags '/']))
340     dirbudg=fullfile(dirMat,'..',filesep);
341     end;
342     sufbudg='';
343     if kBudget>1; sufbudg=num2str(kBudget); end;
344     dirbudg=fullfile(dirbudg,['diags_set_' listbudg{iibudg} sufbudg],filesep);
345     %
346     if ~isdir(dirbudg); mkdir(dirbudg); end;
347     %set file name
348     filebudg=[listbudg{iibudg} '_' num2str(tt) '.mat'];
349     %output to file
350     eval(['tmpbudg=' listbudg{iibudg} ';']);
351     save([dirbudg filebudg],'-struct','tmpbudg');
352     end;
353     end;
354    
355 gforget 1.2 %===================== COMPUTATIONAL SEQUENCE ENDS =========================%
356     %===================== PLOTTING SEQUENCE BEGINS =========================%
357    
358     elseif userStep==-1;%plotting
359    
360     if isempty(setDiagsParams);
361     choicePlot={'all'};
362     elseif isnumeric(setDiagsParams{1})&length(setDiagsParams)==1;
363     choicePlot={'all'};
364     elseif isnumeric(setDiagsParams{1});
365     choicePlot={setDiagsParams{2:end}};
366     else;
367     choicePlot=setDiagsParams;
368     end;
369    
370 gforget 1.3 tt=[1:length(alldiag.listTimes)];
371     TT=alldiag.listTimes(tt);
372     nt=length(TT);
373    
374 gforget 1.2 if (kBudget==1)&(sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'mass')));
375    
376     %1.1) ocean+seaice mass budgets
377     %------------------------------
378     figureL;
379     %global volume budget:
380 heimbach 1.6 subplot(3,1,1); disp_budget_mean_mask(TT,alldiag.glo_vol_tot,'kg/m^2','Global Mean Mass (incl. ice)');
381 gforget 1.2 %add bp:
382     dt=median(diff(TT))*86400; bp=dt*cumsum(alldiag.glo_bp);
383     plot(TT,bp,'k'); aa=legend; bb=get(aa,'String'); bb={bb{:},'bp'}; legend(bb,'Orientation','horizontal');
384     %northern hemisphere budget:
385 heimbach 1.6 subplot(3,1,2); disp_budget_mean_mask(TT,alldiag.north_vol_tot,'kg/m^2','Northern Mean Mass (incl. ice)');
386 gforget 1.2 %add bp:
387     dt=median(diff(TT))*86400; bp=dt*cumsum(alldiag.north_bp);
388     plot(TT,bp,'k'); aa=legend; bb=get(aa,'String'); bb={bb{:},'bp'}; legend(bb,'Orientation','horizontal');
389     %southern hemisphere budget:
390 heimbach 1.6 subplot(3,1,3); disp_budget_mean_mask(TT,alldiag.south_vol_tot,'kg/m^2','Southern Mean Mass (incl. ice)');
391 gforget 1.2 %add bp:
392     dt=median(diff(TT))*86400; bp=dt*cumsum(alldiag.south_bp);
393     plot(TT,bp,'k'); aa=legend; bb=get(aa,'String'); bb={bb{:},'bp'}; legend(bb,'Orientation','horizontal');
394     %add to tex file
395     myCaption={myYmeanTxt,' global (upper) north (mid) and south (lower), '};
396 heimbach 1.6 myCaption={myCaption{:},'mass budget (ocean+ice) in kg/m$^2$.'};
397 gforget 1.2 if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); elseif ~multiTimes; close; end;
398    
399     %1.2) ice mass budgets
400     %---------------------
401     figureL;
402 heimbach 1.6 subplot(3,1,1); disp_budget_mean_mask(TT,alldiag.glo_vol_ice,'kg/m^2','Global Mean Mass (only ice)');
403 gforget 1.2 dt=median(diff(TT))*86400; bp=dt*cumsum(alldiag.glo_bp);
404     plot(TT,bp,'k'); aa=legend; bb=get(aa,'String'); bb={bb{:},'bp'}; legend(bb,'Orientation','horizontal');
405 heimbach 1.6 subplot(3,1,2); disp_budget_mean_mask(TT,alldiag.north_vol_ice,'kg/m^2','Northern Mean Mass (only ice)');
406 gforget 1.2 dt=median(diff(TT))*86400; bp=dt*cumsum(alldiag.north_bp);
407     plot(TT,bp,'k'); aa=legend; bb=get(aa,'String'); bb={bb{:},'bp'}; legend(bb,'Orientation','horizontal');
408 heimbach 1.6 subplot(3,1,3); disp_budget_mean_mask(TT,alldiag.south_vol_ice,'kg/m^2','Southern Mean Mass (only ice)');
409 gforget 1.2 dt=median(diff(TT))*86400; bp=dt*cumsum(alldiag.south_bp);
410     plot(TT,bp,'k'); aa=legend; bb=get(aa,'String'); bb={bb{:},'bp'}; legend(bb,'Orientation','horizontal');
411     %add to tex file
412     myCaption={myYmeanTxt,' global (upper) north (mid) and south (lower), '};
413 heimbach 1.6 myCaption={myCaption{:},'mass budget (ice only) in kg/m$^2$.'};
414 gforget 1.2 if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); elseif ~multiTimes; close; end;
415    
416     end;
417    
418     if (sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'mass')));
419    
420     %1.3) ocean mass budgets
421     %-----------------------
422     figureL;
423     %global volume budget:
424 heimbach 1.6 subplot(3,1,1); disp_budget_mean_mask(TT,alldiag.glo_vol_ocn,'kg/m^2','Global Mean Mass (only ocean)');
425 gforget 1.2 dt=median(diff(TT))*86400; bp=dt*cumsum(alldiag.glo_bp);
426     plot(TT,bp,'k'); aa=legend; bb=get(aa,'String'); bb={bb{:},'bp'}; legend(bb,'Orientation','horizontal');
427 heimbach 1.6 subplot(3,1,2); disp_budget_mean_mask(TT,alldiag.north_vol_ocn,'kg/m^2','Northern Mean Mass (only ocean)');
428 gforget 1.2 dt=median(diff(TT))*86400; bp=dt*cumsum(alldiag.north_bp);
429     plot(TT,bp,'k'); aa=legend; bb=get(aa,'String'); bb={bb{:},'bp'}; legend(bb,'Orientation','horizontal');
430 heimbach 1.6 subplot(3,1,3); disp_budget_mean_mask(TT,alldiag.south_vol_ocn,'kg/m^2','Southern Mean Mass (only ocean)');
431 gforget 1.2 dt=median(diff(TT))*86400; bp=dt*cumsum(alldiag.south_bp);
432     plot(TT,bp,'k'); aa=legend; bb=get(aa,'String'); bb={bb{:},'bp'}; legend(bb,'Orientation','horizontal');
433     %add to tex file
434     myCaption={myYmeanTxt,' global (upper) north (mid) and south (lower), '};
435 heimbach 1.6 myCaption={myCaption{:},'mass budget (ocean only) in kg/m$^2$.'};
436 gforget 1.2 if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); elseif ~multiTimes; close; end;
437    
438     end;
439    
440     if (kBudget==1)&(sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'heat')));
441    
442     %2.1) ocean+seaice heat budgets
443     %------------------------------
444     figureL;
445 heimbach 1.6 subplot(3,1,1); disp_budget_mean_mask(TT,alldiag.glo_heat_tot,'J/m^2','Global Mean Ocean Heat (incl. ice)');
446     subplot(3,1,2); disp_budget_mean_mask(TT,alldiag.north_heat_tot,'J/m^2','Northern Mean Ocean Heat (incl. ice)');
447     subplot(3,1,3); disp_budget_mean_mask(TT,alldiag.south_heat_tot,'J/m^2','Southern Mean Ocean Heat (incl. ice)');
448 gforget 1.2 %add to tex file
449     myCaption={myYmeanTxt,' global (upper) north (mid) and south (lower), '};
450 heimbach 1.6 myCaption={myCaption{:},'heat budget (ocean+ice) in J/m$^2$.'};
451 gforget 1.2 if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); elseif ~multiTimes; close; end;
452    
453     %2.2) ice heat budgets
454     %---------------------
455     figureL;
456 heimbach 1.6 subplot(3,1,1); disp_budget_mean_mask(TT,alldiag.glo_heat_ice,'J/m^2','Global Mean Ocean Heat (only ice)');
457     subplot(3,1,2); disp_budget_mean_mask(TT,alldiag.north_heat_ice,'J/m^2','Northern Mean Ocean Heat (only ice)');
458     subplot(3,1,3); disp_budget_mean_mask(TT,alldiag.south_heat_ice,'J/m^2','Southern Mean Ocean Heat (only ice)');
459 gforget 1.2 %add to tex file
460     myCaption={myYmeanTxt,' global (upper) north (mid) and south (lower), '};
461 heimbach 1.6 myCaption={myCaption{:},'heat budget (ice only) in J/m$^2$.'};
462 gforget 1.2 if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); elseif ~multiTimes; close; end;
463    
464     end;
465    
466     if (sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'heat')));
467    
468     %2.3) ocean heat budgets
469     %-----------------------
470     figureL;
471 heimbach 1.6 subplot(3,1,1); disp_budget_mean_mask(TT,alldiag.glo_heat_ocn,'J/m^2','Global Mean Ocean Heat (only ocean)');
472     subplot(3,1,2); disp_budget_mean_mask(TT,alldiag.north_heat_ocn,'J/m^2','Northern Mean Ocean Heat (only ocean)');
473     subplot(3,1,3); disp_budget_mean_mask(TT,alldiag.south_heat_ocn,'J/m^2','Southern Mean Ocean Heat (only ocean)');
474 gforget 1.2 %add to tex file
475     myCaption={myYmeanTxt,' global (upper) north (mid) and south (lower), '};
476 heimbach 1.6 myCaption={myCaption{:},'heat budget (ocean only) in J/m$^2$.'};
477 gforget 1.2 if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); elseif ~multiTimes; close; end;
478    
479     end;
480    
481     if (kBudget==1)&(sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'salt')));
482    
483     %3.1) ocean+seaice salt budgets
484     %------------------------------
485     figureL;
486 heimbach 1.6 subplot(3,1,1); disp_budget_mean_mask(TT,alldiag.glo_salt_tot,'g/m^2','Global Mean Ocean Salt (incl. ice)');
487     subplot(3,1,2); disp_budget_mean_mask(TT,alldiag.north_salt_tot,'g/m^2','Northern Mean Ocean Salt (incl. ice)');
488     subplot(3,1,3); disp_budget_mean_mask(TT,alldiag.south_salt_tot,'g/m^2','Southern Mean Ocean Salt (incl. ice)');
489 gforget 1.2 %add to tex file
490     myCaption={myYmeanTxt,' global (upper) north (mid) and south (lower), '};
491 heimbach 1.6 myCaption={myCaption{:},'salt budget (ocean+ice) in g/m$^2$.'};
492 gforget 1.2 if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); elseif ~multiTimes; close; end;
493    
494     %2.2) ice salt budgets
495     %---------------------
496     figureL;
497 heimbach 1.6 subplot(3,1,1); disp_budget_mean_mask(TT,alldiag.glo_salt_ice,'g/m^2','Global Mean Ocean Salt (only ice)');
498     subplot(3,1,2); disp_budget_mean_mask(TT,alldiag.north_salt_ice,'g/m^2','Northern Mean Ocean Salt (only ice)');
499     subplot(3,1,3); disp_budget_mean_mask(TT,alldiag.south_salt_ice,'g/m^2','Southern Mean Ocean Salt (only ice)');
500 gforget 1.2 %add to tex file
501     myCaption={myYmeanTxt,' global (upper) north (mid) and south (lower), '};
502 heimbach 1.6 myCaption={myCaption{:},'salt budget (ice only) in g/m$^2$.'};
503 gforget 1.2 if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); elseif ~multiTimes; close; end;
504    
505     end;
506    
507    
508     if (sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'salt')));
509    
510     %3.3) ocean salt budgets
511     %-----------------------
512     figureL;
513 gforget 1.8 subplot(3,1,1); disp_budget_mean_mask(TT,alldiag.glo_salt_ocn,'g/m^2','Global Mean Ocean Salt (only ocean)');
514     subplot(3,1,2); disp_budget_mean_mask(TT,alldiag.north_salt_ocn,'g/m^2','Northern Mean Ocean Salt (only ocean)');
515     subplot(3,1,3); disp_budget_mean_mask(TT,alldiag.south_salt_ocn,'g/m^2','Southern Mean Ocean Salt (only ocean)');
516 gforget 1.2 %add to tex file
517     myCaption={myYmeanTxt,' global (upper) north (mid) and south (lower), '};
518 heimbach 1.6 myCaption={myCaption{:},'salt budget (ocean only) in g/m$^2$.'};
519 gforget 1.2 if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); elseif ~multiTimes; close; end;
520    
521     end;
522    
523 gforget 1.1 end;

  ViewVC Help
Powered by ViewVC 1.1.22