1 |
|
2 |
c ================================================================== |
3 |
c HEADER AVERAGES |
4 |
c ================================================================== |
5 |
c |
6 |
c o Header for averaged temperature, salinity, and surface pressure |
7 |
c fields and counters associated with the averaging. |
8 |
c |
9 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
10 |
c |
11 |
c changed: Christian Eckert eckert@mit.edu 01-Mar-2000 |
12 |
c |
13 |
c - Restructured the code in order to create a package |
14 |
c for the MITgcmUV. |
15 |
c |
16 |
c ================================================================== |
17 |
c HEADER AVERAGES |
18 |
c ================================================================== |
19 |
|
20 |
c Averaging counters: |
21 |
c =================== |
22 |
c |
23 |
c sum1day - counter for the daily averaging |
24 |
c sum1mon - counter for the monthly averaging |
25 |
c dayrec - number of averaged surface pressure records. |
26 |
c monrec - number of averaged theta and salinity records. |
27 |
|
28 |
common /average_i/ |
29 |
& sum1day,sum1mon, |
30 |
& dayrec,monrec |
31 |
integer sum1day |
32 |
integer sum1mon |
33 |
integer dayrec |
34 |
integer monrec |
35 |
|
36 |
|
37 |
c Averaged Fields: |
38 |
c ================ |
39 |
c |
40 |
c tbar - contains the averaged temperature field after the call |
41 |
c to subroutine POST_MONTHLY. Before, it accumulates the |
42 |
c intantaneous temperatures. |
43 |
c sbar - contains the averaged salinity field after the call |
44 |
c to subroutine POST_MONTHLY. Before, it accumulates the |
45 |
c intantaneous salinities. |
46 |
c psbar - contains the averaged surface pressure field after the call |
47 |
c to subroutine POST_DAILY. Before, it accumulates the |
48 |
c intantaneous surface pressure field. |
49 |
|
50 |
common /averages_r/ |
51 |
& tbar, |
52 |
& sbar, |
53 |
& psbar |
54 |
|
55 |
#ifdef ALLOW_THETA_COST_CONTRIBUTION || ALLOW_CTDT_COST_CONTRIBUTION |
56 |
_RL tbar (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
57 |
#else |
58 |
#ifdef ALLOW_SST_COST_CONTRIBUTION |
59 |
_RL tbar (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
60 |
#else |
61 |
_RL tbar |
62 |
#endif |
63 |
#endif |
64 |
|
65 |
#ifdef ALLOW_SALT_COST_CONTRIBUTION || ALLOW_CTDS_COST_CONTRIBUTION |
66 |
_RL sbar (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
67 |
#else |
68 |
_RL sbar |
69 |
#endif |
70 |
|
71 |
#ifdef ALLOW_SSH_COST_CONTRIBUTION |
72 |
_RL psbar (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
73 |
#else |
74 |
_RL psbar |
75 |
#endif |
76 |
|
77 |
common /averages_c/ |
78 |
& tbarfile, |
79 |
& sbarfile, |
80 |
& psbarfile |
81 |
character*(MAX_LEN_FNAM) tbarfile |
82 |
character*(MAX_LEN_FNAM) sbarfile |
83 |
character*(MAX_LEN_FNAM) psbarfile |
84 |
|
85 |
c file precision and field type |
86 |
|
87 |
common /prec_type_cost/ |
88 |
& iprec_cost, |
89 |
& yftype_cost |
90 |
|
91 |
integer iprec_cost |
92 |
character*(2) yftype_cost |
93 |
|
94 |
c ================================================================== |
95 |
c END OF HEADER AVERAGES |
96 |
c ================================================================== |
97 |
|
98 |
|
99 |
|
100 |
c ================================================================== |
101 |
c HEADER COST |
102 |
c ================================================================== |
103 |
c |
104 |
c o Header for model-data comparison. |
105 |
c |
106 |
c The individual cost function contributions are multiplied by |
107 |
c factors mult_"var" which allow to switch off these contributions |
108 |
c without removing them in the adjoint code. This is useful for |
109 |
c doing tests with the adjoint and perhaps useful in assimilation |
110 |
c experiments where individual contributions are successively |
111 |
c switched on. For future applications it would be better to place |
112 |
c the initialisation of the multipliers somewhere else, for example |
113 |
c in a namelist, which is read in at the start of the model. |
114 |
c |
115 |
c started: Christian Eckert eckert@mit.edu 24-Feb-1999 |
116 |
c |
117 |
c changed: Christian Eckert eckert@mit.edu |
118 |
c |
119 |
c |
120 |
c ================================================================== |
121 |
c HEADER COST |
122 |
c ================================================================== |
123 |
|
124 |
|
125 |
c The cost function, its contributions, and multipliers: |
126 |
c ====================================================== |
127 |
c |
128 |
c fc - Final cost function. |
129 |
c objf_hflux - Heat flux contribution. |
130 |
c objf_sflux - Salt flux contribution. |
131 |
c objf_tauu - Zonal wind stress contribution. |
132 |
c objf_tauv - Meridional wind stress contribution. |
133 |
c objf_hmean - Mean sea surface height contribution. |
134 |
c objf_h - Residual sea surface height contribution. |
135 |
c objf_temp - Temperature contribution. |
136 |
c objf_salt - Salinity contribution. |
137 |
c objf_sst - Sea surface temperature contribution. |
138 |
c objf_atl - Meridional heat transport in the N-Atlantic |
139 |
c objf_ctdt - Temperature measurements from Woce CTD |
140 |
c objf_ctds - Salinity measurements from Woce CTD |
141 |
c |
142 |
c mult_"var" - multipliers for the individual cost |
143 |
c function contributions. |
144 |
|
145 |
common /cost_r/ |
146 |
& fc, |
147 |
& objf_hflux, |
148 |
& objf_sflux, |
149 |
& objf_tauu, |
150 |
& objf_tauv, |
151 |
& objf_hmean, |
152 |
& objf_h, |
153 |
& objf_temp, |
154 |
& objf_salt, |
155 |
& objf_sst, |
156 |
& objf_atl, |
157 |
& objf_ctdt, |
158 |
& objf_ctds, |
159 |
& objf_test, |
160 |
& objf_tracer, |
161 |
& objf_entropy, |
162 |
& objf_t_misfit, |
163 |
& objf_eflux |
164 |
|
165 |
_RL fc |
166 |
_RL objf_hflux (nsx,nsy) |
167 |
_RL objf_sflux (nsx,nsy) |
168 |
_RL objf_tauu (nsx,nsy) |
169 |
_RL objf_tauv (nsx,nsy) |
170 |
_RL objf_hmean |
171 |
_RL objf_h (nsx,nsy) |
172 |
_RL objf_temp (nsx,nsy) |
173 |
_RL objf_salt (nsx,nsy) |
174 |
_RL objf_sst (nsx,nsy) |
175 |
_RL objf_atl (nsx,nsy) |
176 |
_RL objf_ctdt (nsx,nsy) |
177 |
_RL objf_ctds (nsx,nsy) |
178 |
_RL objf_test (nsx,nsy) |
179 |
_RL objf_tracer (nsx,nsy) |
180 |
_RL objf_entropy (nsx,nsy) |
181 |
_RL objf_t_misfit (nsx,nsy) |
182 |
_RL objf_eflux (nsx,nsy) |
183 |
|
184 |
#ifdef ALLOW_COST_VECTOR |
185 |
common /cost_array/ |
186 |
& objf_vector |
187 |
_RL objf_vector (snx,nsx,nsy) |
188 |
#endif |
189 |
|
190 |
#ifdef ALLOW_COST_VECTOR |
191 |
common /cost_array/ |
192 |
& objf_vector |
193 |
_RL objf_vector (snx,nsx,nsy) |
194 |
#endif |
195 |
|
196 |
common /cost_aux_r/ |
197 |
& mult_hq, |
198 |
& mult_hs, |
199 |
& mult_tauu, |
200 |
& mult_tauv, |
201 |
& mult_hmean, |
202 |
& mult_h, |
203 |
& mult_temp, |
204 |
& mult_salt, |
205 |
& mult_sst, |
206 |
& mult_atl, |
207 |
& mult_ctdt, |
208 |
& mult_ctds, |
209 |
& mult_test, |
210 |
& mult_tracer, |
211 |
& mult_entropy, |
212 |
& mult_t_misfit, |
213 |
& mult_eflux |
214 |
|
215 |
_RL mult_hq |
216 |
_RL mult_hs |
217 |
_RL mult_tauu |
218 |
_RL mult_tauv |
219 |
_RL mult_hmean |
220 |
_RL mult_h |
221 |
_RL mult_temp |
222 |
_RL mult_salt |
223 |
_RL mult_sst |
224 |
_RL mult_atl |
225 |
_RL mult_ctdt |
226 |
_RL mult_ctds |
227 |
_RL mult_test |
228 |
_RL mult_tracer |
229 |
_RL mult_entropy |
230 |
_RL mult_t_misfit |
231 |
_RL mult_eflux |
232 |
|
233 |
c Record counters relevant for the cost function evaluation. |
234 |
c ========================================================== |
235 |
c |
236 |
c nmonsrec - number of monthly records that will be generated by |
237 |
c the current model integration. |
238 |
c ndaysrec - number of daily records that will be generated by |
239 |
c the current model integration. |
240 |
|
241 |
common /cost_i/ |
242 |
& nmonsrec, |
243 |
& ndaysrec |
244 |
integer nmonsrec |
245 |
integer ndaysrec |
246 |
|
247 |
|
248 |
c Data files for the weights used in the cost function: |
249 |
c ===================================================== |
250 |
c |
251 |
c hflux_errfile - heat flux error. |
252 |
c sflux_errfile - salt flux error. |
253 |
c tauu_errfile - zonal wind stress error. |
254 |
c tauv_errfile - meridional wind stress error. |
255 |
c data_errfile - weights for theta, salt, and SST |
256 |
c geoid_errfile - geoid error. |
257 |
c geoid_covariancefile - geoid error covariance. |
258 |
c ssh_errfile - sea surface height error. |
259 |
c ctdt_errfile - CTD temperature error. |
260 |
c ctds_errfile - CTD salinity error. |
261 |
|
262 |
common /cost_c/ |
263 |
& hflux_errfile, |
264 |
& sflux_errfile, |
265 |
& tauu_errfile, |
266 |
& tauv_errfile, |
267 |
& data_errfile, |
268 |
& geoid_errfile, |
269 |
& geoid_covariancefile, |
270 |
& ssh_errfile, |
271 |
& ctdt_errfile, |
272 |
& ctds_errfile |
273 |
character*(MAX_LEN_FNAM) hflux_errfile |
274 |
character*(MAX_LEN_FNAM) sflux_errfile |
275 |
character*(MAX_LEN_FNAM) tauu_errfile |
276 |
character*(MAX_LEN_FNAM) tauv_errfile |
277 |
character*(MAX_LEN_FNAM) data_errfile |
278 |
character*(MAX_LEN_FNAM) geoid_errfile |
279 |
character*(MAX_LEN_FNAM) geoid_covariancefile |
280 |
character*(MAX_LEN_FNAM) ssh_errfile |
281 |
character*(MAX_LEN_FNAM) ctdt_errfile |
282 |
character*(MAX_LEN_FNAM) ctds_errfile |
283 |
|
284 |
|
285 |
c Arrays where the weights are stored: |
286 |
c ==================================== |
287 |
c |
288 |
c cosphi - cosine of latitude. |
289 |
c whflux - weight for heat flux. |
290 |
c wsflux - weight for salt flux. |
291 |
c wtauu - weight for zonal wind stress. |
292 |
c wtauu - weight for meridional wind stress. |
293 |
c wtheta - weight for temperature. |
294 |
c wsst - weight for sea surface temperature. |
295 |
c wsalt - weight for salinity. |
296 |
c wtp - weight for TOPEX/POSEIDON data. |
297 |
c wers - weight for ERS data. |
298 |
c wp - weight for geoid. |
299 |
c wctdt - weight for CTD temperature. |
300 |
c wctds - weight for CTD salinity. |
301 |
|
302 |
common /cost_weights_r/ |
303 |
& frame, |
304 |
& cosphi, |
305 |
& whflux,wsflux,wtauu,wtauv, |
306 |
& wtheta,wsst, |
307 |
& wsalt, |
308 |
& wtp,wers, |
309 |
& wp, |
310 |
& wctdt,wctds, |
311 |
& wunit, |
312 |
& wefluxy,wefluxp |
313 |
_RL frame (1-olx:snx+olx,1-oly:sny+oly ) |
314 |
_RL cosphi (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
315 |
_RL whflux (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
316 |
_RL wsflux (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
317 |
_RL wtauu (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
318 |
_RL wtauv (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
319 |
_RL wsst (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
320 |
_RL wtp (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
321 |
_RL wers (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
322 |
_RL wp (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
323 |
_RL wtheta ( nr,nsx,nsy) |
324 |
_RL wsalt ( nr,nsx,nsy) |
325 |
_RL wctdt ( nr,nsx,nsy) |
326 |
_RL wctds ( nr,nsx,nsy) |
327 |
_RL wunit ( nr,nsx,nsy) |
328 |
_RL wefluxy ( nr,nsx,nsy) |
329 |
_RL wefluxp ( nr,nsx,nsy) |
330 |
|
331 |
|
332 |
c Arrays that contain observations for the model-data comparison: |
333 |
c =============================================================== |
334 |
c |
335 |
c tdat - reference temperature data. |
336 |
c sstdat - reference sea surface temperature data. |
337 |
c sstmask - mask for reference sea surface temperature data. |
338 |
c sdat - reference salinity data. |
339 |
c tpmean - reference mean sea surface height data. |
340 |
c tpmeanmask - mask for reference mean sea surface height data. |
341 |
c tpobs - TOPEX/POSEIDON data. |
342 |
c tpmask - mask for TOPEX/POSEIDON data. |
343 |
c ersobs - ERS data. |
344 |
c ersmask - mask for ERS data. |
345 |
c ctdtobs - CTD temperature data |
346 |
c ctdsobs - CTD salinity data |
347 |
c ctdmask - mask for CTD |
348 |
|
349 |
common /cost_data_r/ |
350 |
& tdat, |
351 |
& sstdat, |
352 |
& sstmask, |
353 |
& sdat, |
354 |
& tpmean, |
355 |
& tpmeanmask, |
356 |
& tpobs, |
357 |
& tpmask, |
358 |
& ersobs, |
359 |
& ersmask, |
360 |
& ctdtobs, |
361 |
& ctdsobs, |
362 |
& ctdmask |
363 |
_RL tdat (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
364 |
_RL sstdat (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
365 |
_RL sstmask (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
366 |
_RL sdat (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
367 |
_RL tpmean (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
368 |
_RL tpmeanmask(1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
369 |
_RL tpobs (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
370 |
_RL tpmask (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
371 |
_RL ersobs (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
372 |
_RL ersmask (1-olx:snx+olx,1-oly:sny+oly, nsx,nsy) |
373 |
_RL ctdtobs (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
374 |
_RL ctdsobs (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
375 |
_RL ctdmask (1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
376 |
|
377 |
|
378 |
c Files that contain obervations: |
379 |
c =============================== |
380 |
c |
381 |
c tdatfile - reference data file for temperature. |
382 |
c sdatfile - reference data file for salinity. |
383 |
c sstdatfile - reference data file for sea surface temperature. |
384 |
c topexmeanfile - reference data file for mean sea surface height. |
385 |
c topexfile - reference data file for sea surface height data |
386 |
c (TOPEX/POSEIDON). |
387 |
c ersfile - reference data file for sea surface height data |
388 |
c (ERS). |
389 |
c ctdtfile, ctdsfile- reference data file for temperature and salinity |
390 |
c from CTD |
391 |
|
392 |
common /cost_data_c/ |
393 |
& tdatfile, |
394 |
& sdatfile, |
395 |
& sstdatfile, |
396 |
& topexmeanfile, |
397 |
& topexfile, |
398 |
& ersfile, |
399 |
& ctdtfile, |
400 |
& ctdsfile |
401 |
character*(MAX_LEN_FNAM) tdatfile |
402 |
character*(MAX_LEN_FNAM) sdatfile |
403 |
character*(MAX_LEN_FNAM) sstdatfile |
404 |
character*(MAX_LEN_FNAM) topexmeanfile |
405 |
character*(MAX_LEN_FNAM) topexfile |
406 |
character*(MAX_LEN_FNAM) ersfile |
407 |
character*(MAX_LEN_FNAM) ctdtfile |
408 |
character*(MAX_LEN_FNAM) ctdsfile |
409 |
|
410 |
|
411 |
c Flags used in the model-data comparison: |
412 |
c ======================================== |
413 |
c |
414 |
c using_ers - flag that indicates the use of ERS data |
415 |
|
416 |
common /cost_data_flags/ |
417 |
& using_topex, |
418 |
& using_ers |
419 |
logical using_topex |
420 |
logical using_ers |
421 |
|
422 |
|
423 |
c Calendar information for the observations: |
424 |
c ========================================== |
425 |
c |
426 |
c sststartdate - start date of the sea surface temperature data. |
427 |
c topexstartdate - start date of the sea surface height data. |
428 |
c ersstartdate - start date of the sea surface height data. |
429 |
c sshperiod - sampling interval for the sea surface height data. |
430 |
|
431 |
common /cost_data_times_i/ |
432 |
& sststartdate, |
433 |
& topexstartdate, |
434 |
& ersstartdate |
435 |
integer sststartdate(4) |
436 |
integer topexstartdate(4) |
437 |
integer ersstartdate(4) |
438 |
|
439 |
|
440 |
common /cost_data_times_r/ |
441 |
& topexperiod, |
442 |
& ersperiod |
443 |
_RL topexperiod |
444 |
_RL ersperiod |
445 |
|
446 |
#ifdef ALLOW_COST_TEST |
447 |
common /cost_test_i/ |
448 |
& iLocOut |
449 |
& , jLocOut |
450 |
& , kLocOut |
451 |
integer iLocOut |
452 |
integer jLocOut |
453 |
integer kLocOut |
454 |
#endif |
455 |
|
456 |
c ================================================================== |
457 |
c END OF HEADER COST |
458 |
c ================================================================== |
459 |
|
460 |
|