limmsh_2.F90 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. MODULE limmsh_2
  2. !!======================================================================
  3. !! *** MODULE limmsh_2 ***
  4. !! LIM 2.0 ice model : definition of the ice mesh parameters
  5. !!======================================================================
  6. !! History : - ! 2001-04 (LIM) original code
  7. !! 1.0 ! 2002-08 (C. Ethe, G. Madec) F90, module
  8. !! 3.3 ! 2009-05 (G. Garric, C. Bricaud) addition of the lim2_evp case
  9. !!----------------------------------------------------------------------
  10. #if defined key_lim2
  11. !!----------------------------------------------------------------------
  12. !! 'key_lim2' LIM 2.0sea-ice model
  13. !!----------------------------------------------------------------------
  14. !! lim_msh_2 : definition of the ice mesh
  15. !!----------------------------------------------------------------------
  16. USE phycst
  17. USE dom_oce
  18. USE dom_ice_2
  19. USE lbclnk
  20. USE in_out_manager
  21. USE lib_mpp ! MPP library
  22. #if defined key_lim2_vp
  23. USE wrk_nemo ! work arrays
  24. #endif
  25. USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
  26. IMPLICIT NONE
  27. PRIVATE
  28. PUBLIC lim_msh_2 ! routine called by ice_ini_2.F90
  29. !!----------------------------------------------------------------------
  30. !! NEMO/LIM2 3.3 , UCL - NEMO Consortium (2010)
  31. !! $Id: limmsh_2.F90 3625 2012-11-21 13:19:18Z acc $
  32. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  33. !!----------------------------------------------------------------------
  34. CONTAINS
  35. SUBROUTINE lim_msh_2
  36. !!-------------------------------------------------------------------
  37. !! *** ROUTINE lim_msh_2 ***
  38. !!
  39. !! ** Purpose : Definition of the charact. of the numerical grid
  40. !!
  41. !! ** Action : - Initialisation of some variables
  42. !! - Definition of some constants linked with the grid
  43. !! - Definition of the metric coef. for the sea/ice
  44. !! - Initialization of the ice masks (tmsk, umsk)
  45. !!
  46. !! ** Refer. : Deleersnijder et al. Ocean Modelling 100, 7-10
  47. !!---------------------------------------------------------------------
  48. INTEGER :: ji, jj ! dummy loop indices
  49. REAL(wp) :: zusden ! local scalars
  50. #if defined key_lim2_vp
  51. REAL(wp) :: zusden2 ! local scalars
  52. REAL(wp) :: zh1p , zh2p ! - -
  53. REAL(wp) :: zd2d1p, zd1d2p ! - -
  54. REAL(wp), POINTER, DIMENSION(:,:) :: zd2d1, zd1d2 ! 2D workspace
  55. #endif
  56. !!---------------------------------------------------------------------
  57. #if defined key_lim2_vp
  58. CALL wrk_alloc( jpi, jpj, zd2d1, zd1d2 )
  59. #endif
  60. IF(lwp) THEN
  61. WRITE(numout,*)
  62. WRITE(numout,*) 'lim_msh_2 : LIM 2.0 sea-ice model, mesh initialization'
  63. WRITE(numout,*) '~~~~~~~~~'
  64. ENDIF
  65. IF( jphgr_msh == 2 .OR. jphgr_msh == 3 .OR. jphgr_msh == 5 ) &
  66. & CALL ctl_stop(' Coriolis parameter in LIM not set for f- or beta-plane' )
  67. !----------------------------------------------------------
  68. ! Initialization of local and some global (common) variables
  69. !------------------------------------------------------------------
  70. njeq = INT( jpj / 2 ) !i bug mpp potentiel
  71. njeqm1 = njeq - 1
  72. fcor(:,:) = 2. * omega * SIN( gphit(:,:) * rad ) ! coriolis factor at T-point
  73. !i DO jj = 1, jpj
  74. !i zmsk(jj) = SUM( tmask(:,jj,:) ) ! = 0 if land everywhere on a j-line
  75. !!ii write(numout,*) jj, zind(jj)
  76. !i END DO
  77. IF( fcor(1,1) * fcor(1,nlcj) < 0.e0 ) THEN ! local domain include both hemisphere
  78. l_jeq = .TRUE.
  79. njeq = 1
  80. DO WHILE ( njeq <= jpj .AND. fcor(1,njeq) < 0.e0 )
  81. njeq = njeq + 1
  82. END DO
  83. IF(lwp ) WRITE(numout,*) ' the equator is inside the domain at about njeq = ', njeq
  84. ELSEIF( fcor(1,1) < 0.e0 ) THEN
  85. l_jeq = .FALSE.
  86. njeq = jpj
  87. IF(lwp ) WRITE(numout,*) ' the model domain is entirely in the southern hemisphere: njeq = ', njeq
  88. ELSE
  89. l_jeq = .FALSE.
  90. njeq = 2
  91. IF(lwp ) WRITE(numout,*) ' the model domain is entirely in the northern hemisphere: njeq = ', njeq
  92. ENDIF
  93. njeqm1 = njeq - 1
  94. ! For each grid, definition of geometric tables
  95. !------------------------------------------------------------------
  96. !-------------------
  97. ! Conventions : !
  98. !-------------------
  99. ! indices 1 \ 2 <-> localisation in the 2 direction x \ y
  100. ! 3rd indice <-> localisation on the mesh :
  101. ! 0 = Centre ; 1 = corner W x(i-1/2) ; 2 = corner S y(j-1/2) ;
  102. ! 3 = corner SW x(i-1/2),y(j-1/2)
  103. !-------------------
  104. !!ibug ???
  105. wght(:,:,:,:) = 0.e0
  106. tmu(:,:) = 0.e0
  107. #if defined key_lim2_vp
  108. akappa(:,:,:,:) = 0.e0
  109. alambd(:,:,:,:,:,:) = 0.e0
  110. #else
  111. tmv(:,:) = 0.e0
  112. tmf(:,:) = 0.e0
  113. #endif
  114. !!i
  115. #if defined key_lim2_vp
  116. ! metric coefficients for sea ice dynamic
  117. !----------------------------------------
  118. ! ! akappa
  119. DO jj = 2, jpj
  120. zd1d2(:,jj) = e1v(:,jj) - e1v(:,jj-1)
  121. END DO
  122. CALL lbc_lnk( zd1d2, 'T', -1. )
  123. DO ji = 2, jpi
  124. zd2d1(ji,:) = e2u(ji,:) - e2u(ji-1,:)
  125. END DO
  126. CALL lbc_lnk( zd2d1, 'T', -1. )
  127. akappa(:,:,1,1) = 1.0 / ( 2.0 * e1t(:,:) )
  128. akappa(:,:,1,2) = zd1d2(:,:) / ( 4.0 * e1t(:,:) * e2t(:,:) )
  129. akappa(:,:,2,1) = zd2d1(:,:) / ( 4.0 * e1t(:,:) * e2t(:,:) )
  130. akappa(:,:,2,2) = 1.0 / ( 2.0 * e2t(:,:) )
  131. ! ! weights (wght)
  132. DO jj = 2, jpj
  133. DO ji = 2, jpi
  134. zusden = 1. / ( ( e1t(ji,jj) + e1t(ji-1,jj ) ) &
  135. & * ( e2t(ji,jj) + e2t(ji ,jj-1) ) )
  136. wght(ji,jj,1,1) = zusden * e1t(ji ,jj) * e2t(ji,jj )
  137. wght(ji,jj,1,2) = zusden * e1t(ji ,jj) * e2t(ji,jj-1)
  138. wght(ji,jj,2,1) = zusden * e1t(ji-1,jj) * e2t(ji,jj )
  139. wght(ji,jj,2,2) = zusden * e1t(ji-1,jj) * e2t(ji,jj-1)
  140. END DO
  141. END DO
  142. CALL lbc_lnk( wght(:,:,1,1), 'I', 1. ) ! CAUTION: even with the lbc_lnk at ice U-V-point
  143. CALL lbc_lnk( wght(:,:,1,2), 'I', 1. ) ! the value of wght at jpj is wrong
  144. CALL lbc_lnk( wght(:,:,2,1), 'I', 1. ) ! but it is never used
  145. CALL lbc_lnk( wght(:,:,2,2), 'I', 1. )
  146. #else
  147. ! metric coefficients for sea ice dynamic (EVP rheology)
  148. !----------------------------------------
  149. DO jj = 1, jpjm1 ! weights (wght) at F-points
  150. DO ji = 1, jpim1
  151. zusden = 1. / ( ( e1t(ji+1,jj ) + e1t(ji,jj) ) &
  152. & * ( e2t(ji ,jj+1) + e2t(ji,jj) ) )
  153. wght(ji,jj,1,1) = zusden * e1t(ji+1,jj) * e2t(ji,jj+1)
  154. wght(ji,jj,1,2) = zusden * e1t(ji+1,jj) * e2t(ji,jj )
  155. wght(ji,jj,2,1) = zusden * e1t(ji ,jj) * e2t(ji,jj+1)
  156. wght(ji,jj,2,2) = zusden * e1t(ji ,jj) * e2t(ji,jj )
  157. END DO
  158. END DO
  159. CALL lbc_lnk( wght(:,:,1,1), 'F', 1. ) ; CALL lbc_lnk( wght(:,:,1,2),'F', 1. ) ! lateral boundary cond.
  160. CALL lbc_lnk( wght(:,:,2,1), 'F', 1. ) ; CALL lbc_lnk( wght(:,:,2,2),'F', 1. )
  161. #endif
  162. ! Coefficients for divergence of the stress tensor
  163. !-------------------------------------------------
  164. #if defined key_lim2_vp
  165. DO jj = 2, jpj
  166. DO ji = 2, jpi ! NO vector opt.
  167. zh1p = e1t(ji ,jj ) * wght(ji,jj,2,2) &
  168. & + e1t(ji-1,jj ) * wght(ji,jj,1,2) &
  169. & + e1t(ji ,jj-1) * wght(ji,jj,2,1) &
  170. & + e1t(ji-1,jj-1) * wght(ji,jj,1,1)
  171. zh2p = e2t(ji ,jj ) * wght(ji,jj,2,2) &
  172. & + e2t(ji-1,jj ) * wght(ji,jj,1,2) &
  173. & + e2t(ji ,jj-1) * wght(ji,jj,2,1) &
  174. & + e2t(ji-1,jj-1) * wght(ji,jj,1,1)
  175. ! better written but change the last digit and thus solver in less than 100 timestep
  176. ! zh1p = e1t(ji-1,jj ) * wght(ji,jj,1,2) + e1t(ji,jj ) * wght(ji,jj,2,2) &
  177. ! & + e1t(ji-1,jj-1) * wght(ji,jj,1,1) + e1t(ji,jj-1) * wght(ji,jj,2,1)
  178. ! zh2p = e2t(ji-1,jj ) * wght(ji,jj,1,2) + e2t(ji,jj ) * wght(ji,jj,2,2) &
  179. ! & + e2t(ji-1,jj-1) * wght(ji,jj,1,1) + e2t(ji,jj-1) * wght(ji,jj,2,1)
  180. !!ibug =0 zusden = 1.0 / ( zh1p * zh2p * 4.e0 )
  181. zusden = 1.0 / MAX( zh1p * zh2p * 4.e0 , 1.e-20 )
  182. zusden2 = zusden * 2.0
  183. zd1d2p = zusden * 0.5 * ( -e1t(ji-1,jj-1) + e1t(ji-1,jj ) - e1t(ji,jj-1) + e1t(ji ,jj) )
  184. zd2d1p = zusden * 0.5 * ( e2t(ji ,jj-1) - e2t(ji-1,jj-1) + e2t(ji,jj ) - e2t(ji-1,jj) )
  185. alambd(ji,jj,2,2,2,1) = zusden2 * e2t(ji ,jj-1)
  186. alambd(ji,jj,2,2,2,2) = zusden2 * e2t(ji ,jj )
  187. alambd(ji,jj,2,2,1,1) = zusden2 * e2t(ji-1,jj-1)
  188. alambd(ji,jj,2,2,1,2) = zusden2 * e2t(ji-1,jj )
  189. alambd(ji,jj,1,1,2,1) = zusden2 * e1t(ji ,jj-1)
  190. alambd(ji,jj,1,1,2,2) = zusden2 * e1t(ji ,jj )
  191. alambd(ji,jj,1,1,1,1) = zusden2 * e1t(ji-1,jj-1)
  192. alambd(ji,jj,1,1,1,2) = zusden2 * e1t(ji-1,jj )
  193. alambd(ji,jj,1,2,2,1) = zd1d2p
  194. alambd(ji,jj,1,2,2,2) = zd1d2p
  195. alambd(ji,jj,1,2,1,1) = zd1d2p
  196. alambd(ji,jj,1,2,1,2) = zd1d2p
  197. alambd(ji,jj,2,1,2,1) = zd2d1p
  198. alambd(ji,jj,2,1,2,2) = zd2d1p
  199. alambd(ji,jj,2,1,1,1) = zd2d1p
  200. alambd(ji,jj,2,1,1,2) = zd2d1p
  201. END DO
  202. END DO
  203. CALL lbc_lnk( alambd(:,:,2,2,2,1), 'I', 1. ) ! CAUTION: even with the lbc_lnk at ice U-V point
  204. CALL lbc_lnk( alambd(:,:,2,2,2,2), 'I', 1. ) ! the value of wght at jpj is wrong
  205. CALL lbc_lnk( alambd(:,:,2,2,1,1), 'I', 1. ) ! but it is never used
  206. CALL lbc_lnk( alambd(:,:,2,2,1,2), 'I', 1. ) !
  207. CALL lbc_lnk( alambd(:,:,1,1,2,1), 'I', 1. ) ! CAUTION: idem
  208. CALL lbc_lnk( alambd(:,:,1,1,2,2), 'I', 1. ) !
  209. CALL lbc_lnk( alambd(:,:,1,1,1,1), 'I', 1. ) !
  210. CALL lbc_lnk( alambd(:,:,1,1,1,2), 'I', 1. ) !
  211. CALL lbc_lnk( alambd(:,:,1,2,2,1), 'I', 1. ) ! CAUTION: idem
  212. CALL lbc_lnk( alambd(:,:,1,2,2,2), 'I', 1. ) !
  213. CALL lbc_lnk( alambd(:,:,1,2,1,1), 'I', 1. ) !
  214. CALL lbc_lnk( alambd(:,:,1,2,1,2), 'I', 1. ) !
  215. CALL lbc_lnk( alambd(:,:,2,1,2,1), 'I', 1. ) ! CAUTION: idem
  216. CALL lbc_lnk( alambd(:,:,2,1,2,2), 'I', 1. ) !
  217. CALL lbc_lnk( alambd(:,:,2,1,1,1), 'I', 1. ) !
  218. CALL lbc_lnk( alambd(:,:,2,1,1,2), 'I', 1. ) !
  219. #endif
  220. ! Initialization of ice masks
  221. !----------------------------
  222. tms(:,:) = tmask(:,:,1) ! ice T-point : use surface tmask
  223. #if defined key_lim2_vp
  224. ! VP rheology : ice velocity point is I-point
  225. !i here we can use umask with a i and j shift of -1,-1
  226. tmu(:,1) = 0.e0
  227. tmu(1,:) = 0.e0
  228. DO jj = 2, jpj ! ice U.V-point: computed from ice T-point mask
  229. DO ji = 2, jpim1 ! NO vector opt.
  230. tmu(ji,jj) = tms(ji,jj) * tms(ji-1,jj) * tms(ji,jj-1) * tms(ji-1,jj-1)
  231. END DO
  232. END DO
  233. CALL lbc_lnk( tmu(:,:), 'I', 1. ) !--lateral boundary conditions
  234. #else
  235. ! EVP rheology : ice velocity point are U- & V-points ; ice vorticity
  236. ! point is F-point
  237. tmu(:,:) = umask(:,:,1)
  238. tmv(:,:) = vmask(:,:,1)
  239. tmf(:,:) = 0.e0 ! used of fmask except its special value along the coast (rn_shlat)
  240. WHERE( fmask(:,:,1) == 1.e0 ) tmf(:,:) = 1.e0
  241. #endif
  242. !
  243. ! unmasked and masked area of T-grid cell
  244. area(:,:) = e1t(:,:) * e2t(:,:)
  245. !
  246. #if defined key_lim2_vp
  247. CALL wrk_dealloc( jpi, jpj, zd2d1, zd1d2 )
  248. #endif
  249. !
  250. END SUBROUTINE lim_msh_2
  251. #else
  252. !!----------------------------------------------------------------------
  253. !! Default option Dummy Module NO LIM sea-ice model
  254. !!----------------------------------------------------------------------
  255. CONTAINS
  256. SUBROUTINE lim_msh_2 ! Dummy routine
  257. END SUBROUTINE lim_msh_2
  258. #endif
  259. !!======================================================================
  260. END MODULE limmsh_2