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