limupdate2.F90 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. MODULE limupdate2
  2. !!======================================================================
  3. !! *** MODULE limupdate2 ***
  4. !! LIM-3 : Update of sea-ice global variables at the end of the time step
  5. !!======================================================================
  6. !! History : 3.0 ! 2006-04 (M. Vancoppenolle) Original code
  7. !! 3.5 ! 2014-06 (C. Rousset) Complete rewriting/cleaning
  8. !!----------------------------------------------------------------------
  9. #if defined key_lim3
  10. !!----------------------------------------------------------------------
  11. !! 'key_lim3' LIM3 sea-ice model
  12. !!----------------------------------------------------------------------
  13. !! lim_update2 : computes update of sea-ice global variables from trend terms
  14. !!----------------------------------------------------------------------
  15. USE sbc_oce ! Surface boundary condition: ocean fields
  16. USE sbc_ice ! Surface boundary condition: ice fields
  17. USE dom_ice
  18. USE dom_oce
  19. USE phycst ! physical constants
  20. USE ice
  21. USE thd_ice ! LIM thermodynamic sea-ice variables
  22. USE limitd_th
  23. USE limvar
  24. USE prtctl ! Print control
  25. USE lbclnk ! lateral boundary condition - MPP exchanges
  26. USE wrk_nemo ! work arrays
  27. USE timing ! Timing
  28. USE limcons ! conservation tests
  29. USE limctl
  30. USE lib_mpp ! MPP library
  31. USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
  32. USE in_out_manager
  33. IMPLICIT NONE
  34. PRIVATE
  35. PUBLIC lim_update2 ! routine called by ice_step
  36. !! * Substitutions
  37. # include "vectopt_loop_substitute.h90"
  38. !!----------------------------------------------------------------------
  39. !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
  40. !! $Id: limupdate2.F90 4578 2017-09-25 09:34:12Z ufla $
  41. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  42. !!----------------------------------------------------------------------
  43. CONTAINS
  44. SUBROUTINE lim_update2( kt )
  45. !!-------------------------------------------------------------------
  46. !! *** ROUTINE lim_update2 ***
  47. !!
  48. !! ** Purpose : Computes update of sea-ice global variables at
  49. !! the end of the time step.
  50. !!
  51. !!---------------------------------------------------------------------
  52. INTEGER, INTENT(in) :: kt ! number of iteration
  53. INTEGER :: ji, jj, jk, jl ! dummy loop indices
  54. REAL(wp) :: zsal
  55. REAL(wp) :: zvi_b, zsmv_b, zei_b, zfs_b, zfw_b, zft_b
  56. !!-------------------------------------------------------------------
  57. IF( nn_timing == 1 ) CALL timing_start('limupdate2')
  58. IF( kt == nit000 .AND. lwp ) THEN
  59. WRITE(numout,*)''
  60. WRITE(numout,*)' lim_update2 '
  61. WRITE(numout,*)' ~~~~~~~~~~~ '
  62. ENDIF
  63. ! conservation test
  64. IF( ln_limdiahsb ) CALL lim_cons_hsm(0, 'limupdate2', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
  65. !----------------------------------------------------------------------
  66. ! Constrain the thickness of the smallest category above himin
  67. !----------------------------------------------------------------------
  68. DO jj = 1, jpj
  69. DO ji = 1, jpi
  70. rswitch = MAX( 0._wp , SIGN( 1._wp, a_i(ji,jj,1) - epsi20 ) ) !0 if no ice and 1 if yes
  71. ht_i(ji,jj,1) = v_i (ji,jj,1) / MAX( a_i(ji,jj,1) , epsi20 ) * rswitch
  72. IF( v_i(ji,jj,1) > 0._wp .AND. ht_i(ji,jj,1) < rn_himin ) THEN
  73. a_i (ji,jj,1) = a_i (ji,jj,1) * ht_i(ji,jj,1) / rn_himin
  74. oa_i(ji,jj,1) = oa_i(ji,jj,1) * ht_i(ji,jj,1) / rn_himin
  75. ENDIF
  76. END DO
  77. END DO
  78. !-----------------------------------------------------
  79. ! ice concentration should not exceed amax
  80. !-----------------------------------------------------
  81. at_i(:,:) = 0._wp
  82. DO jl = 1, jpl
  83. at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
  84. END DO
  85. DO jl = 1, jpl
  86. DO jj = 1, jpj
  87. DO ji = 1, jpi
  88. IF( at_i(ji,jj) > rn_amax_2d(ji,jj) .AND. a_i(ji,jj,jl) > 0._wp ) THEN
  89. a_i (ji,jj,jl) = a_i (ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax_2d(ji,jj) / at_i(ji,jj) ) )
  90. oa_i(ji,jj,jl) = oa_i(ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax_2d(ji,jj) / at_i(ji,jj) ) )
  91. ENDIF
  92. END DO
  93. END DO
  94. END DO
  95. !---------------------
  96. ! Ice salinity
  97. !---------------------
  98. IF ( nn_icesal == 2 ) THEN
  99. DO jl = 1, jpl
  100. DO jj = 1, jpj
  101. DO ji = 1, jpi
  102. zsal = smv_i(ji,jj,jl)
  103. ! salinity stays in bounds
  104. rswitch = 1._wp - MAX( 0._wp, SIGN( 1._wp, - v_i(ji,jj,jl) ) )
  105. smv_i(ji,jj,jl) = rswitch * MAX( MIN( rn_simax * v_i(ji,jj,jl), smv_i(ji,jj,jl) ), rn_simin * v_i(ji,jj,jl) )
  106. ! associated salt flux
  107. sfx_res(ji,jj) = sfx_res(ji,jj) - ( smv_i(ji,jj,jl) - zsal ) * rhoic * r1_rdtice
  108. END DO
  109. END DO
  110. END DO
  111. ENDIF
  112. !----------------------------------------------------
  113. ! Rebin categories with thickness out of bounds
  114. !----------------------------------------------------
  115. IF ( jpl > 1 ) CALL lim_itd_th_reb( 1, jpl )
  116. !-----------------
  117. ! zap small values
  118. !-----------------
  119. CALL lim_var_zapsmall
  120. !------------------------------------------------------------------------------
  121. ! Corrections to avoid wrong values |
  122. !------------------------------------------------------------------------------
  123. ! Ice drift
  124. !------------
  125. DO jj = 2, jpjm1
  126. DO ji = 2, jpim1
  127. IF ( at_i(ji,jj) == 0._wp ) THEN ! what to do if there is no ice
  128. IF ( at_i(ji+1,jj) == 0._wp ) u_ice(ji,jj) = 0._wp ! right side
  129. IF ( at_i(ji-1,jj) == 0._wp ) u_ice(ji-1,jj) = 0._wp ! left side
  130. IF ( at_i(ji,jj+1) == 0._wp ) v_ice(ji,jj) = 0._wp ! upper side
  131. IF ( at_i(ji,jj-1) == 0._wp ) v_ice(ji,jj-1) = 0._wp ! bottom side
  132. ENDIF
  133. END DO
  134. END DO
  135. !lateral boundary conditions
  136. CALL lbc_lnk( u_ice(:,:), 'U', -1. )
  137. CALL lbc_lnk( v_ice(:,:), 'V', -1. )
  138. !mask velocities
  139. u_ice(:,:) = u_ice(:,:) * umask(:,:,1)
  140. v_ice(:,:) = v_ice(:,:) * vmask(:,:,1)
  141. ! -------------------------------------------------
  142. ! Diagnostics
  143. ! -------------------------------------------------
  144. DO jl = 1, jpl
  145. oa_i(:,:,jl) = oa_i(:,:,jl) + a_i(:,:,jl) * rdt_ice / rday ! ice natural aging
  146. afx_thd(:,:) = afx_thd(:,:) + ( a_i(:,:,jl) - a_i_b(:,:,jl) ) * r1_rdtice
  147. END DO
  148. afx_tot = afx_thd + afx_dyn
  149. DO jj = 1, jpj
  150. DO ji = 1, jpi
  151. ! heat content variation (W.m-2)
  152. diag_heat(ji,jj) = diag_heat(ji,jj) - &
  153. & ( SUM( e_i(ji,jj,1:nlay_i,:) - e_i_b(ji,jj,1:nlay_i,:) ) + &
  154. & SUM( e_s(ji,jj,1:nlay_s,:) - e_s_b(ji,jj,1:nlay_s,:) ) &
  155. & ) * r1_rdtice
  156. ! salt, volume
  157. diag_smvi(ji,jj) = diag_smvi(ji,jj) + SUM( smv_i(ji,jj,:) - smv_i_b(ji,jj,:) ) * rhoic * r1_rdtice
  158. diag_vice(ji,jj) = diag_vice(ji,jj) + SUM( v_i (ji,jj,:) - v_i_b (ji,jj,:) ) * rhoic * r1_rdtice
  159. diag_vsnw(ji,jj) = diag_vsnw(ji,jj) + SUM( v_s (ji,jj,:) - v_s_b (ji,jj,:) ) * rhosn * r1_rdtice
  160. END DO
  161. END DO
  162. ! conservation test
  163. IF( ln_limdiahsb ) CALL lim_cons_hsm(1, 'limupdate2', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
  164. ! necessary calls (at least for coupling)
  165. CALL lim_var_glo2eqv
  166. CALL lim_var_agg(2)
  167. ! -------------------------------------------------
  168. ! control prints
  169. ! -------------------------------------------------
  170. IF( ln_icectl ) CALL lim_prt( kt, iiceprt, jiceprt, 2, ' - Final state - ' ) ! control print
  171. IF(ln_ctl) THEN ! Control print
  172. CALL prt_ctl_info(' ')
  173. CALL prt_ctl_info(' - Cell values : ')
  174. CALL prt_ctl_info(' ~~~~~~~~~~~~~ ')
  175. CALL prt_ctl(tab2d_1=e12t , clinfo1=' lim_update2 : cell area :')
  176. CALL prt_ctl(tab2d_1=at_i , clinfo1=' lim_update2 : at_i :')
  177. CALL prt_ctl(tab2d_1=vt_i , clinfo1=' lim_update2 : vt_i :')
  178. CALL prt_ctl(tab2d_1=vt_s , clinfo1=' lim_update2 : vt_s :')
  179. CALL prt_ctl(tab2d_1=strength , clinfo1=' lim_update2 : strength :')
  180. CALL prt_ctl(tab2d_1=u_ice , clinfo1=' lim_update2 : u_ice :', tab2d_2=v_ice , clinfo2=' v_ice :')
  181. CALL prt_ctl(tab2d_1=u_ice_b , clinfo1=' lim_update2 : u_ice_b :', tab2d_2=v_ice_b , clinfo2=' v_ice_b :')
  182. DO jl = 1, jpl
  183. CALL prt_ctl_info(' ')
  184. CALL prt_ctl_info(' - Category : ', ivar1=jl)
  185. CALL prt_ctl_info(' ~~~~~~~~~~')
  186. CALL prt_ctl(tab2d_1=ht_i (:,:,jl) , clinfo1= ' lim_update2 : ht_i : ')
  187. CALL prt_ctl(tab2d_1=ht_s (:,:,jl) , clinfo1= ' lim_update2 : ht_s : ')
  188. CALL prt_ctl(tab2d_1=t_su (:,:,jl) , clinfo1= ' lim_update2 : t_su : ')
  189. CALL prt_ctl(tab2d_1=t_s (:,:,1,jl) , clinfo1= ' lim_update2 : t_snow : ')
  190. CALL prt_ctl(tab2d_1=sm_i (:,:,jl) , clinfo1= ' lim_update2 : sm_i : ')
  191. CALL prt_ctl(tab2d_1=o_i (:,:,jl) , clinfo1= ' lim_update2 : o_i : ')
  192. CALL prt_ctl(tab2d_1=a_i (:,:,jl) , clinfo1= ' lim_update2 : a_i : ')
  193. CALL prt_ctl(tab2d_1=a_i_b (:,:,jl) , clinfo1= ' lim_update2 : a_i_b : ')
  194. CALL prt_ctl(tab2d_1=v_i (:,:,jl) , clinfo1= ' lim_update2 : v_i : ')
  195. CALL prt_ctl(tab2d_1=v_i_b (:,:,jl) , clinfo1= ' lim_update2 : v_i_b : ')
  196. CALL prt_ctl(tab2d_1=v_s (:,:,jl) , clinfo1= ' lim_update2 : v_s : ')
  197. CALL prt_ctl(tab2d_1=v_s_b (:,:,jl) , clinfo1= ' lim_update2 : v_s_b : ')
  198. CALL prt_ctl(tab2d_1=e_i (:,:,1,jl) , clinfo1= ' lim_update2 : e_i1 : ')
  199. CALL prt_ctl(tab2d_1=e_i_b (:,:,1,jl) , clinfo1= ' lim_update2 : e_i1_b : ')
  200. CALL prt_ctl(tab2d_1=e_i (:,:,2,jl) , clinfo1= ' lim_update2 : e_i2 : ')
  201. CALL prt_ctl(tab2d_1=e_i_b (:,:,2,jl) , clinfo1= ' lim_update2 : e_i2_b : ')
  202. CALL prt_ctl(tab2d_1=e_s (:,:,1,jl) , clinfo1= ' lim_update2 : e_snow : ')
  203. CALL prt_ctl(tab2d_1=e_s_b (:,:,1,jl) , clinfo1= ' lim_update2 : e_snow_b : ')
  204. CALL prt_ctl(tab2d_1=smv_i (:,:,jl) , clinfo1= ' lim_update2 : smv_i : ')
  205. CALL prt_ctl(tab2d_1=smv_i_b (:,:,jl) , clinfo1= ' lim_update2 : smv_i_b : ')
  206. CALL prt_ctl(tab2d_1=oa_i (:,:,jl) , clinfo1= ' lim_update2 : oa_i : ')
  207. CALL prt_ctl(tab2d_1=oa_i_b (:,:,jl) , clinfo1= ' lim_update2 : oa_i_b : ')
  208. DO jk = 1, nlay_i
  209. CALL prt_ctl_info(' - Layer : ', ivar1=jk)
  210. CALL prt_ctl(tab2d_1=t_i(:,:,jk,jl) , clinfo1= ' lim_update2 : t_i : ')
  211. END DO
  212. END DO
  213. CALL prt_ctl_info(' ')
  214. CALL prt_ctl_info(' - Heat / FW fluxes : ')
  215. CALL prt_ctl_info(' ~~~~~~~~~~~~~~~~~~ ')
  216. CALL prt_ctl(tab2d_1=sst_m , clinfo1= ' lim_update2 : sst : ', tab2d_2=sss_m , clinfo2= ' sss : ')
  217. CALL prt_ctl_info(' ')
  218. CALL prt_ctl_info(' - Stresses : ')
  219. CALL prt_ctl_info(' ~~~~~~~~~~ ')
  220. CALL prt_ctl(tab2d_1=utau , clinfo1= ' lim_update2 : utau : ', tab2d_2=vtau , clinfo2= ' vtau : ')
  221. CALL prt_ctl(tab2d_1=utau_ice , clinfo1= ' lim_update2 : utau_ice : ', tab2d_2=vtau_ice , clinfo2= ' vtau_ice : ')
  222. CALL prt_ctl(tab2d_1=u_oce , clinfo1= ' lim_update2 : u_oce : ', tab2d_2=v_oce , clinfo2= ' v_oce : ')
  223. ENDIF
  224. IF( nn_timing == 1 ) CALL timing_stop('limupdate2')
  225. END SUBROUTINE lim_update2
  226. #else
  227. !!----------------------------------------------------------------------
  228. !! Default option Empty Module No sea-ice model
  229. !!----------------------------------------------------------------------
  230. CONTAINS
  231. SUBROUTINE lim_update2 ! Empty routine
  232. END SUBROUTINE lim_update2
  233. #endif
  234. END MODULE limupdate2