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