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

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

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


Revision 1.10 - (hide annotations) (download)
Mon Feb 8 23:37:57 2016 UTC (9 years, 5 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.9: +13 -13 lines
- rename cont as tend in calc_budget_????.m

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 gforget 1.2 tmp1=sprintf('E%02i',kBudget);
14 gforget 1.1 end;
15     fileMat=['diags_set_' tmp1];
16    
17     if userStep==1;%diags to be computed
18     listDiags=['zm_area zm_vol_ocn zm_vol_tot zm_vol_ice'];
19     listDiags=[listDiags ' zm_heat_ocn zm_heat_tot zm_heat_ice zm_heat_ocn_diff'];
20     listDiags=[listDiags ' zm_salt_ocn zm_salt_tot zm_salt_ice zm_salt_ocn_diff'];
21     elseif userStep==2;%input files and variables
22 gforget 1.6 listFlds={ 'ETAN','SIheff','SIhsnow','THETA ','SALT ','PHIBOT','geothFlux'};
23 gforget 1.1 listFlds={listFlds{:},'SIatmFW ','oceFWflx','SItflux','TFLUX','SFLUX','oceSPflx','SRELAX'};
24     listFlds={listFlds{:},'oceQnet ','SIatmQnt','SIaaflux','SIsnPrcp','SIacSubl'};
25     listFlds={listFlds{:},'TRELAX','WTHMASS','WSLTMASS','oceSflux','oceQsw','oceSPtnd'};
26     if kBudget>1;
27     listFlds={listFlds{:},'ADVr_TH','DFrE_TH','DFrI_TH','ADVr_SLT','DFrE_SLT','DFrI_SLT','WVELMASS'};
28     end;
29     listFlds={listFlds{:},'UVELMASS','VVELMASS','AB_gT','AB_gS'};
30     listFlds={listFlds{:},'ADVx_TH ','ADVy_TH ','DFxE_TH ','DFyE_TH '};
31     listFlds={listFlds{:},'ADVx_SLT','ADVy_SLT','DFxE_SLT','DFyE_SLT'};
32     listFlds={listFlds{:},'ADVxHEFF','ADVyHEFF','DFxEHEFF','DFyEHEFF'};
33     listFlds={listFlds{:},'ADVxSNOW','ADVySNOW','DFxESNOW','DFyESNOW'};
34     listFldsNames=deblank(listFlds);
35     %
36     listFiles={'rate_budg2d_snap_set1','budg2d_hflux_set1','budg2d_zflux_set1','budg2d_zflux_set2'};
37     if kBudget==1;
38 gforget 1.6 listFiles={listFiles{:},'rate_budg2d_snap_set2','budg2d_hflux_set2','geothermalFlux'};
39 gforget 1.1 else;
40     tmp1=sprintf('rate_budg2d_snap_set3_%02i',kBudget);
41     tmp2=sprintf('budg2d_zflux_set3_%02i',kBudget);
42     tmp3=sprintf('budg2d_hflux_set3_%02i',kBudget);
43 gforget 1.6 tmp4=sprintf('geothermalFlux_%02i',kBudget);
44     listFiles={listFiles{:},tmp1,tmp2,tmp3,tmp4};
45 gforget 1.1 end;
46 gforget 1.5 listSubdirs={[dirMat 'BUDG/' ],[dirMat '../BUDG/' ],[dirModel 'diags/BUDG/'],[dirModel 'diags/']};
47 gforget 1.1 elseif userStep==3;%computational part;
48    
49     %preliminary tests
50     test1=isempty(dir([dirModel 'diags/BUDG/budg2d_snap_set1*']));
51 gforget 1.2 test2=isempty(dir([dirMat 'BUDG/rate_budg2d_snap_set1*']))&...
52     isempty(dir([dirMat '../BUDG/rate_budg2d_snap_set1*']));
53 gforget 1.1
54 gforget 1.2 if (strcmp(setDiags,'E')&test1&test2);
55 gforget 1.1 fprintf('\n abort : global and regional budgets, due to missing \n');
56     fprintf(['\n ' dirModel 'diags/BUDG/budg2d_snap_set1* \n']);
57     return;
58     end;
59    
60 gforget 1.2 if (strcmp(setDiags,'E')&test2);
61 gforget 1.1 fprintf('\n abort : global and regional budgets, due to missing \n');
62     fprintf(['\n ' dirModel 'diags/BUDG/rate_budg2d_snap_set1* \n']);
63     return;
64     end;
65    
66     %override default file name:
67     %---------------------------
68     tmp1=setDiags;
69     if kBudget>1;
70     tmp1=sprintf('E%02i',kBudget);
71     end;
72     fileMat=['diags_set_' tmp1 '_' num2str(tt) '.mat'];
73    
74     %fill in optional fields:
75     %------------------------
76     if isempty(who('TRELAX')); TRELAX=0*mygrid.XC; end;
77     if isempty(who('SRELAX')); SRELAX=0*mygrid.XC; end;
78     if isempty(who('AB_gT')); AB_gT=0*mygrid.XC; end;
79     if isempty(who('AB_gS')); AB_gS=0*mygrid.XC; end;
80     if isempty(who('oceSPtnd')); oceSPtnd=0*mygrid.XC; end;
81     if isempty(who('oceSPflx')); oceSPflx=0*mygrid.XC; end;
82     if isempty(who('PHIBOT')); PHIBOT=0*mygrid.XC; end;
83 gforget 1.6 if isempty(who('geothFlux')); geothFlux=0; end;
84 gforget 1.1
85     %=======MASS=========
86 gforget 1.6
87 gforget 1.8 [budgMo,budgMi,budgMoi]=calc_budget_mass(kBudget);
88 gforget 1.6
89 gforget 1.1 %bottom pressure for comparison:
90     bp=myparms.rhoconst/9.81*PHIBOT;
91 gforget 1.6
92 gforget 1.9 [tmp1,X,Y,zm_area]=calc_zonmean_T(budgMoi,-2,'extensive');
93     zm_area=zm_area';
94 gforget 1.10 zm_vol_tot=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
95 gforget 1.9 tmp1=calc_zonmean_T(budgMo,-2,'extensive');
96 gforget 1.10 zm_vol_ocn=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
97 gforget 1.9 tmp1=calc_zonmean_T(budgMi,-2,'extensive');
98 gforget 1.10 zm_vol_ice=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
99 gforget 1.1
100     %=======HEAT=======
101    
102 gforget 1.8 [budgHo,budgHi,budgHoi]=calc_budget_heat(kBudget);
103 gforget 1.6
104 gforget 1.9 [tmp1]=calc_zonmean_T(budgHoi,-2,'extensive');
105 gforget 1.10 zm_heat_tot=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
106 gforget 1.9 tmp1=calc_zonmean_T(budgHo,-2,'extensive');
107 gforget 1.10 zm_heat_ocn=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
108 gforget 1.9 tmp1=calc_zonmean_T(budgHi,-2,'extensive');
109 gforget 1.10 zm_heat_ice=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
110 gforget 1.1
111     %ocean diffusion alone
112     tmpU=myparms.rcp*(DFxE_TH); tmpV=myparms.rcp*(DFyE_TH);
113 gforget 1.8 budgD.hconv=calc_UV_conv(tmpU,tmpV);
114 gforget 1.10 budgD.tend=0*budgD.hconv; budgD.zconv=0*budgD.hconv;
115 gforget 1.9 [tmp1]=calc_zonmean_T(budgD,-2,'extensive');
116 gforget 1.10 zm_heat_ocn_diff=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
117 gforget 1.1
118     %=======SALT=======
119    
120 gforget 1.8 [budgSo,budgSi,budgSoi]=calc_budget_salt(kBudget);
121 gforget 1.6
122 gforget 1.9 [tmp1]=calc_zonmean_T(budgSoi,-2,'extensive');
123 gforget 1.10 zm_salt_tot=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
124 gforget 1.9 tmp1=calc_zonmean_T(budgSo,-2,'extensive');
125 gforget 1.10 zm_salt_ocn=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
126 gforget 1.9 tmp1=calc_zonmean_T(budgSi,-2,'extensive');
127 gforget 1.10 zm_salt_ice=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
128 gforget 1.1
129     %ocean diffusion alone
130     tmpU=myparms.rhoconst*(DFxE_SLT); tmpV=myparms.rhoconst*(DFyE_SLT);
131 gforget 1.8 budgD.hconv=calc_UV_conv(tmpU,tmpV);
132 gforget 1.10 budgD.tend=0*budgD.hconv; budgD.zconv=0*budgD.hconv;
133 gforget 1.9 [tmp1]=calc_zonmean_T(budgD,-2,'extensive');
134 gforget 1.10 zm_salt_ocn_diff=[tmp1.tend';tmp1.hconv';tmp1.zconv'];
135 gforget 1.9
136 gforget 1.1 %===================== COMPUTATIONAL SEQUENCE ENDS =========================%
137     %===================== PLOTTING SEQUENCE BEGINS =========================%
138    
139     elseif userStep==-1;%plotting
140    
141     if isempty(setDiagsParams);
142     choicePlot={'all'};
143     elseif isnumeric(setDiagsParams{1})&length(setDiagsParams)==1;
144     choicePlot={'all'};
145     elseif isnumeric(setDiagsParams{1});
146     choicePlot={setDiagsParams{2:end}};
147     else;
148     choicePlot=setDiagsParams;
149     end;
150    
151     tt=[1:length(alldiag.listTimes)];
152     TT=alldiag.listTimes(tt);
153     nt=length(TT);
154    
155     if (kBudget==1)&(sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'mass')));
156    
157     %1.1) ocean+seaice mass budgets
158     %------------------------------
159     figureL;
160     %volume budget:
161     subplot(2,1,1); disp_budget_mean_zonal(mygrid.LATS,alldiag.zm_vol_tot,'kg/m2','Mass (incl. ice)');
162     %cumulative integral:
163 gforget 1.4 tmp1=repmat(alldiag.zm_area,[3 1 1]);
164     tmp1=tmp1.*alldiag.zm_vol_tot; cumbudg=cumsum(tmp1,2);
165 gforget 1.1 subplot(2,1,2); disp_budget_mean_zonal(mygrid.LATS,cumbudg,'kg','Mass (incl. ice)');
166     %add to tex file
167     myCaption={myYmeanTxt,'mass budget (ocean+ice) at each latitude in kg/m2 (upper) and integrated from South (lower).'};
168     if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); end;
169    
170     %1.2) ice mass budgets
171     %---------------------
172     figureL;
173     %volume budget:
174     subplot(2,1,1); disp_budget_mean_zonal(mygrid.LATS,alldiag.zm_vol_ice,'kg/m2','Mass (only ice)');
175     %cumulative integral:
176 gforget 1.4 tmp1=repmat(alldiag.zm_area,[3 1 1]);
177     tmp1=tmp1.*alldiag.zm_vol_ice; cumbudg=cumsum(tmp1,2);
178 gforget 1.1 subplot(2,1,2); disp_budget_mean_zonal(mygrid.LATS,cumbudg,'kg','Mass (only ice)');
179     %add to tex file
180     myCaption={myYmeanTxt,'mass budget (only ice) at each latitude in kg/m2 (upper) and integrated from South (lower).'};
181     if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); end;
182     end;
183    
184     if (sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'mass')));
185    
186     %1.3) ocean mass budgets
187     %-----------------------
188     figureL;
189     %volume budget:
190     subplot(2,1,1); disp_budget_mean_zonal(mygrid.LATS,alldiag.zm_vol_ocn,'kg/m2','Mass (ocean only)');
191     %cumulative integral:
192 gforget 1.4 tmp1=repmat(alldiag.zm_area,[3 1 1]);
193     tmp1=tmp1.*alldiag.zm_vol_ocn; cumbudg=cumsum(tmp1,2);
194 gforget 1.1 subplot(2,1,2); disp_budget_mean_zonal(mygrid.LATS,cumbudg,'kg','Mass (ocean only)');
195     %add to tex file
196     myCaption={myYmeanTxt,'mass budget (ocean only) at each latitude in kg/m2 (upper) and integrated from South (lower).'};
197     if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); end;
198    
199     end;
200    
201     if (kBudget==1)&(sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'heat')));
202    
203     %1.1) ocean+seaice heat budgets
204     %------------------------------
205     figureL;
206     %heat budget:
207     subplot(2,1,1); disp_budget_mean_zonal(mygrid.LATS,alldiag.zm_heat_tot,'J/m2','Heat (incl. ice)');
208     %cumulative integral:
209 gforget 1.4 tmp1=repmat(alldiag.zm_area,[3 1 1]);
210     tmp1=tmp1.*alldiag.zm_heat_tot; cumbudg=cumsum(tmp1,2);
211 gforget 1.1 subplot(2,1,2); disp_budget_mean_zonal(mygrid.LATS,cumbudg,'J','Heat (incl. ice)');
212     %add to tex file
213     myCaption={myYmeanTxt,'heat budget (ocean+ice) at each latitude in J/m2 (upper) and integrated from South (lower).'};
214     if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); end;
215    
216     %1.2) ice heat budgets
217     %---------------------
218     figureL;
219     %heat budget:
220     subplot(2,1,1); disp_budget_mean_zonal(mygrid.LATS,alldiag.zm_heat_ice,'J/m2','Heat (only ice)');
221     %cumulative integral:
222 gforget 1.4 tmp1=repmat(alldiag.zm_area,[3 1 1]);
223     tmp1=tmp1.*alldiag.zm_heat_ice; cumbudg=cumsum(tmp1,2);
224 gforget 1.1 subplot(2,1,2); disp_budget_mean_zonal(mygrid.LATS,cumbudg,'J','Heat (only ice)');
225     %add to tex file
226     myCaption={myYmeanTxt,'heat budget (only ice) at each latitude in J/m2 (upper) and integrated from South (lower).'};
227     if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); end;
228     end;
229    
230     if (sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'heat')));
231    
232     %1.3) ocean heat budgets
233     %-----------------------
234     figureL;
235     %heat budget:
236     subplot(2,1,1); disp_budget_mean_zonal(mygrid.LATS,alldiag.zm_heat_ocn,'J/m2','Heat (ocean only)');
237     %cumulative integral:
238 gforget 1.4 tmp1=repmat(alldiag.zm_area,[3 1 1]);
239     tmp1=tmp1.*alldiag.zm_heat_ocn; cumbudg=cumsum(tmp1,2);
240 gforget 1.1 subplot(2,1,2); disp_budget_mean_zonal(mygrid.LATS,cumbudg,'J','Heat (ocean only)');
241     %add to tex file
242     myCaption={myYmeanTxt,'heat budget (ocean only) at each latitude in J/m2 (upper) and integrated from South (lower).'};
243     if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); end;
244    
245     end;
246    
247     if (kBudget==1)&(sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'salt')));
248    
249     %1.1) ocean+seaice salt budgets
250     %------------------------------
251     figureL;
252     %salt budget:
253     subplot(2,1,1); disp_budget_mean_zonal(mygrid.LATS,alldiag.zm_salt_tot,'g/m2','Salt (incl. ice)');
254     %cumulative integral:
255 gforget 1.4 tmp1=repmat(alldiag.zm_area,[3 1 1]);
256     tmp1=tmp1.*alldiag.zm_salt_tot; cumbudg=cumsum(tmp1,2);
257 gforget 1.1 subplot(2,1,2); disp_budget_mean_zonal(mygrid.LATS,cumbudg,'g','Salt (incl. ice)');
258     %add to tex file
259     myCaption={myYmeanTxt,'salt budget (ocean+ice) at each latitude in g/m2 (upper) and integrated from South (lower).'};
260     if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); end;
261    
262     %1.2) ice salt budgets
263     %---------------------
264     figureL;
265     %salt budget:
266     subplot(2,1,1); disp_budget_mean_zonal(mygrid.LATS,alldiag.zm_salt_ice,'g/m2','Salt (only ice)');
267     %cumulative integral:
268 gforget 1.4 tmp1=repmat(alldiag.zm_area,[3 1 1]);
269     tmp1=tmp1.*alldiag.zm_salt_ice; cumbudg=cumsum(tmp1,2);
270 gforget 1.1 subplot(2,1,2); disp_budget_mean_zonal(mygrid.LATS,cumbudg,'g','Salt (only ice)');
271     %add to tex file
272     myCaption={myYmeanTxt,'salt budget (only ice) at each latitude in g/m2 (upper) and integrated from South (lower).'};
273     if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); end;
274     end;
275    
276     if (sum(strcmp(choicePlot,'all'))|sum(strcmp(choicePlot,'salt')));
277    
278     %1.3) ocean salt budgets
279     %-----------------------
280     figureL;
281     %salt budget:
282     subplot(2,1,1); disp_budget_mean_zonal(mygrid.LATS,alldiag.zm_salt_ocn,'g/m2','Salt (ocean only)');
283     %cumulative integral:
284 gforget 1.4 tmp1=repmat(alldiag.zm_area,[3 1 1]);
285     tmp1=tmp1.*alldiag.zm_salt_ocn; cumbudg=cumsum(tmp1,2);
286 gforget 1.1 subplot(2,1,2); disp_budget_mean_zonal(mygrid.LATS,cumbudg,'g','Salt (ocean only)');
287     %add to tex file
288     myCaption={myYmeanTxt,'salt budget (ocean only) at each latitude in g/m2 (upper) and integrated from South (lower).'};
289     if addToTex&multiTimes; write2tex(fileTex,2,myCaption,gcf); end;
290    
291     end;
292    
293     end;
294    

  ViewVC Help
Powered by ViewVC 1.1.22