limupdate1.F90 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. MODULE limupdate1
  2. !!======================================================================
  3. !! *** MODULE limupdate1 ***
  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_update1 : 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 wrk_nemo ! work arrays
  26. USE timing ! Timing
  27. USE limcons ! conservation tests
  28. USE lib_mpp ! MPP library
  29. USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
  30. USE in_out_manager ! I/O manager
  31. IMPLICIT NONE
  32. PRIVATE
  33. PUBLIC lim_update1
  34. !! * Substitutions
  35. # include "vectopt_loop_substitute.h90"
  36. !!----------------------------------------------------------------------
  37. !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
  38. !! $Id: limupdate1.F90 4578 2017-09-25 09:34:12Z ufla $
  39. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  40. !!----------------------------------------------------------------------
  41. CONTAINS
  42. SUBROUTINE lim_update1( kt )
  43. !!-------------------------------------------------------------------
  44. !! *** ROUTINE lim_update1 ***
  45. !!
  46. !! ** Purpose : Computes update of sea-ice global variables at
  47. !! the end of the dynamics.
  48. !!
  49. !!---------------------------------------------------------------------
  50. INTEGER, INTENT(in) :: kt ! number of iteration
  51. INTEGER :: ji, jj, jk, jl ! dummy loop indices
  52. REAL(wp) :: zsal
  53. REAL(wp) :: zvi_b, zsmv_b, zei_b, zfs_b, zfw_b, zft_b
  54. !!-------------------------------------------------------------------
  55. IF( nn_timing == 1 ) CALL timing_start('limupdate1')
  56. IF( ln_limdyn ) THEN
  57. IF( kt == nit000 .AND. lwp ) THEN
  58. WRITE(numout,*)''
  59. WRITE(numout,*)' lim_update1 '
  60. WRITE(numout,*)' ~~~~~~~~~~~ '
  61. ENDIF
  62. ! conservation test
  63. IF( ln_limdiahsb ) CALL lim_cons_hsm(0, 'limupdate1', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
  64. !----------------------------------------------------
  65. ! ice concentration should not exceed amax
  66. !-----------------------------------------------------
  67. at_i(:,:) = 0._wp
  68. DO jl = 1, jpl
  69. at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
  70. END DO
  71. DO jl = 1, jpl
  72. DO jj = 1, jpj
  73. DO ji = 1, jpi
  74. IF( at_i(ji,jj) > rn_amax_2d(ji,jj) .AND. a_i(ji,jj,jl) > 0._wp ) THEN
  75. a_i (ji,jj,jl) = a_i (ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax_2d(ji,jj) / at_i(ji,jj) ) )
  76. oa_i(ji,jj,jl) = oa_i(ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax_2d(ji,jj) / at_i(ji,jj) ) )
  77. ENDIF
  78. END DO
  79. END DO
  80. END DO
  81. !---------------------
  82. ! Ice salinity bounds
  83. !---------------------
  84. IF ( nn_icesal == 2 ) THEN
  85. DO jl = 1, jpl
  86. DO jj = 1, jpj
  87. DO ji = 1, jpi
  88. zsal = smv_i(ji,jj,jl)
  89. ! salinity stays in bounds
  90. rswitch = 1._wp - MAX( 0._wp, SIGN( 1._wp, - v_i(ji,jj,jl) ) )
  91. 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) )
  92. ! associated salt flux
  93. sfx_res(ji,jj) = sfx_res(ji,jj) - ( smv_i(ji,jj,jl) - zsal ) * rhoic * r1_rdtice
  94. END DO
  95. END DO
  96. END DO
  97. ENDIF
  98. !----------------------------------------------------
  99. ! Rebin categories with thickness out of bounds
  100. !----------------------------------------------------
  101. IF ( jpl > 1 ) CALL lim_itd_th_reb(1, jpl)
  102. !-----------------
  103. ! zap small values
  104. !-----------------
  105. CALL lim_var_zapsmall
  106. ! -------------------------------------------------
  107. ! Diagnostics
  108. ! -------------------------------------------------
  109. DO jl = 1, jpl
  110. afx_dyn(:,:) = afx_dyn(:,:) + ( a_i(:,:,jl) - a_i_b(:,:,jl) ) * r1_rdtice
  111. END DO
  112. DO jj = 1, jpj
  113. DO ji = 1, jpi
  114. ! heat content variation (W.m-2)
  115. diag_heat(ji,jj) = - ( SUM( e_i(ji,jj,1:nlay_i,:) - e_i_b(ji,jj,1:nlay_i,:) ) + &
  116. & SUM( e_s(ji,jj,1:nlay_s,:) - e_s_b(ji,jj,1:nlay_s,:) ) &
  117. & ) * r1_rdtice
  118. ! salt, volume
  119. diag_smvi(ji,jj) = SUM( smv_i(ji,jj,:) - smv_i_b(ji,jj,:) ) * rhoic * r1_rdtice
  120. diag_vice(ji,jj) = SUM( v_i (ji,jj,:) - v_i_b (ji,jj,:) ) * rhoic * r1_rdtice
  121. diag_vsnw(ji,jj) = SUM( v_s (ji,jj,:) - v_s_b (ji,jj,:) ) * rhosn * r1_rdtice
  122. END DO
  123. END DO
  124. ! conservation test
  125. IF( ln_limdiahsb ) CALL lim_cons_hsm(1, 'limupdate1', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
  126. ! -------------------------------------------------
  127. ! control prints
  128. ! -------------------------------------------------
  129. IF(ln_ctl) THEN ! Control print
  130. CALL prt_ctl_info(' ')
  131. CALL prt_ctl_info(' - Cell values : ')
  132. CALL prt_ctl_info(' ~~~~~~~~~~~~~ ')
  133. CALL prt_ctl(tab2d_1=e12t , clinfo1=' lim_update1 : cell area :')
  134. CALL prt_ctl(tab2d_1=at_i , clinfo1=' lim_update1 : at_i :')
  135. CALL prt_ctl(tab2d_1=vt_i , clinfo1=' lim_update1 : vt_i :')
  136. CALL prt_ctl(tab2d_1=vt_s , clinfo1=' lim_update1 : vt_s :')
  137. CALL prt_ctl(tab2d_1=strength , clinfo1=' lim_update1 : strength :')
  138. CALL prt_ctl(tab2d_1=u_ice , clinfo1=' lim_update1 : u_ice :', tab2d_2=v_ice , clinfo2=' v_ice :')
  139. CALL prt_ctl(tab2d_1=u_ice_b , clinfo1=' lim_update1 : u_ice_b :', tab2d_2=v_ice_b , clinfo2=' v_ice_b :')
  140. DO jl = 1, jpl
  141. CALL prt_ctl_info(' ')
  142. CALL prt_ctl_info(' - Category : ', ivar1=jl)
  143. CALL prt_ctl_info(' ~~~~~~~~~~')
  144. CALL prt_ctl(tab2d_1=ht_i (:,:,jl) , clinfo1= ' lim_update1 : ht_i : ')
  145. CALL prt_ctl(tab2d_1=ht_s (:,:,jl) , clinfo1= ' lim_update1 : ht_s : ')
  146. CALL prt_ctl(tab2d_1=t_su (:,:,jl) , clinfo1= ' lim_update1 : t_su : ')
  147. CALL prt_ctl(tab2d_1=t_s (:,:,1,jl) , clinfo1= ' lim_update1 : t_snow : ')
  148. CALL prt_ctl(tab2d_1=sm_i (:,:,jl) , clinfo1= ' lim_update1 : sm_i : ')
  149. CALL prt_ctl(tab2d_1=o_i (:,:,jl) , clinfo1= ' lim_update1 : o_i : ')
  150. CALL prt_ctl(tab2d_1=a_i (:,:,jl) , clinfo1= ' lim_update1 : a_i : ')
  151. CALL prt_ctl(tab2d_1=a_i_b (:,:,jl) , clinfo1= ' lim_update1 : a_i_b : ')
  152. CALL prt_ctl(tab2d_1=v_i (:,:,jl) , clinfo1= ' lim_update1 : v_i : ')
  153. CALL prt_ctl(tab2d_1=v_i_b (:,:,jl) , clinfo1= ' lim_update1 : v_i_b : ')
  154. CALL prt_ctl(tab2d_1=v_s (:,:,jl) , clinfo1= ' lim_update1 : v_s : ')
  155. CALL prt_ctl(tab2d_1=v_s_b (:,:,jl) , clinfo1= ' lim_update1 : v_s_b : ')
  156. CALL prt_ctl(tab2d_1=e_i (:,:,1,jl) , clinfo1= ' lim_update1 : e_i1 : ')
  157. CALL prt_ctl(tab2d_1=e_i_b (:,:,1,jl) , clinfo1= ' lim_update1 : e_i1_b : ')
  158. CALL prt_ctl(tab2d_1=e_i (:,:,2,jl) , clinfo1= ' lim_update1 : e_i2 : ')
  159. CALL prt_ctl(tab2d_1=e_i_b (:,:,2,jl) , clinfo1= ' lim_update1 : e_i2_b : ')
  160. CALL prt_ctl(tab2d_1=e_s (:,:,1,jl) , clinfo1= ' lim_update1 : e_snow : ')
  161. CALL prt_ctl(tab2d_1=e_s_b (:,:,1,jl) , clinfo1= ' lim_update1 : e_snow_b : ')
  162. CALL prt_ctl(tab2d_1=smv_i (:,:,jl) , clinfo1= ' lim_update1 : smv_i : ')
  163. CALL prt_ctl(tab2d_1=smv_i_b (:,:,jl) , clinfo1= ' lim_update1 : smv_i_b : ')
  164. CALL prt_ctl(tab2d_1=oa_i (:,:,jl) , clinfo1= ' lim_update1 : oa_i : ')
  165. CALL prt_ctl(tab2d_1=oa_i_b (:,:,jl) , clinfo1= ' lim_update1 : oa_i_b : ')
  166. DO jk = 1, nlay_i
  167. CALL prt_ctl_info(' - Layer : ', ivar1=jk)
  168. CALL prt_ctl(tab2d_1=t_i(:,:,jk,jl) , clinfo1= ' lim_update1 : t_i : ')
  169. END DO
  170. END DO
  171. CALL prt_ctl_info(' ')
  172. CALL prt_ctl_info(' - Heat / FW fluxes : ')
  173. CALL prt_ctl_info(' ~~~~~~~~~~~~~~~~~~ ')
  174. CALL prt_ctl(tab2d_1=sst_m , clinfo1= ' lim_update1 : sst : ', tab2d_2=sss_m , clinfo2= ' sss : ')
  175. CALL prt_ctl_info(' ')
  176. CALL prt_ctl_info(' - Stresses : ')
  177. CALL prt_ctl_info(' ~~~~~~~~~~ ')
  178. CALL prt_ctl(tab2d_1=utau , clinfo1= ' lim_update1 : utau : ', tab2d_2=vtau , clinfo2= ' vtau : ')
  179. CALL prt_ctl(tab2d_1=utau_ice , clinfo1= ' lim_update1 : utau_ice : ', tab2d_2=vtau_ice , clinfo2= ' vtau_ice : ')
  180. CALL prt_ctl(tab2d_1=u_oce , clinfo1= ' lim_update1 : u_oce : ', tab2d_2=v_oce , clinfo2= ' v_oce : ')
  181. ENDIF
  182. ENDIF ! ln_limdyn
  183. IF( nn_timing == 1 ) CALL timing_stop('limupdate1')
  184. END SUBROUTINE lim_update1
  185. #else
  186. !!----------------------------------------------------------------------
  187. !! Default option Empty Module No sea-ice model
  188. !!----------------------------------------------------------------------
  189. CONTAINS
  190. SUBROUTINE lim_update1 ! Empty routine
  191. END SUBROUTINE lim_update1
  192. #endif
  193. END MODULE limupdate1