limthd_lac.F90 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. MODULE limthd_lac
  2. !!======================================================================
  3. !! *** MODULE limthd_lac ***
  4. !! lateral thermodynamic growth of the ice
  5. !!======================================================================
  6. !! History : LIM ! 2005-12 (M. Vancoppenolle) Original code
  7. !! - ! 2006-01 (M. Vancoppenolle) add ITD
  8. !! 3.0 ! 2007-07 (M. Vancoppenolle) Mass and energy conservation tested
  9. !! 4.0 ! 2011-02 (G. Madec) dynamical allocation
  10. !!----------------------------------------------------------------------
  11. #if defined key_lim3
  12. !!----------------------------------------------------------------------
  13. !! 'key_lim3' LIM3 sea-ice model
  14. !!----------------------------------------------------------------------
  15. !! lim_lat_acr : lateral accretion of ice
  16. !!----------------------------------------------------------------------
  17. USE par_oce ! ocean parameters
  18. USE dom_oce ! domain variables
  19. USE phycst ! physical constants
  20. USE sbc_oce ! Surface boundary condition: ocean fields
  21. USE sbc_ice ! Surface boundary condition: ice fields
  22. USE thd_ice ! LIM thermodynamics
  23. USE dom_ice ! LIM domain
  24. USE ice ! LIM variables
  25. USE limtab ! LIM 2D <==> 1D
  26. USE limcons ! LIM conservation
  27. USE in_out_manager ! I/O manager
  28. USE lib_mpp ! MPP library
  29. USE wrk_nemo ! work arrays
  30. USE lbclnk ! ocean lateral boundary conditions (or mpp link)
  31. USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
  32. USE limthd_ent
  33. USE limvar
  34. IMPLICIT NONE
  35. PRIVATE
  36. PUBLIC lim_thd_lac ! called by lim_thd
  37. !!----------------------------------------------------------------------
  38. !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
  39. !! $Id: limthd_lac.F90 4990 2014-12-15 16:42:49Z timgraham $
  40. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  41. !!----------------------------------------------------------------------
  42. CONTAINS
  43. SUBROUTINE lim_thd_lac
  44. !!-------------------------------------------------------------------
  45. !! *** ROUTINE lim_thd_lac ***
  46. !!
  47. !! ** Purpose : Computation of the evolution of the ice thickness and
  48. !! concentration as a function of the heat balance in the leads.
  49. !! It is only used for lateral accretion
  50. !!
  51. !! ** Method : Ice is formed in the open water when ocean lose heat
  52. !! (heat budget of open water Bl is negative) .
  53. !! Computation of the increase of 1-A (ice concentration) fol-
  54. !! lowing the law :
  55. !! (dA/dt)acc = F[ (1-A)/(1-a) ] * [ Bl / (Li*h0) ]
  56. !! where - h0 is the thickness of ice created in the lead
  57. !! - a is a minimum fraction for leads
  58. !! - F is a monotonic non-increasing function defined as:
  59. !! F(X)=( 1 - X**exld )**(1.0/exld)
  60. !! - exld is the exponent closure rate (=2 default val.)
  61. !!
  62. !! ** Action : - Adjustment of snow and ice thicknesses and heat
  63. !! content in brine pockets
  64. !! - Updating ice internal temperature
  65. !! - Computation of variation of ice volume and mass
  66. !! - Computation of frldb after lateral accretion and
  67. !! update ht_s_1d, ht_i_1d and tbif_1d(:,:)
  68. !!------------------------------------------------------------------------
  69. INTEGER :: ji,jj,jk,jl ! dummy loop indices
  70. INTEGER :: nbpac ! local integers
  71. INTEGER :: ii, ij, iter ! - -
  72. REAL(wp) :: ztmelts, zdv, zfrazb, zweight, zde ! local scalars
  73. REAL(wp) :: zgamafr, zvfrx, zvgx, ztaux, ztwogp, zf ! - -
  74. REAL(wp) :: ztenagm, zvfry, zvgy, ztauy, zvrel2, zfp, zsqcd , zhicrit ! - -
  75. CHARACTER (len = 15) :: fieldid
  76. REAL(wp) :: zQm ! enthalpy exchanged with the ocean (J/m2, >0 towards ocean)
  77. REAL(wp) :: zEi ! sea ice specific enthalpy (J/kg)
  78. REAL(wp) :: zEw ! seawater specific enthalpy (J/kg)
  79. REAL(wp) :: zfmdt ! mass flux x time step (kg/m2, >0 towards ocean)
  80. REAL(wp) :: zv_newfra
  81. INTEGER , POINTER, DIMENSION(:) :: jcat ! indexes of categories where new ice grows
  82. REAL(wp), POINTER, DIMENSION(:) :: zswinew ! switch for new ice or not
  83. REAL(wp), POINTER, DIMENSION(:) :: zv_newice ! volume of accreted ice
  84. REAL(wp), POINTER, DIMENSION(:) :: za_newice ! fractional area of accreted ice
  85. REAL(wp), POINTER, DIMENSION(:) :: zh_newice ! thickness of accreted ice
  86. REAL(wp), POINTER, DIMENSION(:) :: ze_newice ! heat content of accreted ice
  87. REAL(wp), POINTER, DIMENSION(:) :: zs_newice ! salinity of accreted ice
  88. REAL(wp), POINTER, DIMENSION(:) :: zo_newice ! age of accreted ice
  89. REAL(wp), POINTER, DIMENSION(:) :: zdv_res ! residual volume in case of excessive heat budget
  90. REAL(wp), POINTER, DIMENSION(:) :: zda_res ! residual area in case of excessive heat budget
  91. REAL(wp), POINTER, DIMENSION(:) :: zat_i_1d ! total ice fraction
  92. REAL(wp), POINTER, DIMENSION(:) :: zv_frazb ! accretion of frazil ice at the ice bottom
  93. REAL(wp), POINTER, DIMENSION(:) :: zvrel_1d ! relative ice / frazil velocity (1D vector)
  94. REAL(wp), POINTER, DIMENSION(:,:) :: zv_b ! old volume of ice in category jl
  95. REAL(wp), POINTER, DIMENSION(:,:) :: za_b ! old area of ice in category jl
  96. REAL(wp), POINTER, DIMENSION(:,:) :: za_i_1d ! 1-D version of a_i
  97. REAL(wp), POINTER, DIMENSION(:,:) :: zv_i_1d ! 1-D version of v_i
  98. REAL(wp), POINTER, DIMENSION(:,:) :: zsmv_i_1d ! 1-D version of smv_i
  99. REAL(wp), POINTER, DIMENSION(:,:,:) :: ze_i_1d !: 1-D version of e_i
  100. REAL(wp), POINTER, DIMENSION(:,:) :: zvrel ! relative ice / frazil velocity
  101. REAL(wp) :: zcai = 1.4e-3_wp ! ice-air drag (clem: should be dependent on coupling/forcing used)
  102. !!-----------------------------------------------------------------------!
  103. CALL wrk_alloc( jpij, jcat ) ! integer
  104. CALL wrk_alloc( jpij, zswinew, zv_newice, za_newice, zh_newice, ze_newice, zs_newice, zo_newice )
  105. CALL wrk_alloc( jpij, zdv_res, zda_res, zat_i_1d, zv_frazb, zvrel_1d )
  106. CALL wrk_alloc( jpij,jpl, zv_b, za_b, za_i_1d, zv_i_1d, zsmv_i_1d )
  107. CALL wrk_alloc( jpij,nlay_i,jpl, ze_i_1d )
  108. CALL wrk_alloc( jpi,jpj, zvrel )
  109. CALL lim_var_agg(1)
  110. CALL lim_var_glo2eqv
  111. !------------------------------------------------------------------------------|
  112. ! 2) Convert units for ice internal energy
  113. !------------------------------------------------------------------------------|
  114. DO jl = 1, jpl
  115. DO jk = 1, nlay_i
  116. DO jj = 1, jpj
  117. DO ji = 1, jpi
  118. !Energy of melting q(S,T) [J.m-3]
  119. rswitch = MAX( 0._wp , SIGN( 1._wp , v_i(ji,jj,jl) - epsi20 ) ) !0 if no ice
  120. e_i(ji,jj,jk,jl) = rswitch * e_i(ji,jj,jk,jl) / MAX( v_i(ji,jj,jl), epsi20 ) * REAL( nlay_i, wp )
  121. END DO
  122. END DO
  123. END DO
  124. END DO
  125. !------------------------------------------------------------------------------!
  126. ! 3) Collection thickness of ice formed in leads and polynyas
  127. !------------------------------------------------------------------------------!
  128. ! hicol is the thickness of new ice formed in open water
  129. ! hicol can be either prescribed (frazswi = 0) or computed (frazswi = 1)
  130. ! Frazil ice forms in open water, is transported by wind
  131. ! accumulates at the edge of the consolidated ice edge
  132. ! where it forms aggregates of a specific thickness called
  133. ! collection thickness.
  134. ! Note : the following algorithm currently breaks vectorization
  135. !
  136. zvrel(:,:) = 0._wp
  137. ! Default new ice thickness
  138. WHERE( qlead(:,:) < 0._wp ) ; hicol = rn_hnewice
  139. ELSEWHERE ; hicol = 0._wp
  140. END WHERE
  141. IF( ln_frazil ) THEN
  142. !--------------------
  143. ! Physical constants
  144. !--------------------
  145. hicol(:,:) = 0._wp
  146. zhicrit = 0.04 ! frazil ice thickness
  147. ztwogp = 2. * rau0 / ( grav * 0.3 * ( rau0 - rhoic ) ) ! reduced grav
  148. zsqcd = 1.0 / SQRT( 1.3 * zcai ) ! 1/SQRT(airdensity*drag)
  149. zgamafr = 0.03
  150. DO jj = 2, jpj
  151. DO ji = 2, jpi
  152. IF ( qlead(ji,jj) < 0._wp ) THEN
  153. !-------------
  154. ! Wind stress
  155. !-------------
  156. ! C-grid wind stress components
  157. ztaux = ( utau_ice(ji-1,jj ) * umask(ji-1,jj ,1) &
  158. & + utau_ice(ji ,jj ) * umask(ji ,jj ,1) ) * 0.5_wp
  159. ztauy = ( vtau_ice(ji ,jj-1) * vmask(ji ,jj-1,1) &
  160. & + vtau_ice(ji ,jj ) * vmask(ji ,jj ,1) ) * 0.5_wp
  161. ! Square root of wind stress
  162. ztenagm = SQRT( SQRT( ztaux * ztaux + ztauy * ztauy ) )
  163. !---------------------
  164. ! Frazil ice velocity
  165. !---------------------
  166. rswitch = MAX( 0._wp, SIGN( 1._wp , ztenagm - epsi10 ) )
  167. zvfrx = rswitch * zgamafr * zsqcd * ztaux / MAX( ztenagm, epsi10 )
  168. zvfry = rswitch * zgamafr * zsqcd * ztauy / MAX( ztenagm, epsi10 )
  169. !-------------------
  170. ! Pack ice velocity
  171. !-------------------
  172. ! C-grid ice velocity
  173. rswitch = MAX( 0._wp, SIGN( 1._wp , at_i(ji,jj) ) )
  174. zvgx = rswitch * ( u_ice(ji-1,jj ) * umask(ji-1,jj ,1) + u_ice(ji,jj) * umask(ji,jj,1) ) * 0.5_wp
  175. zvgy = rswitch * ( v_ice(ji ,jj-1) * vmask(ji ,jj-1,1) + v_ice(ji,jj) * vmask(ji,jj,1) ) * 0.5_wp
  176. !-----------------------------------
  177. ! Relative frazil/pack ice velocity
  178. !-----------------------------------
  179. ! absolute relative velocity
  180. zvrel2 = MAX( ( zvfrx - zvgx ) * ( zvfrx - zvgx ) &
  181. & + ( zvfry - zvgy ) * ( zvfry - zvgy ) , 0.15 * 0.15 )
  182. zvrel(ji,jj) = SQRT( zvrel2 )
  183. !---------------------
  184. ! Iterative procedure
  185. !---------------------
  186. hicol(ji,jj) = zhicrit + ( zhicrit + 0.1 ) &
  187. & / ( ( zhicrit + 0.1 ) * ( zhicrit + 0.1 ) - zhicrit * zhicrit ) * ztwogp * zvrel2
  188. iter = 1
  189. DO WHILE ( iter < 20 )
  190. zf = ( hicol(ji,jj) - zhicrit ) * ( hicol(ji,jj) * hicol(ji,jj) - zhicrit * zhicrit ) - &
  191. & hicol(ji,jj) * zhicrit * ztwogp * zvrel2
  192. zfp = ( hicol(ji,jj) - zhicrit ) * ( 3.0 * hicol(ji,jj) + zhicrit ) - zhicrit * ztwogp * zvrel2
  193. hicol(ji,jj) = hicol(ji,jj) - zf/zfp
  194. iter = iter + 1
  195. END DO
  196. ENDIF ! end of selection of pixels where ice forms
  197. END DO
  198. END DO
  199. !
  200. CALL lbc_lnk( zvrel(:,:), 'T', 1. )
  201. CALL lbc_lnk( hicol(:,:), 'T', 1. )
  202. ENDIF ! End of computation of frazil ice collection thickness
  203. !------------------------------------------------------------------------------!
  204. ! 4) Identify grid points where new ice forms
  205. !------------------------------------------------------------------------------!
  206. !-------------------------------------
  207. ! Select points for new ice formation
  208. !-------------------------------------
  209. ! This occurs if open water energy budget is negative
  210. nbpac = 0
  211. npac(:) = 0
  212. !
  213. DO jj = 1, jpj
  214. DO ji = 1, jpi
  215. IF ( qlead(ji,jj) < 0._wp ) THEN
  216. nbpac = nbpac + 1
  217. npac( nbpac ) = (jj - 1) * jpi + ji
  218. ENDIF
  219. END DO
  220. END DO
  221. ! debug point to follow
  222. jiindex_1d = 0
  223. IF( ln_icectl ) THEN
  224. DO ji = mi0(iiceprt), mi1(iiceprt)
  225. DO jj = mj0(jiceprt), mj1(jiceprt)
  226. IF ( qlead(ji,jj) < 0._wp ) THEN
  227. jiindex_1d = (jj - 1) * jpi + ji
  228. ENDIF
  229. END DO
  230. END DO
  231. ENDIF
  232. IF( ln_icectl ) WRITE(numout,*) 'lim_thd_lac : nbpac = ', nbpac
  233. !------------------------------
  234. ! Move from 2-D to 1-D vectors
  235. !------------------------------
  236. ! If ocean gains heat do nothing. Otherwise compute new ice formation
  237. IF ( nbpac > 0 ) THEN
  238. CALL tab_2d_1d( nbpac, zat_i_1d (1:nbpac) , at_i , jpi, jpj, npac(1:nbpac) )
  239. DO jl = 1, jpl
  240. CALL tab_2d_1d( nbpac, za_i_1d (1:nbpac,jl), a_i (:,:,jl), jpi, jpj, npac(1:nbpac) )
  241. CALL tab_2d_1d( nbpac, zv_i_1d (1:nbpac,jl), v_i (:,:,jl), jpi, jpj, npac(1:nbpac) )
  242. CALL tab_2d_1d( nbpac, zsmv_i_1d(1:nbpac,jl), smv_i(:,:,jl), jpi, jpj, npac(1:nbpac) )
  243. DO jk = 1, nlay_i
  244. CALL tab_2d_1d( nbpac, ze_i_1d(1:nbpac,jk,jl), e_i(:,:,jk,jl) , jpi, jpj, npac(1:nbpac) )
  245. END DO
  246. END DO
  247. CALL tab_2d_1d( nbpac, qlead_1d (1:nbpac) , qlead , jpi, jpj, npac(1:nbpac) )
  248. CALL tab_2d_1d( nbpac, t_bo_1d (1:nbpac) , t_bo , jpi, jpj, npac(1:nbpac) )
  249. CALL tab_2d_1d( nbpac, sfx_opw_1d(1:nbpac) , sfx_opw , jpi, jpj, npac(1:nbpac) )
  250. CALL tab_2d_1d( nbpac, wfx_opw_1d(1:nbpac) , wfx_opw , jpi, jpj, npac(1:nbpac) )
  251. CALL tab_2d_1d( nbpac, hicol_1d (1:nbpac) , hicol , jpi, jpj, npac(1:nbpac) )
  252. CALL tab_2d_1d( nbpac, zvrel_1d (1:nbpac) , zvrel , jpi, jpj, npac(1:nbpac) )
  253. CALL tab_2d_1d( nbpac, hfx_thd_1d(1:nbpac) , hfx_thd , jpi, jpj, npac(1:nbpac) )
  254. CALL tab_2d_1d( nbpac, hfx_opw_1d(1:nbpac) , hfx_opw , jpi, jpj, npac(1:nbpac) )
  255. CALL tab_2d_1d( nbpac, rn_amax_1d(1:nbpac) , rn_amax_2d, jpi, jpj, npac(1:nbpac) )
  256. !------------------------------------------------------------------------------!
  257. ! 5) Compute thickness, salinity, enthalpy, age, area and volume of new ice
  258. !------------------------------------------------------------------------------!
  259. !-----------------------------------------
  260. ! Keep old ice areas and volume in memory
  261. !-----------------------------------------
  262. zv_b(1:nbpac,:) = zv_i_1d(1:nbpac,:)
  263. za_b(1:nbpac,:) = za_i_1d(1:nbpac,:)
  264. !----------------------
  265. ! Thickness of new ice
  266. !----------------------
  267. zh_newice(1:nbpac) = hicol_1d(1:nbpac)
  268. !----------------------
  269. ! Salinity of new ice
  270. !----------------------
  271. SELECT CASE ( nn_icesal )
  272. CASE ( 1 ) ! Sice = constant
  273. zs_newice(1:nbpac) = rn_icesal
  274. CASE ( 2 ) ! Sice = F(z,t) [Vancoppenolle et al (2005)]
  275. DO ji = 1, nbpac
  276. ii = MOD( npac(ji) - 1 , jpi ) + 1
  277. ij = ( npac(ji) - 1 ) / jpi + 1
  278. zs_newice(ji) = MIN( 4.606 + 0.91 / zh_newice(ji) , rn_simax , 0.5 * sss_m(ii,ij) )
  279. END DO
  280. CASE ( 3 ) ! Sice = F(z) [multiyear ice]
  281. zs_newice(1:nbpac) = 2.3
  282. END SELECT
  283. !-------------------------
  284. ! Heat content of new ice
  285. !-------------------------
  286. ! We assume that new ice is formed at the seawater freezing point
  287. DO ji = 1, nbpac
  288. ztmelts = - tmut * zs_newice(ji) + rt0 ! Melting point (K)
  289. ze_newice(ji) = rhoic * ( cpic * ( ztmelts - t_bo_1d(ji) ) &
  290. & + lfus * ( 1.0 - ( ztmelts - rt0 ) / MIN( t_bo_1d(ji) - rt0, -epsi10 ) ) &
  291. & - rcp * ( ztmelts - rt0 ) )
  292. END DO
  293. !----------------
  294. ! Age of new ice
  295. !----------------
  296. DO ji = 1, nbpac
  297. zo_newice(ji) = 0._wp
  298. END DO
  299. !-------------------
  300. ! Volume of new ice
  301. !-------------------
  302. DO ji = 1, nbpac
  303. zEi = - ze_newice(ji) * r1_rhoic ! specific enthalpy of forming ice [J/kg]
  304. zEw = rcp * ( t_bo_1d(ji) - rt0 ) ! specific enthalpy of seawater at t_bo_1d [J/kg]
  305. ! clem: we suppose we are already at the freezing point (condition qlead<0 is satisfyied)
  306. zdE = zEi - zEw ! specific enthalpy difference [J/kg]
  307. zfmdt = - qlead_1d(ji) / zdE ! Fm.dt [kg/m2] (<0)
  308. ! clem: we use qlead instead of zqld (limthd) because we suppose we are at the freezing point
  309. zv_newice(ji) = - zfmdt * r1_rhoic
  310. zQm = zfmdt * zEw ! heat to the ocean >0 associated with mass flux
  311. ! Contribution to heat flux to the ocean [W.m-2], >0
  312. hfx_thd_1d(ji) = hfx_thd_1d(ji) + zfmdt * zEw * r1_rdtice
  313. ! Total heat flux used in this process [W.m-2]
  314. hfx_opw_1d(ji) = hfx_opw_1d(ji) - zfmdt * zdE * r1_rdtice
  315. ! mass flux
  316. wfx_opw_1d(ji) = wfx_opw_1d(ji) - zv_newice(ji) * rhoic * r1_rdtice
  317. ! salt flux
  318. sfx_opw_1d(ji) = sfx_opw_1d(ji) - zv_newice(ji) * rhoic * zs_newice(ji) * r1_rdtice
  319. END DO
  320. zv_frazb(:) = 0._wp
  321. IF( ln_frazil ) THEN
  322. ! A fraction zfrazb of frazil ice is accreted at the ice bottom
  323. DO ji = 1, nbpac
  324. rswitch = 1._wp - MAX( 0._wp, SIGN( 1._wp , - zat_i_1d(ji) ) )
  325. zfrazb = rswitch * ( TANH( rn_Cfrazb * ( zvrel_1d(ji) - rn_vfrazb ) ) + 1.0 ) * 0.5 * rn_maxfrazb
  326. zv_frazb(ji) = zfrazb * zv_newice(ji)
  327. zv_newice(ji) = ( 1.0 - zfrazb ) * zv_newice(ji)
  328. END DO
  329. END IF
  330. !-----------------
  331. ! Area of new ice
  332. !-----------------
  333. DO ji = 1, nbpac
  334. za_newice(ji) = zv_newice(ji) / zh_newice(ji)
  335. END DO
  336. !------------------------------------------------------------------------------!
  337. ! 6) Redistribute new ice area and volume into ice categories !
  338. !------------------------------------------------------------------------------!
  339. !------------------------
  340. ! 6.1) lateral ice growth
  341. !------------------------
  342. ! If lateral ice growth gives an ice concentration gt 1, then
  343. ! we keep the excessive volume in memory and attribute it later to bottom accretion
  344. DO ji = 1, nbpac
  345. IF ( za_newice(ji) > ( rn_amax_1d(ji) - zat_i_1d(ji) ) ) THEN
  346. zda_res(ji) = za_newice(ji) - ( rn_amax_1d(ji) - zat_i_1d(ji) )
  347. zdv_res(ji) = zda_res (ji) * zh_newice(ji)
  348. za_newice(ji) = za_newice(ji) - zda_res (ji)
  349. zv_newice(ji) = zv_newice(ji) - zdv_res (ji)
  350. ELSE
  351. zda_res(ji) = 0._wp
  352. zdv_res(ji) = 0._wp
  353. ENDIF
  354. END DO
  355. ! find which category to fill
  356. zat_i_1d(:) = 0._wp
  357. DO jl = 1, jpl
  358. DO ji = 1, nbpac
  359. IF( zh_newice(ji) > hi_max(jl-1) .AND. zh_newice(ji) <= hi_max(jl) ) THEN
  360. za_i_1d (ji,jl) = za_i_1d (ji,jl) + za_newice(ji)
  361. zv_i_1d (ji,jl) = zv_i_1d (ji,jl) + zv_newice(ji)
  362. jcat (ji) = jl
  363. ENDIF
  364. zat_i_1d(ji) = zat_i_1d(ji) + za_i_1d (ji,jl)
  365. END DO
  366. END DO
  367. ! Heat content
  368. DO ji = 1, nbpac
  369. jl = jcat(ji) ! categroy in which new ice is put
  370. zswinew (ji) = MAX( 0._wp , SIGN( 1._wp , - za_b(ji,jl) ) ) ! 0 if old ice
  371. END DO
  372. DO jk = 1, nlay_i
  373. DO ji = 1, nbpac
  374. jl = jcat(ji)
  375. rswitch = MAX( 0._wp, SIGN( 1._wp , zv_i_1d(ji,jl) - epsi20 ) )
  376. ze_i_1d(ji,jk,jl) = zswinew(ji) * ze_newice(ji) + &
  377. & ( 1.0 - zswinew(ji) ) * ( ze_newice(ji) * zv_newice(ji) + ze_i_1d(ji,jk,jl) * zv_b(ji,jl) ) &
  378. & * rswitch / MAX( zv_i_1d(ji,jl), epsi20 )
  379. END DO
  380. END DO
  381. !------------------------------------------------
  382. ! 6.2) bottom ice growth + ice enthalpy remapping
  383. !------------------------------------------------
  384. DO jl = 1, jpl
  385. ! for remapping
  386. h_i_old (1:nbpac,0:nlay_i+1) = 0._wp
  387. qh_i_old(1:nbpac,0:nlay_i+1) = 0._wp
  388. DO jk = 1, nlay_i
  389. DO ji = 1, nbpac
  390. h_i_old (ji,jk) = zv_i_1d(ji,jl) * r1_nlay_i
  391. qh_i_old(ji,jk) = ze_i_1d(ji,jk,jl) * h_i_old(ji,jk)
  392. END DO
  393. END DO
  394. ! new volumes including lateral/bottom accretion + residual
  395. DO ji = 1, nbpac
  396. rswitch = MAX( 0._wp, SIGN( 1._wp , zat_i_1d(ji) - epsi20 ) )
  397. zv_newfra = rswitch * ( zdv_res(ji) + zv_frazb(ji) ) * za_i_1d(ji,jl) / MAX( zat_i_1d(ji) , epsi20 )
  398. za_i_1d(ji,jl) = rswitch * za_i_1d(ji,jl)
  399. zv_i_1d(ji,jl) = zv_i_1d(ji,jl) + zv_newfra
  400. ! for remapping
  401. h_i_old (ji,nlay_i+1) = zv_newfra
  402. qh_i_old(ji,nlay_i+1) = ze_newice(ji) * zv_newfra
  403. ENDDO
  404. ! --- Ice enthalpy remapping --- !
  405. CALL lim_thd_ent( 1, nbpac, ze_i_1d(1:nbpac,:,jl) )
  406. ENDDO
  407. !-----------------
  408. ! Update salinity
  409. !-----------------
  410. DO jl = 1, jpl
  411. DO ji = 1, nbpac
  412. zdv = zv_i_1d(ji,jl) - zv_b(ji,jl)
  413. zsmv_i_1d(ji,jl) = zsmv_i_1d(ji,jl) + zdv * zs_newice(ji)
  414. END DO
  415. END DO
  416. !------------------------------------------------------------------------------!
  417. ! 7) Change 2D vectors to 1D vectors
  418. !------------------------------------------------------------------------------!
  419. DO jl = 1, jpl
  420. CALL tab_1d_2d( nbpac, a_i (:,:,jl), npac(1:nbpac), za_i_1d (1:nbpac,jl), jpi, jpj )
  421. CALL tab_1d_2d( nbpac, v_i (:,:,jl), npac(1:nbpac), zv_i_1d (1:nbpac,jl), jpi, jpj )
  422. CALL tab_1d_2d( nbpac, smv_i (:,:,jl), npac(1:nbpac), zsmv_i_1d(1:nbpac,jl) , jpi, jpj )
  423. DO jk = 1, nlay_i
  424. CALL tab_1d_2d( nbpac, e_i(:,:,jk,jl), npac(1:nbpac), ze_i_1d(1:nbpac,jk,jl), jpi, jpj )
  425. END DO
  426. END DO
  427. CALL tab_1d_2d( nbpac, sfx_opw, npac(1:nbpac), sfx_opw_1d(1:nbpac), jpi, jpj )
  428. CALL tab_1d_2d( nbpac, wfx_opw, npac(1:nbpac), wfx_opw_1d(1:nbpac), jpi, jpj )
  429. CALL tab_1d_2d( nbpac, hfx_thd, npac(1:nbpac), hfx_thd_1d(1:nbpac), jpi, jpj )
  430. CALL tab_1d_2d( nbpac, hfx_opw, npac(1:nbpac), hfx_opw_1d(1:nbpac), jpi, jpj )
  431. !
  432. ENDIF ! nbpac > 0
  433. !------------------------------------------------------------------------------!
  434. ! 8) Change units for e_i
  435. !------------------------------------------------------------------------------!
  436. DO jl = 1, jpl
  437. DO jk = 1, nlay_i
  438. DO jj = 1, jpj
  439. DO ji = 1, jpi
  440. ! heat content in J/m2
  441. e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * v_i(ji,jj,jl) * r1_nlay_i
  442. END DO
  443. END DO
  444. END DO
  445. END DO
  446. !
  447. CALL wrk_dealloc( jpij, jcat ) ! integer
  448. CALL wrk_dealloc( jpij, zswinew, zv_newice, za_newice, zh_newice, ze_newice, zs_newice, zo_newice )
  449. CALL wrk_dealloc( jpij, zdv_res, zda_res, zat_i_1d, zv_frazb, zvrel_1d )
  450. CALL wrk_dealloc( jpij,jpl, zv_b, za_b, za_i_1d, zv_i_1d, zsmv_i_1d )
  451. CALL wrk_dealloc( jpij,nlay_i,jpl, ze_i_1d )
  452. CALL wrk_dealloc( jpi,jpj, zvrel )
  453. !
  454. END SUBROUTINE lim_thd_lac
  455. #else
  456. !!----------------------------------------------------------------------
  457. !! Default option NO LIM3 sea-ice model
  458. !!----------------------------------------------------------------------
  459. CONTAINS
  460. SUBROUTINE lim_thd_lac ! Empty routine
  461. END SUBROUTINE lim_thd_lac
  462. #endif
  463. !!======================================================================
  464. END MODULE limthd_lac