limdia_2.F90 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. MODULE limdia_2
  2. !!======================================================================
  3. !! *** MODULE limdia_2 ***
  4. !! diagnostics of ice model
  5. !!======================================================================
  6. !! History : 8.0 ! 97-06 (Louvain-La-Neuve) Original code
  7. !! 8.5 ! 02-09 (C. Ethe , G. Madec ) F90: Free form and module
  8. !! 9.0 ! 06-08 (S. Masson) change frequency output control
  9. !!-------------------------------------------------------------------
  10. #if defined key_lim2
  11. !!----------------------------------------------------------------------
  12. !! 'key_lim2' : LIM 2.0 sea-ice model
  13. !!----------------------------------------------------------------------
  14. !! lim_dia_2 : computation of the time evolution of keys var.
  15. !! lim_dia_init_2 : initialization and namelist read
  16. !!----------------------------------------------------------------------
  17. USE dom_oce ! ocean space and time domain
  18. USE phycst !
  19. USE par_ice_2 ! ice parameters
  20. USE sbc_oce ! surface boundary condition variables
  21. USE dom_ice_2 !
  22. USE ice_2 !
  23. USE limistate_2 !
  24. USE in_out_manager ! I/O manager
  25. USE lib_mpp ! MPP library
  26. USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
  27. IMPLICIT NONE
  28. PRIVATE
  29. PUBLIC lim_dia_2 ! called by sbc_ice_lim_2
  30. PUBLIC lim_dia_init_2 ! called by sbc_ice_lim_2
  31. INTEGER, PUBLIC :: ntmoy , & !: instantaneous values of ice evolution or averaging ntmoy
  32. & ninfo !: frequency of ouputs on file ice_evolu in case of averaging
  33. INTEGER, PARAMETER :: & ! Parameters for outputs to files "evolu"
  34. jpinfmx = 100 , & ! maximum number of key variables
  35. jpchinf = 5 , & ! ???
  36. jpchsep = jpchinf + 2 ! ???
  37. INTEGER :: &
  38. nfrinf , & ! number of variables written in one line
  39. nferme , & ! last time step at which the var. are written on file
  40. nvinfo , & ! number of total variables
  41. nbvt , & ! number of time variables
  42. naveg ! number of step for accumulation before averaging
  43. CHARACTER(len= 8) :: fmtinf ! format of the output values
  44. CHARACTER(len=30) :: fmtw , & ! formats
  45. & fmtr , & ! ???
  46. & fmtitr ! ???
  47. CHARACTER(len=jpchsep), DIMENSION(jpinfmx) :: titvar ! title of key variables
  48. REAL(wp) :: epsi06 = 1.e-06 ! ???
  49. REAL(wp), DIMENSION(jpinfmx) :: vinfom ! temporary working space
  50. REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: aire ! masked grid cell area
  51. !! * Substitutions
  52. # include "vectopt_loop_substitute.h90"
  53. !!----------------------------------------------------------------------
  54. !! NEMO/LIM2 3.3 , UCL - NEMO Consortium (2010)
  55. !! $Id: limdia_2.F90 4624 2014-04-28 12:09:03Z acc $
  56. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  57. !!----------------------------------------------------------------------
  58. CONTAINS
  59. SUBROUTINE lim_dia_2( kt )
  60. !!--------------------------------------------------------------------
  61. !! *** ROUTINE lim_dia_2 ***
  62. !!
  63. !! ** Purpose : Computation and outputs on file ice.evolu
  64. !! the temporal evolution of some key variables
  65. !!-------------------------------------------------------------------
  66. INTEGER, INTENT(in) :: kt ! number of iteration
  67. !!
  68. INTEGER :: jv,ji, jj ! dummy loop indices
  69. INTEGER :: nv ! indice of variable
  70. REAL(wp) :: zarea , zldarea , & ! sea-ice and leads area
  71. & zextent15, zextent85, & ! sea-ice extent (15% and 85%)
  72. & zicevol , zsnwvol , & ! sea-ice and snow volume volume
  73. & zicespd ! sea-ice velocity
  74. REAL(wp), DIMENSION(jpinfmx) :: vinfor ! temporary working space
  75. !!-------------------------------------------------------------------
  76. ! computation of key variables at each time step
  77. nv = 1
  78. vinfor(nv) = REAL( kt + nn_fsbc - 1 )
  79. nv = nv + 1
  80. vinfor(nv) = nyear
  81. DO jv = nbvt + 1, nvinfo
  82. vinfor(jv) = 0.e0
  83. END DO
  84. zextent15 = 0.e0
  85. zextent85 = 0.e0
  86. ! variables in northern Hemis
  87. DO jj = njeq, jpjm1
  88. DO ji = fs_2, fs_jpim1 ! vector opt.
  89. IF( tms(ji,jj) == 1 ) THEN
  90. zarea = ( 1.0 - frld(ji,jj) ) * aire(ji,jj)
  91. IF (frld(ji,jj) <= 0.15 ) zextent15 = aire(ji,jj)
  92. IF (frld(ji,jj) <= 0.85 ) zextent85 = aire(ji,jj)
  93. zldarea = zarea / MAX( ( 1 - frld(ji,jj) ) , epsi06 )
  94. zicevol = zarea * hicif(ji,jj)
  95. zsnwvol = zarea * hsnif(ji,jj)
  96. zicespd = zicevol * ( u_ice(ji,jj) * u_ice(ji,jj) + v_ice(ji,jj) * v_ice(ji,jj) )
  97. vinfor(nv+ 1) = vinfor(nv+ 1) + zarea
  98. vinfor(nv+ 3) = vinfor(nv+ 3) + zextent15
  99. vinfor(nv+ 5) = vinfor(nv+ 5) + zextent85
  100. vinfor(nv+ 7) = vinfor(nv+ 7) + zldarea
  101. vinfor(nv+ 9) = vinfor(nv+ 9) + zicevol
  102. vinfor(nv+11) = vinfor(nv+11) + zsnwvol
  103. vinfor(nv+13) = vinfor(nv+13) + zicespd
  104. ENDIF
  105. END DO
  106. END DO
  107. vinfor(nv+13) = SQRT( vinfor(nv+13) / MAX( vinfor(nv+9) , epsi06 ) )
  108. ! variables in southern Hemis
  109. nv = nv + 1
  110. DO jj = 2, njeqm1
  111. DO ji = fs_2, fs_jpim1 ! vector opt.
  112. IF( tms(ji,jj) == 1 ) THEN
  113. zarea = ( 1.0 - frld(ji,jj) ) * aire(ji,jj)
  114. IF (frld(ji,jj) <= 0.15 ) zextent15 = aire(ji,jj)
  115. IF (frld(ji,jj) <= 0.85 ) zextent85 = aire(ji,jj)
  116. zldarea = zarea / MAX( ( 1 - frld(ji,jj) ) , epsi06 )
  117. zicevol = zarea * hicif(ji,jj)
  118. zsnwvol = zarea * hsnif(ji,jj)
  119. zicespd = zicevol * ( u_ice(ji,jj) * u_ice(ji,jj) + v_ice(ji,jj) * v_ice(ji,jj) )
  120. vinfor(nv+ 1) = vinfor(nv+ 1) + zarea
  121. vinfor(nv+ 3) = vinfor(nv+ 3) + zextent15
  122. vinfor(nv+ 5) = vinfor(nv+ 5) + zextent85
  123. vinfor(nv+ 7) = vinfor(nv+ 7) + zldarea
  124. vinfor(nv+ 9) = vinfor(nv+ 9) + zicevol
  125. vinfor(nv+11) = vinfor(nv+11) + zsnwvol
  126. vinfor(nv+13) = vinfor(nv+13) + zicespd
  127. ENDIF
  128. END DO
  129. END DO
  130. vinfor(nv+13) = SQRT( vinfor(nv+13) / MAX( vinfor(nv+9) , epsi06 ) )
  131. ! Accumulation before averaging
  132. DO jv = 1, nvinfo
  133. vinfom(jv) = vinfom(jv) + vinfor(jv)
  134. END DO
  135. naveg = naveg + 1
  136. ! oututs on file ice_evolu
  137. IF( MOD( kt + nn_fsbc - 1, ninfo ) == 0 ) THEN
  138. WRITE(numevo_ice,fmtw) ( titvar(jv), vinfom(jv)/naveg, jv = 1, nvinfo )
  139. naveg = 0
  140. DO jv = 1, nvinfo
  141. vinfom(jv) = 0.e0
  142. END DO
  143. ENDIF
  144. !
  145. END SUBROUTINE lim_dia_2
  146. SUBROUTINE lim_dia_init_2
  147. !!-------------------------------------------------------------------
  148. !! *** ROUTINE lim_dia_init_2 ***
  149. !!
  150. !! ** Purpose : Preparation of the file ice_evolu for the output of
  151. !! the temporal evolution of key variables
  152. !!
  153. !! ** input : Namelist namicedia
  154. !!-------------------------------------------------------------------
  155. CHARACTER(len=jpchinf) :: titinf
  156. INTEGER :: jv ! dummy loop indice
  157. INTEGER :: ntot , ndeb, nv, ierr ! local integer
  158. INTEGER :: ios ! Local integer output status for namelist read
  159. REAL(wp) :: zxx0, zxx1 ! local scalars
  160. NAMELIST/namicedia/fmtinf, nfrinf, ninfo, ntmoy
  161. !!-------------------------------------------------------------------
  162. REWIND( numnam_ice_ref ) ! Namelist namicedia in reference namelist : Ice diagnostics in ice_evolu
  163. READ ( numnam_ice_ref, namicedia, IOSTAT = ios, ERR = 901)
  164. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicedia in reference namelist', lwp )
  165. REWIND( numnam_ice_cfg ) ! Namelist namicedia in configuration namelist : Ice diagnostics in ice_evolu
  166. READ ( numnam_ice_cfg, namicedia, IOSTAT = ios, ERR = 902 )
  167. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicedia in configuration namelist', lwp )
  168. IF(lwm) WRITE ( numoni, namicedia )
  169. IF(lwp) THEN ! control print
  170. WRITE(numout,*)
  171. WRITE(numout,*) 'lim_dia_init_2 : ice parameters for ice diagnostics '
  172. WRITE(numout,*) '~~~~~~~~~~~~~~'
  173. WRITE(numout,*) ' format of the output values fmtinf = ', fmtinf
  174. WRITE(numout,*) ' number of variables written in one line nfrinf = ', nfrinf
  175. WRITE(numout,*) ' Instantaneous values of ice evolution or averaging ntmoy = ', ntmoy
  176. WRITE(numout,*) ' frequency of ouputs on file ice_evolu in case of averaging ninfo = ', ninfo
  177. ENDIF
  178. ALLOCATE( aire(jpi,jpj) , STAT=ierr ) ! masked grid cell area
  179. IF( lk_mpp ) CALL mpp_sum( ierr )
  180. IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'lim_dia_init_2 : unable to allocate standard arrays' )
  181. aire(:,:) = area(:,:) * tms(:,:)
  182. nv = 1 ! Titles of ice key variables
  183. titvar(nv) = 'NoIt' ! iteration number
  184. nv = nv + 1
  185. titvar(nv) = 'T yr' ! time step in years
  186. nbvt = nv - 1
  187. nv = nv + 1 ; titvar(nv) = 'AEFN' ! sea ice area in the northern Hemisp.(10^12 km2)
  188. nv = nv + 1 ; titvar(nv) = 'AEFS' ! sea ice area in the southern Hemisp.(10^12 km2)
  189. nv = nv + 1 ; titvar(nv) = 'A15N' ! sea ice extent (15%) in the northern Hemisp.(10^12 km2)
  190. nv = nv + 1 ; titvar(nv) = 'A15S' ! sea ice extent (15%) in the southern Hemisp.(10^12 km2)
  191. nv = nv + 1 ; titvar(nv) = 'A85N' ! sea ice extent (85%) in the northern Hemisp.(10^12 km2)
  192. nv = nv + 1 ; titvar(nv) = 'A85S' ! sea ice extent (85%) in the southern Hemisp.(10^12 km2)
  193. nv = nv + 1 ; titvar(nv) = 'ALEN' ! leads area in the northern Hemisp.(10^12 km2)
  194. nv = nv + 1 ; titvar(nv) = 'ALES' ! leads area in the southern Hemisp.(10^12 km2)
  195. nv = nv + 1 ; titvar(nv) = 'VOLN' ! sea ice volume in the northern Hemisp.(10^3 km3)
  196. nv = nv + 1 ; titvar(nv) = 'VOLS' ! sea ice volume in the southern Hemisp.(10^3 km3)
  197. nv = nv + 1 ; titvar(nv) = 'VONN' ! snow volume over sea ice in the northern Hemisp.(10^3 km3)
  198. nv = nv + 1 ; titvar(nv) = 'VONS' ! snow volume over sea ice in the southern Hemisp.(10^3 km3)
  199. nv = nv + 1 ; titvar(nv) = 'ECGN' ! mean sea ice velocity in the northern Hemisp.(m/s)
  200. nv = nv + 1 ; titvar(nv) = 'ECGS' ! mean sea ice velocity in the southern Hemisp.(m/s)
  201. nvinfo = nv
  202. ! Definition et Ecriture de l'entete : nombre d'enregistrements
  203. ndeb = ( nit000 - 1 + nn_fsbc - 1 ) / ninfo
  204. IF( nit000 - 1 + nn_fsbc == 1 ) ndeb = -1
  205. nferme = ( nitend + nn_fsbc - 1 ) / ninfo ! nit000 - 1 + nn_fsbc - 1 + nitend - nit000 + 1
  206. ntot = nferme - ndeb
  207. ndeb = ninfo * ( 1 + ndeb )
  208. nferme = ninfo * nferme
  209. ! definition of formats
  210. WRITE( fmtw , '(A,I3,A2,I1,A)' ) '(', nfrinf, '(A', jpchsep, ','//fmtinf//'))'
  211. WRITE( fmtr , '(A,I3,A,I1,A)' ) '(', nfrinf, '(', jpchsep, 'X,'//fmtinf//'))'
  212. WRITE( fmtitr, '(A,I3,A,I1,A)' ) '(', nvinfo, 'A', jpchinf, ')'
  213. ! opening "ice_evolu" file
  214. CALL ctl_opn( numevo_ice, 'ice_evolu', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
  215. !- ecriture de 2 lignes d''entete :
  216. WRITE(numevo_ice,1000) fmtr, fmtw, fmtitr, nvinfo, ntot, 0, nfrinf
  217. zxx0 = 0.001 * REAL( ninfo )
  218. zxx1 = 0.001 * REAL( ndeb )
  219. WRITE(numevo_ice,1111) REAL(jpchinf), 0., zxx1, zxx0, 0., 0., 0
  220. !- ecriture de 2 lignes de titre :
  221. WRITE(numevo_ice,'(A,I8,A,I8,A,I5)') &
  222. 'Evolution chronologique - Experience '//cexper &
  223. //' de', ndeb, ' a', nferme, ' pas', ninfo
  224. WRITE(numevo_ice,fmtitr) ( titvar(jv), jv = 1, nvinfo )
  225. !--preparation de "titvar" pour l''ecriture parmi les valeurs numeriques :
  226. DO jv = 2 , nvinfo
  227. titinf = titvar(jv)(:jpchinf)
  228. titvar(jv) = ' '//titinf
  229. END DO
  230. !--Initialisation of the arrays for the accumulation
  231. DO jv = 1, nvinfo
  232. vinfom(jv) = 0.
  233. END DO
  234. naveg = 0
  235. 1000 FORMAT( 3(A20),4(1x,I6) )
  236. 1111 FORMAT( 3(F7.1,1X,F7.3,1X),I3,A )
  237. !
  238. END SUBROUTINE lim_dia_init_2
  239. #else
  240. !!----------------------------------------------------------------------
  241. !! Default option : NO LIM 2.0 sea-ice model
  242. !!----------------------------------------------------------------------
  243. CONTAINS
  244. SUBROUTINE lim_dia_2 ! Empty routine
  245. END SUBROUTINE lim_dia_2
  246. #endif
  247. !!======================================================================
  248. END MODULE limdia_2