limupdate2.F90 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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 8169 2017-06-14 08:04:06Z vancop $
  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,*) ' lim_update2 '
  60. WRITE(numout,*) ' ~~~~~~~~~~~ '
  61. ENDIF
  62. ! conservation test
  63. IF( ln_limdiahsb ) CALL lim_cons_hsm(0, 'limupdate2', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
  64. !----------------------------------------------------------------------
  65. ! Constrain the thickness of the smallest category above himin
  66. !----------------------------------------------------------------------
  67. DO jj = 1, jpj
  68. DO ji = 1, jpi
  69. rswitch = MAX( 0._wp , SIGN( 1._wp, a_i(ji,jj,1) - epsi20 ) ) !0 if no ice and 1 if yes
  70. ht_i(ji,jj,1) = v_i (ji,jj,1) / MAX( a_i(ji,jj,1) , epsi20 ) * rswitch
  71. IF( v_i(ji,jj,1) > 0._wp .AND. ht_i(ji,jj,1) < rn_himin ) THEN
  72. a_i (ji,jj,1) = a_i (ji,jj,1) * ht_i(ji,jj,1) / rn_himin
  73. ENDIF
  74. END DO
  75. END DO
  76. !-----------------------------------------------------
  77. ! ice concentration should not exceed amax
  78. !-----------------------------------------------------
  79. at_i(:,:) = 0._wp
  80. DO jl = 1, jpl
  81. at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
  82. END DO
  83. DO jl = 1, jpl
  84. DO jj = 1, jpj
  85. DO ji = 1, jpi
  86. IF( at_i(ji,jj) > rn_amax_2d(ji,jj) .AND. a_i(ji,jj,jl) > 0._wp ) THEN
  87. a_i (ji,jj,jl) = a_i (ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax_2d(ji,jj) / at_i(ji,jj) ) )
  88. ENDIF
  89. END DO
  90. END DO
  91. END DO
  92. !---------------------
  93. ! Ice salinity
  94. !---------------------
  95. IF ( nn_icesal == 2 ) THEN
  96. DO jl = 1, jpl
  97. DO jj = 1, jpj
  98. DO ji = 1, jpi
  99. zsal = smv_i(ji,jj,jl)
  100. ! salinity stays in bounds
  101. rswitch = 1._wp - MAX( 0._wp, SIGN( 1._wp, - v_i(ji,jj,jl) ) )
  102. 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) )
  103. ! associated salt flux
  104. sfx_res(ji,jj) = sfx_res(ji,jj) - ( smv_i(ji,jj,jl) - zsal ) * rhoic * r1_rdtice
  105. END DO
  106. END DO
  107. END DO
  108. ENDIF
  109. !----------------------------------------------------
  110. ! Rebin categories with thickness out of bounds
  111. !----------------------------------------------------
  112. IF ( jpl > 1 ) CALL lim_itd_th_reb( 1, jpl )
  113. !-----------------
  114. ! zap small values
  115. !-----------------
  116. CALL lim_var_zapsmall
  117. !------------------------------------------------------------------------------
  118. ! Corrections to avoid wrong values |
  119. !------------------------------------------------------------------------------
  120. ! Ice drift
  121. !------------
  122. DO jj = 2, jpjm1
  123. DO ji = 2, jpim1
  124. IF ( at_i(ji,jj) == 0._wp ) THEN ! what to do if there is no ice
  125. IF ( at_i(ji+1,jj) == 0._wp ) u_ice(ji,jj) = 0._wp ! right side
  126. IF ( at_i(ji-1,jj) == 0._wp ) u_ice(ji-1,jj) = 0._wp ! left side
  127. IF ( at_i(ji,jj+1) == 0._wp ) v_ice(ji,jj) = 0._wp ! upper side
  128. IF ( at_i(ji,jj-1) == 0._wp ) v_ice(ji,jj-1) = 0._wp ! bottom side
  129. ENDIF
  130. END DO
  131. END DO
  132. !lateral boundary conditions
  133. CALL lbc_lnk( u_ice(:,:), 'U', -1. )
  134. CALL lbc_lnk( v_ice(:,:), 'V', -1. )
  135. !mask velocities
  136. u_ice(:,:) = u_ice(:,:) * umask(:,:,1)
  137. v_ice(:,:) = v_ice(:,:) * vmask(:,:,1)
  138. ! -------------------------------------------------
  139. ! Diagnostics
  140. ! -------------------------------------------------
  141. DO jl = 1, jpl
  142. oa_i(:,:,jl) = oa_i(:,:,jl) + a_i(:,:,jl) * rdt_ice ! ice natural aging
  143. afx_thd(:,:) = afx_thd(:,:) + ( a_i(:,:,jl) - a_i_b(:,:,jl) ) * r1_rdtice
  144. END DO
  145. afx_tot = afx_thd + afx_dyn
  146. DO jj = 1, jpj
  147. DO ji = 1, jpi
  148. ! heat content variation (W.m-2)
  149. diag_heat(ji,jj) = diag_heat(ji,jj) - &
  150. & ( SUM( e_i(ji,jj,1:nlay_i,:) - e_i_b(ji,jj,1:nlay_i,:) ) + &
  151. & SUM( e_s(ji,jj,1:nlay_s,:) - e_s_b(ji,jj,1:nlay_s,:) ) &
  152. & ) * r1_rdtice
  153. ! salt, volume
  154. diag_smvi(ji,jj) = diag_smvi(ji,jj) + SUM( smv_i(ji,jj,:) - smv_i_b(ji,jj,:) ) * rhoic * r1_rdtice
  155. diag_vice(ji,jj) = diag_vice(ji,jj) + SUM( v_i (ji,jj,:) - v_i_b (ji,jj,:) ) * rhoic * r1_rdtice
  156. diag_vsnw(ji,jj) = diag_vsnw(ji,jj) + SUM( v_s (ji,jj,:) - v_s_b (ji,jj,:) ) * rhosn * r1_rdtice
  157. END DO
  158. END DO
  159. ! conservation test
  160. IF( ln_limdiahsb ) CALL lim_cons_hsm(1, 'limupdate2', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
  161. ! necessary calls (at least for coupling)
  162. CALL lim_var_glo2eqv
  163. CALL lim_var_agg(2)
  164. ! -------------------------------------------------
  165. ! control prints
  166. ! -------------------------------------------------
  167. IF( ln_icectl ) CALL lim_prt( kt, iiceprt, jiceprt, 2, ' - Final state - ' ) ! control print
  168. IF(ln_ctl) THEN ! Control print
  169. CALL prt_ctl_info(' ')
  170. CALL prt_ctl_info(' - Cell values : ')
  171. CALL prt_ctl_info(' ~~~~~~~~~~~~~ ')
  172. CALL prt_ctl(tab2d_1=e12t , clinfo1=' lim_update2 : cell area :')
  173. CALL prt_ctl(tab2d_1=at_i , clinfo1=' lim_update2 : at_i :')
  174. CALL prt_ctl(tab2d_1=vt_i , clinfo1=' lim_update2 : vt_i :')
  175. CALL prt_ctl(tab2d_1=vt_s , clinfo1=' lim_update2 : vt_s :')
  176. CALL prt_ctl(tab2d_1=strength , clinfo1=' lim_update2 : strength :')
  177. CALL prt_ctl(tab2d_1=u_ice , clinfo1=' lim_update2 : u_ice :', tab2d_2=v_ice , clinfo2=' v_ice :')
  178. CALL prt_ctl(tab2d_1=u_ice_b , clinfo1=' lim_update2 : u_ice_b :', tab2d_2=v_ice_b , clinfo2=' v_ice_b :')
  179. DO jl = 1, jpl
  180. CALL prt_ctl_info(' ')
  181. CALL prt_ctl_info(' - Category : ', ivar1=jl)
  182. CALL prt_ctl_info(' ~~~~~~~~~~')
  183. CALL prt_ctl(tab2d_1=ht_i (:,:,jl) , clinfo1= ' lim_update2 : ht_i : ')
  184. CALL prt_ctl(tab2d_1=ht_s (:,:,jl) , clinfo1= ' lim_update2 : ht_s : ')
  185. CALL prt_ctl(tab2d_1=t_su (:,:,jl) , clinfo1= ' lim_update2 : t_su : ')
  186. CALL prt_ctl(tab2d_1=t_s (:,:,1,jl) , clinfo1= ' lim_update2 : t_snow : ')
  187. CALL prt_ctl(tab2d_1=sm_i (:,:,jl) , clinfo1= ' lim_update2 : sm_i : ')
  188. CALL prt_ctl(tab2d_1=o_i (:,:,jl) , clinfo1= ' lim_update2 : o_i : ')
  189. CALL prt_ctl(tab2d_1=a_i (:,:,jl) , clinfo1= ' lim_update2 : a_i : ')
  190. CALL prt_ctl(tab2d_1=a_i_b (:,:,jl) , clinfo1= ' lim_update2 : a_i_b : ')
  191. CALL prt_ctl(tab2d_1=v_i (:,:,jl) , clinfo1= ' lim_update2 : v_i : ')
  192. CALL prt_ctl(tab2d_1=v_i_b (:,:,jl) , clinfo1= ' lim_update2 : v_i_b : ')
  193. CALL prt_ctl(tab2d_1=v_s (:,:,jl) , clinfo1= ' lim_update2 : v_s : ')
  194. CALL prt_ctl(tab2d_1=v_s_b (:,:,jl) , clinfo1= ' lim_update2 : v_s_b : ')
  195. CALL prt_ctl(tab2d_1=e_i (:,:,1,jl) , clinfo1= ' lim_update2 : e_i1 : ')
  196. CALL prt_ctl(tab2d_1=e_i_b (:,:,1,jl) , clinfo1= ' lim_update2 : e_i1_b : ')
  197. CALL prt_ctl(tab2d_1=e_i (:,:,2,jl) , clinfo1= ' lim_update2 : e_i2 : ')
  198. CALL prt_ctl(tab2d_1=e_i_b (:,:,2,jl) , clinfo1= ' lim_update2 : e_i2_b : ')
  199. CALL prt_ctl(tab2d_1=e_s (:,:,1,jl) , clinfo1= ' lim_update2 : e_snow : ')
  200. CALL prt_ctl(tab2d_1=e_s_b (:,:,1,jl) , clinfo1= ' lim_update2 : e_snow_b : ')
  201. CALL prt_ctl(tab2d_1=smv_i (:,:,jl) , clinfo1= ' lim_update2 : smv_i : ')
  202. CALL prt_ctl(tab2d_1=smv_i_b (:,:,jl) , clinfo1= ' lim_update2 : smv_i_b : ')
  203. CALL prt_ctl(tab2d_1=oa_i (:,:,jl) , clinfo1= ' lim_update2 : oa_i : ')
  204. CALL prt_ctl(tab2d_1=oa_i_b (:,:,jl) , clinfo1= ' lim_update2 : oa_i_b : ')
  205. DO jk = 1, nlay_i
  206. CALL prt_ctl_info(' - Layer : ', ivar1=jk)
  207. CALL prt_ctl(tab2d_1=t_i(:,:,jk,jl) , clinfo1= ' lim_update2 : t_i : ')
  208. END DO
  209. END DO
  210. CALL prt_ctl_info(' ')
  211. CALL prt_ctl_info(' - Heat / FW fluxes : ')
  212. CALL prt_ctl_info(' ~~~~~~~~~~~~~~~~~~ ')
  213. CALL prt_ctl(tab2d_1=sst_m , clinfo1= ' lim_update2 : sst : ', tab2d_2=sss_m , clinfo2= ' sss : ')
  214. CALL prt_ctl_info(' ')
  215. CALL prt_ctl_info(' - Stresses : ')
  216. CALL prt_ctl_info(' ~~~~~~~~~~ ')
  217. CALL prt_ctl(tab2d_1=utau , clinfo1= ' lim_update2 : utau : ', tab2d_2=vtau , clinfo2= ' vtau : ')
  218. CALL prt_ctl(tab2d_1=utau_ice , clinfo1= ' lim_update2 : utau_ice : ', tab2d_2=vtau_ice , clinfo2= ' vtau_ice : ')
  219. CALL prt_ctl(tab2d_1=u_oce , clinfo1= ' lim_update2 : u_oce : ', tab2d_2=v_oce , clinfo2= ' v_oce : ')
  220. ENDIF
  221. IF( nn_timing == 1 ) CALL timing_stop('limupdate2')
  222. END SUBROUTINE lim_update2
  223. #else
  224. !!----------------------------------------------------------------------
  225. !! Default option Empty Module No sea-ice model
  226. !!----------------------------------------------------------------------
  227. CONTAINS
  228. SUBROUTINE lim_update2 ! Empty routine
  229. END SUBROUTINE lim_update2
  230. #endif
  231. END MODULE limupdate2