SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
mode_glt_dia_ar5.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 !GLT_LIC The GELATO model is a seaice model used in stand-alone or embedded mode.
6 !GLT_LIC It has been developed by Meteo-France. The holder of GELATO is Meteo-France.
7 !GLT_LIC
8 !GLT_LIC This software is governed by the CeCILL-C license under French law and biding
9 !GLT_LIC by the rules of distribution of free software. See the CeCILL-C_V1-en.txt
10 !GLT_LIC (English) and CeCILL-C_V1-fr.txt (French) for details. The CeCILL is a free
11 !GLT_LIC software license, explicitly compatible with the GNU GPL
12 !GLT_LIC (see http://www.gnu.org/licenses/license-list.en.html#CeCILL)
13 !GLT_LIC
14 !GLT_LIC The CeCILL-C licence agreement grants users the right to modify and re-use the
15 !GLT_LIC software governed by this free software license. The exercising of this right
16 !GLT_LIC is conditional upon the obligation to make available to the community the
17 !GLT_LIC modifications made to the source code of the software so as to contribute to
18 !GLT_LIC its evolution.
19 !GLT_LIC
20 !GLT_LIC In consideration of access to the source code and the rights to copy, modify
21 !GLT_LIC and redistribute granted by the license, users are provided only with a limited
22 !GLT_LIC warranty and the software's author, the holder of the economic rights, and the
23 !GLT_LIC successive licensors only have limited liability. In this respect, the risks
24 !GLT_LIC associated with loading, using, modifying and/or developing or reproducing the
25 !GLT_LIC software by the user are brought to the user's attention, given its Free
26 !GLT_LIC Software status, which may make it complicated to use, with the result that its
27 !GLT_LIC use is reserved for developers and experienced professionals having in-depth
28 !GLT_LIC computer knowledge. Users are therefore encouraged to load and test the
29 !GLT_LIC suitability of the software as regards their requirements in conditions enabling
30 !GLT_LIC the security of their systems and/or data to be ensured and, more generally, to
31 !GLT_LIC use and operate it in the same conditions of security.
32 !GLT_LIC
33 !GLT_LIC The GELATO sofware is cureently distibuted with the SURFEX software, available at
34 !GLT_LIC http://www.cnrm.meteo.fr/surfex. The fact that you download the software deemed that
35 !GLT_LIC you had knowledge of the CeCILL-C license and that you accept its terms.
36 !GLT_LIC Attempts to use this software in a way not complying with CeCILL-C license
37 !GLT_LIC may lead to prosecution.
38 !GLT_LIC
39 ! =======================================================================
40 ! ========================= MODULE mode_glt_dia_ar5 =========================
41 ! =======================================================================
42 !
43 !
44 ! * Contains a subroutine that writes model glt_output in Gelato format
45 !
46 ! --------------------- BEGIN MODULE mode_glt_dia_ar5 -----------------------
47 
49  CONTAINS
50 !
51 !
52 ! -----------------------------------------------------------------------
53 ! ------------------------ SUBROUTINE WRIDIA_AR5 ------------------------
54 
55 ! * A subroutine that computes interesting quantities from certain
56 ! icestate variables (statistics) and records them in data files at
57 ! every time step.
58 
59 SUBROUTINE wridia_ar5( tpglt )
60 !
61  USE modd_types_glt
62  USE modd_glt_param
64  USE modi_gltools_avevai
66  USE modi_gltools_outdia
67 #if ! defined in_surfex
68  USE modi_gltools_dynami
69 #endif
70 #if ! defined in_arpege
71  USE lib_mpp
72 #endif
73  USE mode_glt_stats
74  USE modi_gltools_glterr
75  IMPLICIT none
76 !
77  TYPE(t_glt), INTENT(inout) :: &
78  tpglt
79 !
80  CHARACTER(8) :: &
81  yword
82  CHARACTER(80) :: &
83  yfname,ymess,yfdef,ylnam
84  INTEGER :: &
85  ji,jt,ii,ij,ii0,ij0
86  LOGICAL, DIMENSION(nx,ny) :: &
87  ynhemis,yshemis
88  REAL :: &
89  zai,zaj,zcslat,zdilat,zdilon,zdjlat,zdjlon,zw
90  REAL, DIMENSION(1,1) :: &
91  zehn,zehs,zshn,zshs,zvhn,zvhs,zwhn,zwhs, &
92  zfram,zbering,zncwest,znceast,znorthb
93  REAL, DIMENSION(nx,ny) :: &
94  zfsit,zhsit,zhsnt,zmsnt
95  REAL, DIMENSION(nx,ny) :: &
96  zwork2,zsrf
97  REAL, DIMENSION(nt,nx,ny) :: &
98  zwork3
99  TYPE(t_def) :: &
100  tznam
101  TYPE(t_ind) :: &
102  tzind
103  TYPE(t_dom), DIMENSION(nx,ny) :: &
104  tzdom
105  TYPE(t_mxl), DIMENSION(nx,ny) :: &
106  tzml
107  TYPE(t_tfl), DIMENSION(nx,ny) :: &
108  tztfl
109  TYPE(t_blk), DIMENSION(nx,ny) :: &
110  tzblkw
111  TYPE(t_blk), DIMENSION(nt,nx,ny) :: &
112  tzblki
113  TYPE(t_sit), DIMENSION(nt,nx,ny) :: &
114  tzsit
115  TYPE(t_bud), DIMENSION(nx,ny) :: &
116  tzbud
117  TYPE(t_dia), DIMENSION(nx,ny) :: &
118  tzdia
119  REAL, DIMENSION(ndiamax,1,1) :: &
120  zcumdia0
121  REAL, DIMENSION(ndiamax,nx,ny) :: &
122  zcumdia
123 !
124 !
125 !
126 ! 1. Initializations
127 ! ===================
128 !
129 ! .. Arrays
130 !
131  zwork2(:,:) = 0.
132  zwork3(:,:,:) = 0.
133  zcumdia0 = tpglt%cdia0
134  zcumdia = tpglt%cdia
135 !
136 ! .. Structures
137 !
138  tzind = tpglt%ind
139  tzdom = tpglt%dom
140  tzml = tpglt%tml
141  tztfl = tpglt%tfl
142  tzblkw = tpglt%blkw
143  tzblki = tpglt%blki
144  tzsit = tpglt%sit
145  tzbud = tpglt%bud
146  tzdia = tpglt%dia
147 !
148 ! .. Welcome message
149 !
150  IF(lp1) WRITE(noutlu,*) ' '
151  IF(lp1) WRITE(noutlu,*) ' *** LEVEL 3 - SUBROUTINE WRIDIA_AR5'
152  IF(lp1) WRITE(noutlu,*) ' '
153  IF(lp1) WRITE(noutlu,*) ' --> Write diagnostic files'
154 !
155 ! .. Compute total sea ice concentration with threshold, net total sea
156 ! ice concentration, sea ice average thickness
157 !
158  zfsit(:,:) = glt_iceconcm( tzdom,tzsit )
159  zhsit(:,:) = glt_avhicem( tzdom,tzsit )
160  zhsnt(:,:) = glt_avhsnwm( tzdom,tzsit )
161  zmsnt(:,:) = glt_avmsnwm( tzdom,tzsit )
162 !
163 ! .. Time counter
164 !
165  tzind%nts = tzind%nts + 1
166 !
167 ! .. Set field counters to zero (field index in cumulated diagnostics array)
168 ! Has to be done before writing first 0d and 2d arrays
169 !
170  tzind%i0d = 0
171  tzind%i2d = 0
172 !
173 ! .. For 'specialised averaging' (e.g. ice age, snow density or salinity),
174 ! count time steps when there is sea ice
175 !
176  tzdia(:,:)%sic = tzdia(:,:)%sic + zfsit(:,:)
177  tzdia(:,:)%sit = tzdia(:,:)%sit + zhsit(:,:)
178  tzdia(:,:)%snd = tzdia(:,:)%snd + zhsnt(:,:)
179 !
180 !
181 !
182 ! 2. Write priority 1 diagnostics
183 ! ================================
184 !
185  IF ( ndiap1==1 ) THEN
186 !
187 ! 2.1. OImon table requested diagnostics
188 ! ---------------------------------------
189 !
190 ! A few remarks:
191 ! - snow mass can be easily re-computed from: sim-rhoice*snd
192 ! OK
193  tznam = t_def( &
194  "Sea Ice Area Fraction", &
195  "sea_ice_area_fraction", &
196  "sic", "%", "T", "SCALAR" )
197  zwork2(:,:) = 100.*zfsit(:,:)
198  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
199 ! OK
200  tznam = t_def( &
201  "Sea Ice Thickness", &
202  "sea_ice_thickness", &
203  "sit", "m", "T", "SCALAR" )
204  zwork2(:,:) = zhsit(:,:)
205  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
206 ! OK
207  tznam = t_def( &
208  "Frozen Water Mass", &
209  "", &
210  "sim", "kg.m-2", "T", "SCALAR" )
211  zwork2(:,:) = ( rhoice*zhsit(:,:) + zmsnt(:,:) )
212  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
213 ! OK (note that sign is negative if sea ice loses water)
214 ! Ce champ est en fait égal à sbl car Arpege ne considère que de la
215 ! sublimation sur neige / glace
216 ! Noter l'ambiguité avec evapsbl dans les tables Amon
217  zwork2(:,:) = &
218  sum( tzsit(:,:,:)%fsi*tzblki(:,:,:)%eva, dim=1 )
219  tznam = t_def( &
220  "Water Evaporation Flux from Sea Ice", &
221  "water_evaporation_flux", &
222  "evap", "kg.m-2.s-1", "T", "SCALAR" )
223  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
224 ! OK
225  tznam = t_def( &
226  "Snow Depth", &
227  "surface_snow_thickness", &
228  "snd", "m", "T", "SCALAR" )
229  zwork2(:,:) = zhsnt(:,:)
230  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
231 ! OK
232 !* Note that here, we do not divide zwork2 by zhsnt, since tzdia%snd
233 ! contains the sum of the zhsnt [weights] over all time outcomes
234  tznam = t_def( &
235  "Snow Layer Density", &
236  "snow_layer_density", &
237  "rhosn", "kg.m-3", "T", "SCALAR" )
238  zwork2(:,:) = zmsnt(:,:)
239  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
240  pwgt=tzdia%snd )
241 ! OK
242 !* Note that here, we do not divide zwork2 by zfsit, since tzdia%aiw
243 ! contains the sum of the zfsit [weights] over all time outcomes
244 ! (tzdia%aiw and tzdia%aiw are both computed in updasn_r)
245  tznam = t_def( &
246  "Bare Sea Ice Albedo", &
247  "bare_sea_ice_albedo", &
248  "ialb", "1", "T", "SCALAR" )
249  zwork2(:,:) = tzdia(:,:)%asi
250  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
251  pwgt=tzdia%aiw )
252 ! OK
253 !* Note that here, we do not divide zwork2 by zfsit, since tzdia%aiw
254 ! contains the sum of the zfsit [weights] over all time outcomes
255 ! (tzdia%aiw and tzdia%aiw are both computed in updasn_r)
256  tznam = t_def( &
257  "Melt pond Albedo", &
258  "melt_pond_albedo", &
259  "mpalb", "1", "T", "SCALAR" )
260  zwork2(:,:) = tzdia(:,:)%amp
261  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
262  pwgt=tzdia%aiw )
263 ! OK
264 !* Note that here, we do not divide zwork2 by zfsit, since tzdia%sic
265 ! contains the sum of the zfsit [weights] over all time outcomes
266  tznam = t_def( &
267  "Surface Temperature of Sea Ice", &
268  "surface_temperature_of_sea_ice", &
269  "tsice", "K", "T", "SCALAR" )
270  zwork2(:,:) = sum( tzsit(:,:,:)%fsi*(tzsit(:,:,:)%tsf+t0deg),dim=1 )
271  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
272  pwgt=tzdia%sic )
273 ! OK
274 !* Note that here, we do not divide zwork2 by zfsit, since tzdia%tiw
275 ! contains the sum of the zfsit [weights] over all time outcomes
276 ! (tzdia%tiw and tzdia%tin are both computed in vhdiff_r)
277  tznam = t_def( &
278  "Temperature at Interface Between Sea Ice and Snow", &
279  "temperature_at_interface_between_sea_ice_and_snow", &
280  "tsnint", "K", "T", "SCALAR" )
281  zwork2(:,:) = tzdia(:,:)%tin
282  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
283  pwgt=tzdia%tiw )
284 ! OK
285  tznam = t_def( &
286  "Surface Rainfall Rate into the Sea Ice Portion of the Grid Cell", &
287  "surface_rainfall_rate_into_the_sea_ice_portion_of_the_grid_cell", &
288  "pr", "kg.m-2.s-1", "T", "SCALAR" )
289  zwork2(:,:) = tzdia(:,:)%lip
290  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
291 ! OK
292  tznam = t_def( &
293  "Surface Snowfall Rate into the Sea Ice Portion of the Grid Cell", &
294  "surface_snowfall_rate_into_the_sea_ice_portion_of_the_grid_cell", &
295  "prsn", "kg.m-2.s-1", "T", "SCALAR" )
296  zwork2(:,:) = tzdia(:,:)%sop
297  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
298 !
299  tznam = t_def( &
300  "Frazil Sea Ice Growth (Leads) Rate", &
301  "frazil_sea_ice_growth_(leads)_rate", &
302  "grFrazil", "kg.m-2.s-1", "T", "SCALAR" )
303  zwork2(:,:) = tzdia(:,:)%lsi
304  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
305 !
306  tznam = t_def( &
307  "Congelation Sea Ice Growth Rate", &
308  "congelation_sea_ice_growth_rate", &
309  "grCongel", "kg.m-2.s-1", "T", "SCALAR" )
310  zwork2(:,:) = tzdia(:,:)%cgl
311  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
312 !
313  tznam = t_def( &
314  "Lateral Sea Ice Growth Rate", &
315  "lateral_sea_ice_growth_rate", &
316  "grLateral", "kg.m-2.s-1", "T", "SCALAR" )
317  zwork2(:,:) = tzdia(:,:)%mrl
318  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
319 !
320  tznam = t_def( &
321  "Ice Formation Rate from snow-ice formation", &
322  "ice_formation_rate_from_Snow-Ice_Formation", &
323  "snoToIce", "kg.m-2.s-1", "T", "SCALAR" )
324  zwork2(:,:) = tzdia(:,:)%sni
325  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
326 !
327  tznam = t_def( &
328  "Snow Melt Rate", &
329  "snow_melt_rate", &
330  "snomelt", "kg.m-2.s-1", "T", "SCALAR" )
331  zwork2(:,:) = tzdia(:,:)%snm
332  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
333 !
334  tznam = t_def( &
335  "Snow Melt Rate due to lateral ice erosion", &
336  "snow_melt_rate_Due_to_Lateral_Ice_Erosion", &
337  "latsnomelt", "kg.m-2.s-1", "T", "SCALAR" )
338  zwork2(:,:) = tzdia(:,:)%snml
339  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
340 !
341  tznam = t_def( &
342  "Rate of Melt at Upper Surface of Sea Ice", &
343  "rate_of_melt_at_upper_surface_of_sea_ice", &
344  "tmelt", "kg.m-2.s-1", "T", "SCALAR" )
345  zwork2(:,:) = tzdia(:,:)%mrt
346  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
347 !
348  tznam = t_def( &
349  "Rate of Melt at Sea Ice Base", &
350  "rate_of_melt_at_sea_ice_base", &
351  "bmelt", "kg.m-2.s-1", "T", "SCALAR" )
352  zwork2(:,:) = tzdia(:,:)%mrb
353  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
354 !
355  tznam = t_def( &
356  "Dilution flux due to ice sublimation", &
357  "Dilution_flux_due_to_Ice_Sublimation", &
358  "vsfsub", "kg.m-2.s-1", "T", "SCALAR" )
359  zwork2(:,:) = tzdia(:,:)%subcio
360  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
361 !
362  tznam = t_def( &
363  "Dilution flux due to lateral melting of ice", &
364  "Dilution_flux_due_to_Lateral_Melting_of_Ice", &
365  "vsflml", "kg.m-2.s-1", "T", "SCALAR" )
366  zwork2(:,:) = tzdia(:,:)%lmlcio
367  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
368 !
369  tznam = t_def( &
370  "Dilution flux due to salt exchanges", &
371  "Dilution_flux_due_to_Salt_Exchanges", &
372  "vsfsal", "kg.m-2.s-1", "T", "SCALAR" )
373  zwork2(:,:) = tzdia(:,:)%salcio
374  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
375 !
376  tznam = t_def( &
377  "Dilution flux due to change of ice depth", &
378  "Dilution_flux_due_to_change_of_ice_depth", &
379  "vsfhsi", "kg.m-2.s-1", "T", "SCALAR" )
380  zwork2(:,:) = tzdia(:,:)%hsicio
381  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
382 !
383  tznam = t_def( &
384  "Dilution flux due to conversion of snow to ice", &
385  "Dilution_flux_due_to_Conversion_of_Snow_to_Ice", &
386  "vsfsni", "kg.m-2.s-1", "T", "SCALAR" )
387  zwork2(:,:) = tzdia(:,:)%snicio
388  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
389 !
390 !* Not provided (net is provided instead)
391 ! tznam = t_def( &
392 ! "Downward Shortwave over Sea Ice", &
393 ! "surface_downwelling_shortwave_flux_in_air", &
394 ! "rsdssi", "W.m-2", "T", "SCALAR" )
395 ! zwork2(:,:) = tzdia(:,:)%swd
396 ! CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
397 !
398 !* Not provided (net is provided instead)
399 ! tznam = t_def( &
400 ! "Upward Shortwave over Sea Ice", &
401 ! "surface_upwelling_shortwave_flux_in_air", &
402 ! "rsussi", "W.m-2", "T", "SCALAR" )
403 ! OK
404  tznam = t_def( &
405  "X-Component of Sea Ice Mass Transport", &
406  "", &
407  "transix", "kg.s-1", "U", "VECTOR" )
408  zwork2(:,:) = tzdia(:,:)%xtr
409  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
410 ! OK
411  tznam = t_def( &
412  "Y-Component of Sea Ice Mass Transport", &
413  "", &
414  "transiy", "kg.s-1", "V", "VECTOR" )
415  zwork2(:,:) = tzdia(:,:)%ytr
416  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
417 !
418 ! transifs : Fram Strait glt_transport (à fournir ???)
419 !
420 !
421 ! 2.2. Omon table requested diagnostics
422 ! ---------------------------------------
423 !
424 ! .. These diagnostics are not in the sea ice CMIP5 table, but in the
425 ! ocean table. However they can be computed in the sea ice model
426 !
427 !OK
428 !* This is reduced to snow layer melt (true only if sea ice is levitating !)
429  tznam = t_def( &
430  "Water Flux into Sea Water due to Sea Ice Thermodynamics", &
431  "water_flux_into_sea_water_due_to_sea_ice_thermodynamics", &
432  "fsitherm", "kg.m-2.s-1", "T", "SCALAR" )
433  IF ( nleviti==1 ) THEN
434  zwork2(:,:) = -tzdia(:,:)%snm
435  ELSE
436  zwork2(:,:) = xbig20
437  ENDIF
438  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
439 ! OK
440 ! PEUT-ETRE UN PETIT PB D'UNITES (ne faut-il pas remultiplier par
441 ! la profondeur du niveau le plus superficiel ?) voir Griffies et al ?
442  tznam = t_def( &
443  "Virtual Salt Flux into Sea Water due to Sea Ice Thermodynamics", &
444  "virtual_salt_flux_into_sea_water_due_to_sea_ice_thermodynamics", &
445  "vsfsit", "kg.m-2.s-1", "T", "SCALAR" )
446  zwork2(:,:) = -1.e-3*tztfl(:,:)%cio*tzml(:,:)%sml
447  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
448 ! OK
449  tznam = t_def( &
450  "Downward Sea Ice Basal Salt Flux", &
451  "downward_sea_ice_basal_salt_flux", &
452  "sfdsi", "kg.m-2.s-1", "T", "SCALAR" )
453  zwork2(:,:) = tztfl(:,:)%sio
454  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
455 !
456 !* Not provided
457 ! This is zero in Gelato (no heat transfer to the mixed layer as sea ice
458 ! forms in leads, see imod_thermo_lead_r.f90)
459 ! tznam = t_def( &
460 ! "Heat Flux into Sea Water due to Frazil Ice Formation", &
461 ! "heat_flux_into_sea_water_due_to_frazil_ice_formation", &
462 ! "hfsifrazil", "kg.m-2.s-1", "T", "SCALAR" )
463 !
464 ! OK
465 !* Ex-IOTFLUIW
466  tznam = t_def( &
467  "Heat Flux into Sea Water due to Sea Ice Thermodynamics", &
468  "heat_flux_into_sea_water_due_to_sea_ice_thermodynamics", &
469  "hfsithermds", "kg.m-2.s-1", "T", "SCALAR" )
470  zwork2(:,:) = tztfl(:,:)%tio
471  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
472 !
473 !
474 !
475 ! 2.3. Other diagnostics (not in CMIP5 tables)
476 ! ---------------------------------------------
477 !
478 !*Ex-AIHFLUIW
479 ! Net heat flux on the ice surface only - weighted [W.m-2]
480 ! (without the effect of snow)
481  tznam = t_def( &
482  "Downward Heat Flux at Sea Ice Surface", &
483  "downward_heat_flux_at_sea_ice_surface", &
484  "hfdssi", "W.m-2", "T", "SCALAR" )
485  zwork2(:,:) = tzbud(:,:)%hii-tzbud(:,:)%nii
486  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
487 !
488 !* Ex-AWHFLUWW
489 ! Net heat flux on the water surface only - weighted [W.m-2]
490 ! (without the effect of snow)
491  tznam = t_def( &
492  "Downward Heat Flux at Leads Surface", &
493  "downward_heat_flux_at_leads_surface", &
494  "hfdso", "W.m-2", "T", "SCALAR" )
495  zwork2(:,:) = (tzbud(:,:)%hli-tzbud(:,:)%nli)
496  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
497 ! OK
498  tznam = t_def( &
499  "Net Downward Shortwave Radiation at Sea Ice Surface", &
500  "net_downward_shortwave_radiation_at_sea_ice_surface", &
501  "rsntdssi", "W.m-2", "T", "SCALAR" )
502  zwork2(:,:) = tzdia(:,:)%swi
503  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
504 !
505 !* Ex-AWSFLUWW
506 ! Solar energy absorbed by the water surface [W.m-2]
507  tznam = t_def( &
508  "Net Downward Shortwave Radiation at Leads Surface", &
509  "net_downward_shortwave_radiation_at_leads_surface", &
510  "rsntdso", "W.m-2", "T", "SCALAR" )
511  zwork2(:,:) = tzdia(:,:)%sww
512  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
513 ! OK
514 !* Average snow albedo field [0-1]
515 ! Note that here, we do not divide zwork2 by zfsit, since tzdia%sic
516 ! contains the sum of the zfsit [weights] over all time outcomes
517  tznam = t_def( &
518  "Weighted Albedo of Snow Over Sea Ice", &
519  "weighted_albedo_of_snow_over_sea_ice", &
520  "sisnalb", "1", "T", "SCALAR" )
521  zwork2(:,:) = tzdia(:,:)%asn
522  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
523  pwgt=tzdia%aiw )
524 ! OK
525 !* Sea ice u-velocity
526  tznam = t_def( &
527  "Eastward Sea Ice Velocity", &
528  "eastward_sea_ice_velocity", &
529  "usi", "m.s-1", "U", "VECTOR" )
530  zwork2(:,:) = tzdia(:,:)%uvl
531  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
532 ! OK
533 !* Sea ice v-velocity
534  tznam = t_def( &
535  "Northward Sea Ice Velocity", &
536  "northward_sea_ice_velocity", &
537  "vsi", "m.s-1", "V", "VECTOR" )
538  zwork2(:,:) = tzdia(:,:)%vvl
539  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
540 ! OK
541 !* Fraction of time during which sea ice is present [0-1]
542  tznam = t_def( &
543  "Fraction of Time with Sea Ice ", &
544  "fraction_of_time_with_sea_ice", &
545  "timesi", "%", "T", "SCALAR" )
546  WHERE( zfsit(:,:)>xfsic )
547  zwork2(:,:) = 100.
548  ELSEWHERE
549  zwork2(:,:) = 0.
550  ENDWHERE
551  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
552 ! OK
553 !* Sublimation over sea-ice
554  tznam = t_def( &
555  "Sublimation over Sea Ice", &
556  "sublimation_over_sea_ice", &
557  "subIce", "kg.m-2.s-1", "T", "SCALAR" )
558  zwork2(:,:) = tzdia(:,:)%sui
559  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
560 !* Sublimation tot over sea-ice fraction of the grid
561  tznam = t_def( &
562  "Sublimation", &
563  "sublimation", &
564  "subTot", "kg.m-2.s-1", "T", "SCALAR" )
565  zwork2(:,:) = tzdia(:,:)%sut
566  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
567 ! OK
568 !* Sublimation over snow
569  tznam = t_def( &
570  "Sublimation over Snow", &
571  "sublimation_over_snow", &
572  "subSnw", "kg.m-2.s-1", "T", "SCALAR" )
573  zwork2(:,:) = tzdia(:,:)%sus
574  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
575 ! OK
576 !* Sublimation over ocean
577  tznam = t_def( &
578  "Sublimation over Ocean (residual)", &
579  "sublimation_over_ocean", &
580  "subO", "kg.m-2.s-1", "T", "SCALAR" )
581  zwork2(:,:) = tzdia(:,:)%suw
582  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
583 ! OK
584 !* Sublimation over leads
585  tznam = t_def( &
586  "Sublimation over Leads", &
587  "sublimation_over_leads", &
588  "subL", "kg.m-2.s-1", "T", "SCALAR" )
589  zwork2(:,:) = tzdia(:,:)%sul
590  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
591 ! OK
592 !* Liquid precip that actually falls on snow
593  tznam = t_def( &
594  "Liquid Precipitation over Snow", &
595  "liquid_precipitation_over_snow", &
596  "s_pr", "kg.m-2.s-1", "T", "SCALAR" )
597  zwork2(:,:) = tzdia(:,:)%s_pr
598  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
599 ! OK
600 !* Liquid precip that actually falls on openwater
601  tznam = t_def( &
602  "Liquid Precipitation over Ocean", &
603  "liquid_precipitation_over_ocean", &
604  "o_pr", "kg.m-2.s-1", "T", "SCALAR" )
605  zwork2(:,:) = tzdia(:,:)%o_pr
606  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
607 ! OK
608 !* Liquid precip that actually falls on leads
609  tznam = t_def( &
610  "Liquid Precipitation over Leads", &
611  "liquid_precipitation_over_leads", &
612  "l_pr", "kg.m-2.s-1", "T", "SCALAR" )
613  zwork2(:,:) = tzdia(:,:)%l_pr
614  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
615 ! OK
616 !* Solid precip that actually falls on snow
617  tznam = t_def( &
618  "Solid Precipitation over Snow", &
619  "solid_precipitation_over_snow", &
620  "s_prsn", "kg.m-2.s-1", "T", "SCALAR" )
621  zwork2(:,:) = tzdia(:,:)%s_prsn
622  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
623 ! OK
624 !* Solid precip that actually falls on open water
625  tznam = t_def( &
626  "Solid Precipitation over ocean", &
627  "solid_precipitation_over_ocean", &
628  "o_prsn", "kg.m-2.s-1", "T", "SCALAR" )
629  zwork2(:,:) = tzdia(:,:)%o_prsn
630  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
631 ! OK
632 !* Solid precip that actually falls on leads
633  tznam = t_def( &
634  "Solid Precipitation over Leads", &
635  "solid_precipitation_over_leads", &
636  "l_prsn", "kg.m-2.s-1", "T", "SCALAR" )
637  zwork2(:,:) = tzdia(:,:)%l_prsn
638  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
639 !
640 !* Average surface albedo field (all marine surface) [0-1]
641 ! Water albedo should not be assumed to be constant to albw (this may change)
642 ! tznam = t_def( &
643 ! "Weighted Marine Surface Albedo", &
644 ! "weighted_marine_surface_albedo", &
645 ! "wsalb", "1", "T", "SCALAR" )
646 ! zwork2(:,:) = &
647 ! ( SUM( tzsit(:,:,:)%fsi*tzsit(:,:,:)%asn,DIM=1 ) + &
648 ! ( 1.-zfsit(:,:) )*albw )
649 ! CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
650 !
651  ENDIF
652 !
653 !
654 !
655 ! 3. Write second set of diagnostics
656 ! ===================================
657 !
658 ! .. Note that the outgoing heat flux affecting ice free areas are
659 ! exactly equal to the incoming heat flux in the same zones.
660 !
661 ! NOTES
662 ! ------
663 ! * If you want to compute a complete energy balance on sea ice,
664 ! you must compare, on the one hand:
665 ! . SITDENIW (gltools_enthalpy change)
666 ! And, on the other hand:
667 ! . OIHFLUIW + AIHFLUIW + AISNWFIW + AWHFLUWW + AWSNWFWW -
668 ! ( IOLFLUIW + IOTFLUIW + LOLFLUIW + LOTFLUIW )
669 ! i.e.
670 ! ( ocean heat flux +
671 ! atmospheric heat flux on ice + energy flux due to snowfalls on ice +
672 ! atmospheric heat flux on water + energy flux due to snowfalls on water )
673 ! minus
674 ! ( outgoing short wave + non-solar through leads +
675 ! outgoing short wave + non-solar through ice )
676 !
677 ! - outgoing energy (solar+non-solar) at the bottom of sea ice)
678 !
679 ! * If you want to compute a complete fresh water balance on sea ice,
680 ! you must compare, on the one hand:
681 ! . ALLFWTOT (all precip-evapo) - LOWFLUIW - IOWFLUIW (outgoing water
682 ! through leads and under sea ice)
683 ! And, on the other hand:
684 ! . SIDMSIIW (sea ice mass change) - SIDMSAIW (remove salt) + SIDMSNIW
685 ! (snow mass change)
686 !
687 ! * The energetic balance due to the (non perfectly conservative) sea
688 ! ice advection is also available, see SIDDENIW and SIDDLAIW fields.
689 !
690 ! * The change in water budget due to dynamics is not implemented yet.
691 !
692  IF ( ndiap2==1 ) THEN
693 !
694 !OK
695  tznam = t_def( &
696  "Surface Snow Area Fraction", &
697  "surface_snow_area_fraction", &
698  "snc", "%", "T", "SCALAR" )
699  zwork2(:,:) = &
700  100.*sum( tzsit(:,:,:)%fsi,dim=1,mask=tzsit(:,:,:)%hsn>epsil1 )
701  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
702 !
703 !* Sea Ice total heat content includes snow heat content
704 ! Note that the average sea ice temperature can be estimated from
705 ! a function given in gltools_temper_r
706  tznam = t_def( &
707  "Sea Ice Total Heat Content", &
708  "sea_ice_total_heat_content", &
709  "hcice", "J.m-2", "T", "SCALAR" )
710  zwork2(:,:) = tzdia(:,:)%sie + tzdia(:,:)%sne
711  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
712 !
713 !* Snow total heat content
714  tznam = t_def( &
715  "Snow Total Heat Content", &
716  "snow_total_heat_content", &
717  "hcsnow", "J.m-2", "T", "SCALAR" )
718  zwork2(:,:) = tzdia(:,:)%sne
719  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
720 ! PERHAPS AVERAGE SEA ICE TEMPERATURE SHOULD BE PROVIDED ??
721 !(divide %sie by fsit in glt_thermo, then apply a new temper function)
722 !
723 ! The 4 next fields cannot be provided.
724 ! The net non-solar flux on sea ice is provided instead.
725 !* Not provided
726  tznam = t_def( &
727  "Downward Longwave over Sea Ice", &
728  "surface_downwelling_longwave_flux_in_air", &
729  "rldssi", "W.m-2", "T", "SCALAR" )
730 !
731 !* Not provided
732  tznam = t_def( &
733  "Upward longwave over Sea Ice", &
734  "surface_upwelling_longwave_flux_in_air", &
735  "rlussi", "W.m-2", "T", "SCALAR" )
736 !
737 !* Not provided
738  tznam = t_def( &
739  "Surface Upward Sensible Heat Flux over Sea Ice", &
740  "surface_upward_sensible_heat_flux", &
741  "hfssi","W.m-2", "T", "SCALAR" )
742 !
743 !* Not provided
744  tznam = t_def( &
745  "Surface Upward Latent Heat Flux over Sea Ice", &
746  "surface_upward_latent_heat_flux", &
747  "hflssi", "W.m-2", "T", "SCALAR" )
748 !
749 !* Not provided (= evap field in case of a coupling with Arpege)
750  tznam = t_def( &
751  "Sublimation over Sea Ice", &
752  "surface_snow_and_ice_sublimation_flux", &
753  "sblsi", "kg.m-2.s-1", "T", "SCALAR" )
754 ! OK
755 ! Note that here, we do not divide zwork2 by zfsit, since tzdia%sic
756 ! contains the sum of the zfsit [weights] over all time outcomes
757  tznam = t_def( &
758  "X-Component of Atmospheric Stress On Sea Ice", &
759  "", &
760  "strairx", "N.m-2", "U", "VECTOR" )
761  zwork2(:,:) = tzdia(:,:)%atx
762  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
763  pwgt=tzdia%sic )
764 ! OK
765 ! Note that here, we do not divide zwork2 by zfsit, since tzdia%sic
766 ! contains the sum of the zfsit [weights] over all time outcomes
767  tznam = t_def( &
768  "Y-Component of Atmospheric Stress On Sea Ice", &
769  "", &
770  "strairy", "N.m-2", "V", "VECTOR" )
771  zwork2(:,:) = tzdia(:,:)%aty
772  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
773  pwgt=tzdia%sic )
774 ! OK
775 ! Note that here, we do not divide zwork2 by zfsit, since tzdia%sic
776 ! contains the sum of the zfsit [weights] over all time outcomes
777  tznam = t_def( &
778  "X-Component of Ocean Stress On Sea Ice", &
779  "", &
780  "strocnx", "N.m-2", "U", "VECTOR" )
781  zwork2(:,:) = tzdia(:,:)%otx
782  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
783  pwgt=tzdia%sic )
784 ! OK
785 ! Note that here, we do not divide zwork2 by zfsit, since tzdia%sic
786 ! contains the sum of the zfsit [weights] over all time outcomes
787  tznam = t_def( &
788  "Y-Component of Ocean Stress On Sea Ice", &
789  "", &
790  "strocny", "N.m-2", "V", "VECTOR" )
791  zwork2(:,:) = tzdia(:,:)%oty
792  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
793  pwgt=tzdia%sic )
794 !
795 !* Not provided
796 ! When computing the time-mean here, the time samples, weighted
797 ! by the area of sea ice, are accumulated and then divided by
798 ! the sum of the weights. Report as missing in regions free of
799 ! sea ice.
800  tznam = t_def( &
801  "Compressive Sea Ice Strength", &
802  "", &
803  "streng", "N.m-2", "T", "SCALAR" )
804 !
805 !* Not provided
806  tznam = t_def( &
807  "Strain Rate Divergence of Sea Ice", &
808  "", &
809  "divice", "s-1", "T", "SCALAR" )
810 !
811 !* Not provided
812  tznam = t_def( &
813  "Strain Rate Shear of Sea Ice", &
814  "", &
815  "shrice", "s-1", "T", "SCALAR" )
816 !
817 ! When computing the time-mean here, the time samples, weighted
818 ! by the area of sea ice, are accumulated and then divided by
819 ! the sum of the weights. Report as missing in regions free of
820 ! sea ice (pas obligatoire...)
821  tznam = t_def( &
822  "Sea Ice Ridging Rate", &
823  "", &
824  "ridgice", "s-1", "T", "SCALAR" )
825 !
826 !* Ex-OIHFLUIW
827 ! Ocean heat flux - weighted [W.m-2]
828  tznam = t_def( &
829  "Ocean Heat Flux to Sea Ice", &
830  "ocean_heat_flux_to_sea_ice", &
831  "hfoi", "W.m-2", "T", "SCALAR" )
832  zwork2(:,:) = tzdia(:,:)%qoi
833  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
834 !
835 !* Ex-AWSNWFWW
836 ! Equivalent heat flux due to snow melting in the ocean [W.m-2]
837  tznam = t_def( &
838  "Surface Heat Flux due to Snowfalls over Leads", &
839  "surface_snowfalls_heat_flux_over_leads", &
840  "sfhfso", "W.m-2", "T", "SCALAR" )
841  zwork2(:,:) = tzbud(:,:)%nli
842  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
843 !
844 !*Ex-AISNWFIW
845 ! Equivalent heat flux due to snowfalls on sea ice [W.m-2]
846  tznam = t_def( &
847  "Surface Heat Flux due to Snowfalls over Sea Ice", &
848  "surface_snowfalls_heat_flux_over_sea_ice", &
849  "sfhfssi", "W.m-2", "T", "SCALAR" )
850  zwork2(:,:) = tzbud(:,:)%nii
851  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
852 !
853 !* Ex-SITDENIW
854 ! Rate of change of sea ice heat content due to thermodynamics [W.m-2]
855 ! Sea Ice total heat content includes snow heat content
856  tznam = t_def( &
857  "Rate of Change of Sea Ice Total Heat Content due to Thermodynamics", &
858  "rate of change of sea_ice_total_heat_content due to thermodynamics", &
859  "dhcicet", "W.m-2", "T", "SCALAR" )
860  zwork2(:,:) = tzdia(:,:)%the
861  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
862 !
863 !* Ex-SIDDENIW
864 ! Weighted sea ice gltools_enthalpy variation due to advection [W.m-2]
865 ! Sea Ice total heat content includes snow heat content
866  tznam = t_def( &
867  "Rate of Change of Sea Ice Total Heat Content due to Advection", &
868  "rate of change of sea_ice_total_heat_content due to advection", &
869  "dhcicea", "W.m-2", "T", "SCALAR" )
870  zwork2(:,:) = &
871  ( tzbud(:,:)%enn-tzbud(:,:)%eni ) / dtt - tzdia(:,:)%the
872  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
873 !
874 ! Weighted sea ice gltools_enthalpy variation due to damping [W.m-2]
875  tznam = t_def( &
876  "Rate of Change of Sea Ice Total Heat Content due to Damping", &
877  "rate of change of sea_ice_total_heat_content due to damping", &
878  "dhciced", "W.m-2", "T", "SCALAR" )
879  zwork2(:,:) = tzdia(:,:)%dmp
880  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
881 !
882 ! The following two water fluxes are the REAL fluxes of water computed
883 ! by Gelato - a difference compared to fsitherm, which is the water
884 ! flux actually seen by the ocean code, since sea ice is levitating.
885 !
886 !* Ex-IOWFLUIW
887 ! Write weighted net FW flux sent by sea ice to the ocean [W.m-2]
888  tznam = t_def( &
889  "Real Water Flux into Sea Water under Sea Ice", &
890  "real_water_flux_into_sea_water_under_sea_ice", &
891  "wfsitsi", "kg.m-2.s-1", "T", "SCALAR" )
892  zwork2(:,:) = tztfl(:,:)%wio
893  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
894 !
895 !* Ex-LOWFLUIW
896 ! Weighted net FW flux sent by leads to the ocean [kg.m-2.s-1]
897  tznam = t_def( &
898  "Real Water Flux into Sea Water under Leads", &
899  "real_water_flux_into_sea_water_under_leads", &
900  "wfsitso", "kg.m-2.s-1", "T", "SCALAR" )
901  zwork2(:,:) = tztfl(:,:)%wlo
902  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
903 !
904 !* Ex-IOVFLUIW
905 ! Weighted virtual FW flux sent by sea ice to the ocean [kg.m-2.s-1]
906  tznam = t_def( &
907  "Virtual Water Flux into Sea Water due to Sea Ice Thermodynamics", &
908  "virtual_water_flux_into_sea_water_due_to_sea_ice_thermodynamics", &
909  "vwfsit", "kg.m-2.s-1", "T", "SCALAR" )
910  zwork2(:,:) = tztfl(:,:)%cio
911  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
912 !
913 !* Ex-IOLFLUIW
914 ! Weighted solar heat flux under sea ice [W.m-2]
915  tznam = t_def( &
916  "Net Shortwave Flux under Sea Ice", &
917  "net_shortwave_flux_under_sea_ice", &
918  "rsntdusi", "W.m-2", "T", "SCALAR" )
919  zwork2(:,:) = tztfl(:,:)%lio
920  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
921 !
922 !*Ex-LOLFLUIW
923 ! Weighted solar heat flux sent by leads to the ocean
924  tznam = t_def( &
925  "Net Shortwave Flux under Leads", &
926  "net_shortwave_flux_under_leads", &
927  "rsntduso", "W.m-2", "T", "SCALAR" )
928  zwork2(:,:) = tztfl(:,:)%llo
929  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
930 !
931 !*Ex-LOTFLUIW + LOLFLUIW
932 ! Net heat flux under leads only [W.m-2]
933  tznam = t_def( &
934  "Downward Heat Flux Under Leads", &
935  "downward_heat_flux_under_leads", &
936  "hfduo", "W.m-2", "T", "SCALAR" )
937  zwork2(:,:) = tztfl(:,:)%tlo + tztfl(:,:)%llo
938  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
939 !
940 !*Ex-IOTFLUIW + IOLFLUIW
941 ! Net heat flux on under the ice surface only - weighted [W.m-2]
942 ! (without the effect of snow)
943  tznam = t_def( &
944  "Downward Heat Flux Under Sea Ice", &
945  "downward_heat_flux_under_sea_ice", &
946  "hfdusi", "W.m-2", "T", "SCALAR" )
947  zwork2(:,:) = tztfl(:,:)%tio + tztfl(:,:)%lio
948  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
949 !
950 !*Ex-SIDMSAIW
951 ! Weighted change of salt mass in sea ice - glt_thermo only [ kg.m-2.s-1 ]
952  tznam = t_def( &
953  "Salt Mass in Sea Ice Rate", &
954  "salt_mass_in_sea_ice_rate", &
955  "dmsalt", "kg.m-2.s-1", "T", "SCALAR" )
956  zwork2(:,:) = tzdia(:,:)%dsa
957  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
958 !
959 !*Ex-SIDMSNIW
960 ! Weighted snow mass change field - glt_thermo only [ kg.m-2.s-1 ]
961  tznam = t_def( &
962  "Snow Mass over Sea Ice Rate due to Sea Ice Thermodynamics", &
963  "snow_mass_over_sea_ice_rate_due_to_sea_ice_thermodynamics", &
964  "dmsnow", "kg.m-2.s-1", "T", "SCALAR" )
965  zwork2(:,:) = tzdia(:,:)%dsn
966  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
967 !
968 ! Weighted snow mass change field - dynamic only [ kg.m-2.s-1 ]
969  tznam = t_def( &
970  "Snow Mass over Sea Ice Rate due to Sea Ice Dynamics", &
971  "snow_mass_over_sea_ice_rate_due_to_sea_ice_dynamics", &
972  "dmsnowdyn", "kg.m-2.s-1", "T", "SCALAR" )
973  zwork2(:,:) = tzdia(:,:)%ddn
974  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
975 !!*Ex-SIDMSIIW
976 ! Weighted sea ice mass change field - glt_thermo only [ kg.m-2.s-1 ]
977  tznam = t_def( &
978  "Sea Ice Mass Rate", &
979  "sea_ice_mass_rate", &
980  "dmice", "kg.m-2.s-1", "T", "SCALAR" )
981  zwork2(:,:) = tzdia(:,:)%dsi
982  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
983 !
984 ! Weighted sea ice mass change - constraint only [ kg.m-2.s-1 ]
985  tznam = t_def( &
986  "Rate of Change of Sea Ice Mass due to Constraint", &
987  "rate_of_change_of_sea_ice_mass_due_to_constraint", &
988  "dmicedmp", "kg.m-2.s-1", "T", "SCALAR" )
989  zwork2(:,:) = tzdia(:,:)%dci
990 !
991 ! Sea ice concentration constraint [% ]
992  tznam = t_def( &
993  "Sea Ice Concentration Constraint", &
994  "sea_ice_concentration_traint", &
995  "siccnst", "%", "T", "SCALAR" )
996  zwork2(:,:) = tzdia(:,:)%cst
997 !
998 !*Ex-SIDMWIIW
999 ! Weighted ice FW content change field - glt_thermo only [ kg.m-2.s-1 ]
1000  tznam = t_def( &
1001  "Sea Ice Fresh Water Content Rate", &
1002  "sea_ice_fresh_water_content_rate", &
1003  "dmwice", "kg.m-2.s-1", "T", "SCALAR" )
1004  zwork2(:,:) = tzdia(:,:)%dwi
1005  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1006 !
1007 !*Ex-ALLFWTOT (maybe not necessary)
1008 ! Total input water to the snow-ice leads system [kg.m-2.s-1]
1009  tznam = t_def( &
1010  "Total Fresh Water Input Rate", &
1011  "total_fresh_water_input_rate", &
1012  "dfwnt", "kg.m-2.s-1", "T", "SCALAR" )
1013  zwork2(:,:) = tzdia(:,:)%ifw
1014  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1015 !
1016 ! CHECK THAT THE SUM OF bottom, lateral and top mass changes match
1017 ! SIDMSIIW
1018 ! Already implemented as new diagnostics
1019 !!!
1020 !!! >>> Write weighted ice top mass balance [ kg.m-2.s-1 ]
1021 !!!
1022 !! zwork2(:,:) = tzdia(:,:)%mrt
1023 !! yword = 'SIMRTIIW' ! T SCALAR
1024 !! CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1025 !!!
1026 !!! >>> Write weighted ice lateral ablation [ kg.m-2.s-1 ]
1027 !!!
1028 !! zwork2(:,:) = tzdia(:,:)%mrl
1029 !! yword = 'SIMRLIIW' ! T SCALAR
1030 !! CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1031 !!!
1032 !!! >>> Write weighted ice bottom mass balance [ kg.m-2.s-1 ]
1033 !!!
1034 !! zwork2(:,:) = &
1035 !! ( tzdia(:,:)%dsi-tzdia(:,:)%lsi-tzdia(:,:)%mrt-tzdia(:,:)%mrl )
1036 !! yword = 'SIMRBIIW' ! T SCALAR
1037 !! CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1038 !
1039 ! >>> Write spare fields
1040 !
1041 ! IF ( ANY( ABS( tzdia(:,:)%sp1 ) > epsil1 ) ) THEN
1042 ! zwork2(:,:) = &
1043 ! tzdia(:,:)%sp1
1044 ! yword = 'FIELDSP1' ! T SCALAR
1045 ! CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1046 ! ENDIF
1047 !
1048 ! IF ( ANY( ABS( tzdia(:,:)%sp2 ) > epsil1 ) ) THEN
1049 ! zwork2(:,:) = &
1050 ! tzdia(:,:)%sp2
1051 ! yword = 'FIELDSP2' ! T SCALAR
1052 ! CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1053 ! ENDIF
1054 !
1055  DO jt=1,nt
1056 !
1057 !*Ex-SIFRCSIx
1058 ! Sea ice categories concentration fields
1059  WRITE( yfdef,fmt='("Sea Ice Area Fraction Category ",I1.1)' ) jt
1060  WRITE( ylnam,fmt='("sea_ice_area_fraction_category_",I1.1)' ) jt
1061  WRITE( yword,fmt='("sic",I1.1)' ) jt
1062  tznam = t_def( &
1063  yfdef, ylnam, yword, "%", "T", "SCALAR" )
1064  zwork2(:,:) = 100.*tzsit(jt,:,:)%fsi
1065  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1066 !
1067 ! >>> Write pond volume over each ice category
1068  WRITE( yfdef,fmt='("Melt pond volume Category ",I1.1)' ) jt
1069  WRITE( ylnam,fmt='("melt_pond_volume_category_",I1.1)' ) jt
1070  WRITE( yword,fmt='("vmp",I1.1)' ) jt
1071  tznam = t_def( &
1072  yfdef, ylnam, yword, "%", "T", "SCALAR" )
1073  zwork2(:,:) = tzsit(jt,:,:)%vmp
1074  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1075 !
1076 ! >>> Write solar energy absorbed by sea ice categories
1077 !
1078 ! zwork2(:,:) = tzblki(jt,:,:)%swa
1079 ! WRITE( yword,FMT='("AISWASI",I1.1)' ) jt
1080 ! CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1081 !
1082 ! >>> Write non-solar energy absorbed by sea ice categories
1083 !
1084 ! zwork2(:,:) = tzblki(jt,:,:)%nsf
1085 ! WRITE( yword,FMT='("SINSFSI",I1.1)' ) jt
1086 ! CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia )
1087 !
1088  END DO
1089 !
1090  ENDIF
1091 !
1092  IF ( ndiap3==1 ) THEN
1093 !
1094 ! *Note that here, we do not divide zwork2 by zhsit, since tzdia%sit
1095 ! contains the sum of the zhsit [weights] over all time outcomes
1096  tznam = t_def( &
1097  "Sea Ice Salinity", &
1098  "sea_ice_salinity", &
1099  "ssi", "psu", "T", "SCALAR" )
1100  IF ( nicesal==1 ) THEN
1101  zwork2(:,:) = &
1102  sum( tzsit(:,:,:)%fsi*tzsit(:,:,:)%hsi*tzsit(:,:,:)%ssi, dim=1 )
1103  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
1104  pwgt=tzdia%sit )
1105  ENDIF
1106 !
1107 ! *Note that here, we do not divide zwork2 by zfsit, since tzdia%sic
1108 ! contains the sum of the zfsit [weights] over all time outcomes
1109  tznam = t_def( &
1110  "Age of Sea Ice", &
1111  "age_of_sea_ice", &
1112  "ageice", "years", "T", "SCALAR" )
1113  IF ( niceage==1 ) THEN
1114  zwork2(:,:) = &
1115  sum( tzsit(:,:,:)%fsi*tzsit(:,:,:)%age, dim=1 ) / &
1116  ( xyear2day*xday2sec )
1117  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
1118  pwgt=tzdia%sic )
1119  ENDIF
1120 !
1121 ! *Note that here, we do not divide zwork2 by zfsit, since tzdia%sic
1122 ! contains the sum of the zfsit [weights] over all time outcomes
1123  tznam = t_def( &
1124  "Melt pond volume", &
1125  "melt_pond_volume", &
1126  "mpondvol", "m", "T", "SCALAR" )
1127  IF ( nmponds==1 ) THEN
1128  zwork2(:,:) = &
1129  sum( tzsit(:,:,:)%fsi*tzsit(:,:,:)%vmp, dim=1 )
1130  CALL gltools_outdia( tzind,tznam,tzdom,zwork2,zcumdia, &
1131  pwgt=tzdia%sic )
1132  ENDIF
1133 
1134  ENDIF
1135 !
1136 ! .. Just a final check, if ndiamax (in gltzar) is too small to hold all the
1137 ! data
1138 !
1139  IF ( tzind%cur==tzind%beg ) THEN
1140  IF ( tzind%i2d>ndiamax ) THEN
1141  WRITE( ymess, &
1142  fmt='("Number of 2d diagnostic fields=", &
1143  & I3,"> ndiamax=",I3,"\n")' ) tzind%i2d,ndiamax
1144  CALL gltools_glterr( 'imod_results','Check ndiamax in gltzar', 'STOP' )
1145  ENDIF
1146  IF ( tzind%i0d>ndiamax ) THEN
1147  WRITE( ymess, &
1148  fmt='("Number of 0d diagnostic fields=", &
1149  & I3,"> ndiamax=",I3,"\n")' ) tzind%i0d,ndiamax
1150  CALL gltools_glterr( 'imod_results','Check ndiamax in gltzar', 'STOP' )
1151  ENDIF
1152  ENDIF
1153 !
1154 !
1155 !
1156 ! 3. Sea ice totals for Northern and Southern hemispheres
1157 ! ========================================================
1158 !
1159 ! 3.1. Compute sea ice totals
1160 ! ----------------------------
1161 !
1162 ! The following quantities are computed :
1163 ! - sea ice extent (sum of all grid cells with more than X % ice
1164 ! concentration)
1165 ! - sea ice area
1166 ! - sea ice volume
1167 ! No need to mask the ghost points, since tzdom%srf = 0 for ghost points
1168 #if ! defined in_arpege
1169  zsrf(:,:) = tzdom(:,:)%srf * float(tzdom(:,:)%imk)
1170 !
1171 ! .. Sea ice extent, north and south
1172 !
1173  ynhemis(:,:) = ( tzdom(:,:)%lat>0..AND. tzdom(:,:)%tmk==1 )
1174  yshemis(:,:) = ( tzdom(:,:)%lat<0..AND. tzdom(:,:)%tmk==1 )
1175 !
1176  zw = sum(zsrf(:,:),mask=(ynhemis.AND.zfsit(:,:)>xfsic)) / 1.e+12
1177  CALL mpp_sum( zw ) ; zehn = zw
1178 !
1179  zw = sum(zsrf(:,:),mask=(yshemis.AND.zfsit(:,:)>xfsic)) / 1.e+12
1180  CALL mpp_sum( zw ) ; zehs = zw
1181 !
1182 ! .. Sea ice area, north and south
1183 !
1184  zw = sum(zsrf(:,:)*zfsit(:,:), mask=ynhemis) / 1.e+12
1185  CALL mpp_sum( zw ) ; zshn = zw
1186  zw = sum(zsrf(:,:)*zfsit(:,:), mask=yshemis) / 1.e+12
1187  CALL mpp_sum( zw ) ; zshs = zw
1188 !
1189 ! .. Sea ice volume, north and south
1190 !
1191  zw = sum(zsrf(:,:)*zhsit(:,:), mask=ynhemis) / 1.e+12
1192  CALL mpp_sum( zw ) ; zvhn = zw
1193  zw = sum(zsrf(:,:)*zhsit(:,:), mask=yshemis) / 1.e+12
1194  CALL mpp_sum( zw ) ; zvhs = zw
1195 !
1196 ! .. Snow volume, north and south
1197 !
1198  zw = sum(zsrf(:,:)*zhsnt(:,:), mask=ynhemis) / 1.e+12
1199  CALL mpp_sum( zw )
1200  zwhn = zw
1201  zw = sum(zsrf(:,:)*zhsnt(:,:), mask=yshemis) / 1.e+12
1202  CALL mpp_sum( zw )
1203  zwhs = zw
1204 
1205 !
1206 ! .. Ice glt_transport through straits (depends on mesh geometry)
1207 ! Has been only coded for NEMO1 grid.
1208 ! Note that the (i,j) indices are given for the full grid, including ghost
1209 ! points rows/ranks. For example, the NEMO1 grid has (362,292) points.
1210 ! (i,j) coordinates must be given in this grid, even if i=1, i=362,
1211 ! j=1, j=292 are ghost points.
1212 ! Here we are still in the parallel space. Some straits can be in different
1213 ! subdomains. We add up the contribution of the different subdomains
1214 ! (computed separately in iceflx). Note that in iceflx, we do not consider
1215 ! points which are ghost points if i=1 or j=1 (to avoid counting them twice).
1216 !
1217  zfram = 0.
1218  zbering = 0.
1219  zncwest = 0.
1220  znceast = 0.
1221  znorthb = 0.
1222 #if ! defined in_surfex
1223 !
1224  IF ( cn_grdname=='NEMO1' ) THEN
1225 !
1226 ! Fram Strait
1227  ii0 = 269
1228  ij0 = 272
1229 !
1230  DO ji=1,10
1231  ii = ii0+ji-1
1232  ij = ij0
1233  zfram = zfram + &
1234  iceflx( tzdom,zhsit,tzdia,ii,ij,ii,ij+1 )
1235  END DO
1236  zfram = -rhoice*zfram
1237 !
1238 ! Bering Strait
1239  ii0 = 115
1240  ij0 = 246
1241 !
1242  DO ji=1,2
1243  ii = ii0+ji-1
1244  ij = ij0
1245  zbering = zbering + &
1246  iceflx( tzdom,zhsit,tzdia,ii,ij,ii,ij+1 )
1247  END DO
1248  zbering = -rhoice*zbering
1249 !
1250 ! North Canadian Archipelago (West)
1251  ii0 = 232
1252  ij0 = 289
1253 !
1254  DO ji=1,2
1255  ii = ii0
1256  ij = ij0+ji-1
1257  zncwest = zncwest + &
1258  iceflx( tzdom,zhsit,tzdia,ii,ij,ii+1,ij )
1259  END DO
1260  zncwest = -rhoice*zncwest
1261 !
1262 ! Nares Strait (between Ellesmere Land and North Western Greenland)
1263 ! - we compute the ice flux at the northern boundary of this strait (at its
1264 ! Arctic Ocean boundary)
1265  ii0 = 253
1266  ij0 = 277
1267 !
1268  DO ji=1,2
1269  ii = ii0
1270  ij = ij0+ji-1
1271  znceast = znceast + &
1272  iceflx( tzdom,zhsit,tzdia,ii,ij,ii+1,ij )
1273  END DO
1274  znceast = -rhoice*znceast
1275 !
1276 ! Barrow Strait (between Prince of Wales I. - south and Bathurst I. - north)
1277 ! - we compute the ice flux
1278  ii0 = 283
1279  ij0 = 274
1280 !
1281  DO ji=1,14
1282  ii = ii0+ji-1
1283  ij = ij0+ji-1
1284  znorthb = znorthb - &
1285  iceflx( tzdom,zhsit,tzdia,ii,ij,ii,ij+1 ) + &
1286  iceflx( tzdom,zhsit,tzdia,ii-1,ij,ii,ij )
1287  END DO
1288  znorthb = -rhoice*znorthb
1289 !
1290  ENDIF
1291 !
1292 !
1293 ! 3.2. Write totals to diagnostic file
1294 ! -------------------------------------
1295 !
1296  IF ( ndiap1==1 ) THEN
1297 !
1298 !* Ex-SIEHNSIG
1299  tznam = t_def( &
1300  "North Hemisphere Sea Ice Extent", &
1301  "north_hemisphere_sea_ice_extent", &
1302  "icextn", "10^6 km2", "T", "SCALAR" )
1303  CALL gltools_outdia( tzind,tznam,tzdom,zehn,zcumdia0 )
1304 !
1305 !* Ex-SIEHNSIG
1306  tznam = t_def( &
1307  "South Hemisphere Sea Ice Extent", &
1308  "south_hemisphere_sea_ice_extent", &
1309  "icexts", "10^6 km2", "T", "SCALAR" )
1310  CALL gltools_outdia( tzind,tznam,tzdom,zehs,zcumdia0 )
1311 !
1312 !* Ex-SISHNSIG
1313  tznam = t_def( &
1314  "North Hemisphere Sea Ice Area", &
1315  "north_hemisphere_sea_ice_area", &
1316  "icearean", "10^6 km2", "T", "SCALAR" )
1317  CALL gltools_outdia( tzind,tznam,tzdom,zshn,zcumdia0 )
1318 !
1319 !* Ex-SISHSSIG
1320  tznam = t_def( &
1321  "South Hemisphere Sea Ice Area", &
1322  "south_hemisphere_sea_ice_area", &
1323  "iceareas", "10^6 km2", "T", "SCALAR" )
1324  CALL gltools_outdia( tzind,tznam,tzdom,zshs,zcumdia0 )
1325 !
1326 !* Ex-SIVHNSIG
1327  tznam = t_def( &
1328  "North Hemisphere Sea Ice Volume", &
1329  "north_hemisphere_sea_ice_volume", &
1330  "icevoln", "10^3 km3", "T", "SCALAR" )
1331  CALL gltools_outdia( tzind,tznam,tzdom,zvhn,zcumdia0 )
1332 !
1333 !* Ex-SIVHSSIG
1334  tznam = t_def( &
1335  "South Hemisphere Sea Ice Volume", &
1336  "south_hemisphere_sea_ice_volume", &
1337  "icevols", "10^3 km3", "T", "SCALAR" )
1338  CALL gltools_outdia( tzind,tznam,tzdom,zvhs,zcumdia0 )
1339 !
1340 !* Ex-SIWHNSIG
1341  tznam = t_def( &
1342  "North Hemisphere Snow Volume", &
1343  "north_hemisphere_sea_ice_volume", &
1344  "snovoln", "10^3 km3", "T", "SCALAR" )
1345  CALL gltools_outdia( tzind,tznam,tzdom,zwhn,zcumdia0 )
1346 !
1347 !* Ex-SIWHSSIG
1348  tznam = t_def( &
1349  "South Hemisphere Snow Volume", &
1350  "south_hemisphere_snow_volume", &
1351  "snovols", "10^3 km3", "T", "SCALAR" )
1352  CALL gltools_outdia( tzind,tznam,tzdom,zwhs,zcumdia0 )
1353 !
1354 !* Ex-SIFRAMST
1355  tznam = t_def( &
1356  "Sea Ice Mass Transport Through Fram Strait", &
1357  "", &
1358  "transifs", "kg.s-1", "T", "SCALAR" )
1359  CALL gltools_outdia( tzind,tznam,tzdom,zfram,zcumdia0 )
1360 !
1361 !* Ex-SIBERING
1362  tznam = t_def( &
1363  "Sea Ice Mass Transport Through Bering Strait", &
1364  "", &
1365  "tibering", "kg.s-1", "T", "SCALAR" )
1366  CALL gltools_outdia( tzind,tznam,tzdom,zbering,zcumdia0 )
1367 !
1368 !* Ex-SINCWEST (North Canadian Archipelago - West)
1369  tznam = t_def( &
1370  "Sea Ice Mass Transport Through NCA West", &
1371  "", &
1372  "tincawest", "kg.s-1", "T", "SCALAR" )
1373  CALL gltools_outdia( tzind,tznam,tzdom,zncwest,zcumdia0 )
1374 !
1375 !* Ex-SINCEAST (North Canadian Archipelago - East, Nares Strait)
1376  tznam = t_def( &
1377  "Sea Ice Mass Transport Through Nares Strait", &
1378  "", &
1379  "tinares", "kg.s-1", "T", "SCALAR" )
1380  CALL gltools_outdia( tzind,tznam,tzdom,znceast,zcumdia0 )
1381 !
1382 !* Ex-SINORTHB
1383  tznam = t_def( &
1384  "Sea Ice Mass Transport Through Barrow Strait", &
1385  "", &
1386  "tibarrow", "kg.s-1", "T", "SCALAR" )
1387  CALL gltools_outdia( tzind,tznam,tzdom,znorthb,zcumdia0 )
1388 !
1389  ENDIF
1390 #endif
1391 #endif
1392 !
1393 !
1394 ! 3.3. Print out some important statistics to outzut file
1395 ! --------------------------------------------------------
1396 !
1397  IF(lp1) WRITE(noutlu,*) ' North South'
1398  IF(lp1) WRITE(noutlu,1000) zshn,zshs
1399  IF ( ndiap3==1 ) THEN
1400  IF(lp1) WRITE(noutlu,1100) zehn,zehs
1401  ENDIF
1402  IF(lp1) WRITE(noutlu,1200) zwhn,zwhs
1403  IF(lp1) WRITE(noutlu,1300) zvhn,zvhs
1404  IF(lp1) WRITE(noutlu,*) ' Ice flux at Fram : ',zfram
1405  IF(lp1) WRITE(noutlu,*) ' '
1406 !
1407 !
1408 !
1409 ! 4. End
1410 ! =======
1411 !
1412 1000 FORMAT(5x,"Ice surface (SISH.SIG)",2(4x,f9.5))
1413 1100 FORMAT(5x,"Ice extent (SIEH.SIG)",2(4x,f9.5))
1414 1200 FORMAT(5x,"Snow volume (SIWH.SIG)",2(4x,f9.5))
1415 1300 FORMAT(5x,"Ice volume (SIVH.SIG)",2(4x,f9.5))
1416 !
1417 ! .. Farewell message
1418 !
1419  IF(lp1) WRITE(noutlu,*) ' '
1420  IF(lp1) WRITE(noutlu,*) ' *** LEVEL 3 - END SUBROUTINE WRIDIA_AR5'
1421  IF(lp1) WRITE(noutlu,*) ' '
1422 !
1423 END SUBROUTINE wridia_ar5
1424 !
1425 ! --------------------- END SUBROUTINE WRIDIA_AR5 -----------------------
1426 ! -----------------------------------------------------------------------
1427 END MODULE mode_glt_dia_ar5
1428 !
1429 ! ---------------------- END MODULE mode_glt_dia_ar5 ------------------------
subroutine gltools_glterr(hroutine, hmess, hflag)
subroutine gltools_outdia(tpind, tpnam, tpdom, pfield, pcumdia, pwgt)
subroutine wridia_ar5(tpglt)