limthd_dif.F90 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847
  1. MODULE limthd_dif
  2. !!======================================================================
  3. !! *** MODULE limthd_dif ***
  4. !! heat diffusion in sea ice
  5. !! computation of surface and inner T
  6. !!======================================================================
  7. !! History : LIM ! 02-2003 (M. Vancoppenolle) original 1D code
  8. !! ! 06-2005 (M. Vancoppenolle) 3d version
  9. !! ! 11-2006 (X Fettweis) Vectorization by Xavier
  10. !! ! 04-2007 (M. Vancoppenolle) Energy conservation
  11. !! 4.0 ! 2011-02 (G. Madec) dynamical allocation
  12. !! - ! 2012-05 (C. Rousset) add penetration solar flux
  13. !!----------------------------------------------------------------------
  14. #if defined key_lim3
  15. !!----------------------------------------------------------------------
  16. !! 'key_lim3' LIM3 sea-ice model
  17. !!----------------------------------------------------------------------
  18. USE par_oce ! ocean parameters
  19. USE phycst ! physical constants (ocean directory)
  20. USE ice ! LIM-3 variables
  21. USE thd_ice ! LIM-3: thermodynamics
  22. USE in_out_manager ! I/O manager
  23. USE lib_mpp ! MPP library
  24. USE wrk_nemo ! work arrays
  25. USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
  26. IMPLICIT NONE
  27. PRIVATE
  28. PUBLIC lim_thd_dif ! called by lim_thd
  29. !!----------------------------------------------------------------------
  30. !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
  31. !! $Id: limthd_dif.F90 5512 2015-06-30 09:14:17Z clem $
  32. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  33. !!----------------------------------------------------------------------
  34. CONTAINS
  35. SUBROUTINE lim_thd_dif( kideb , kiut )
  36. !!------------------------------------------------------------------
  37. !! *** ROUTINE lim_thd_dif ***
  38. !! ** Purpose :
  39. !! This routine determines the time evolution of snow and sea-ice
  40. !! temperature profiles.
  41. !! ** Method :
  42. !! This is done by solving the heat equation diffusion with
  43. !! a Neumann boundary condition at the surface and a Dirichlet one
  44. !! at the bottom. Solar radiation is partially absorbed into the ice.
  45. !! The specific heat and thermal conductivities depend on ice salinity
  46. !! and temperature to take into account brine pocket melting. The
  47. !! numerical
  48. !! scheme is an iterative Crank-Nicolson on a non-uniform multilayer grid
  49. !! in the ice and snow system.
  50. !!
  51. !! The successive steps of this routine are
  52. !! 1. Thermal conductivity at the interfaces of the ice layers
  53. !! 2. Internal absorbed radiation
  54. !! 3. Scale factors due to non-uniform grid
  55. !! 4. Kappa factors
  56. !! Then iterative procedure begins
  57. !! 5. specific heat in the ice
  58. !! 6. eta factors
  59. !! 7. surface flux computation
  60. !! 8. tridiagonal system terms
  61. !! 9. solving the tridiagonal system with Gauss elimination
  62. !! Iterative procedure ends according to a criterion on evolution
  63. !! of temperature
  64. !!
  65. !! ** Arguments :
  66. !! kideb , kiut : Starting and ending points on which the
  67. !! the computation is applied
  68. !!
  69. !! ** Inputs / Ouputs : (global commons)
  70. !! surface temperature : t_su_1d
  71. !! ice/snow temperatures : t_i_1d, t_s_1d
  72. !! ice salinities : s_i_1d
  73. !! number of layers in the ice/snow: nlay_i, nlay_s
  74. !! profile of the ice/snow layers : z_i, z_s
  75. !! total ice/snow thickness : ht_i_1d, ht_s_1d
  76. !!
  77. !! ** External :
  78. !!
  79. !! ** References :
  80. !!
  81. !! ** History :
  82. !! (02-2003) Martin Vancoppenolle, Louvain-la-Neuve, Belgium
  83. !! (06-2005) Martin Vancoppenolle, 3d version
  84. !! (11-2006) Vectorized by Xavier Fettweis (UCL-ASTR)
  85. !! (04-2007) Energy conservation tested by M. Vancoppenolle
  86. !!------------------------------------------------------------------
  87. INTEGER , INTENT(in) :: kideb, kiut ! Start/End point on which the the computation is applied
  88. !! * Local variables
  89. INTEGER :: ji ! spatial loop index
  90. INTEGER :: ii, ij ! temporary dummy loop index
  91. INTEGER :: numeq ! current reference number of equation
  92. INTEGER :: jk ! vertical dummy loop index
  93. INTEGER :: nconv ! number of iterations in iterative procedure
  94. INTEGER :: minnumeqmin, maxnumeqmax
  95. INTEGER, POINTER, DIMENSION(:) :: numeqmin ! reference number of top equation
  96. INTEGER, POINTER, DIMENSION(:) :: numeqmax ! reference number of bottom equation
  97. REAL(wp) :: zg1s = 2._wp ! for the tridiagonal system
  98. REAL(wp) :: zg1 = 2._wp !
  99. REAL(wp) :: zgamma = 18009._wp ! for specific heat
  100. REAL(wp) :: zbeta = 0.117_wp ! for thermal conductivity (could be 0.13)
  101. REAL(wp) :: zraext_s = 10._wp ! extinction coefficient of radiation in the snow
  102. REAL(wp) :: zkimin = 0.10_wp ! minimum ice thermal conductivity
  103. REAL(wp) :: ztsu_err = 1.e-5_wp ! range around which t_su is considered as 0°C
  104. REAL(wp) :: ztmelt_i ! ice melting temperature
  105. REAL(wp) :: zerritmax ! current maximal error on temperature
  106. REAL(wp) :: zhsu
  107. REAL(wp), POINTER, DIMENSION(:) :: isnow ! switch for presence (1) or absence (0) of snow
  108. REAL(wp), POINTER, DIMENSION(:) :: ztsub ! old surface temperature (before the iterative procedure )
  109. REAL(wp), POINTER, DIMENSION(:) :: ztsubit ! surface temperature at previous iteration
  110. REAL(wp), POINTER, DIMENSION(:) :: zh_i ! ice layer thickness
  111. REAL(wp), POINTER, DIMENSION(:) :: zh_s ! snow layer thickness
  112. REAL(wp), POINTER, DIMENSION(:) :: zfsw ! solar radiation absorbed at the surface
  113. REAL(wp), POINTER, DIMENSION(:) :: zqns_ice_b ! solar radiation absorbed at the surface
  114. REAL(wp), POINTER, DIMENSION(:) :: zf ! surface flux function
  115. REAL(wp), POINTER, DIMENSION(:) :: dzf ! derivative of the surface flux function
  116. REAL(wp), POINTER, DIMENSION(:) :: zerrit ! current error on temperature
  117. REAL(wp), POINTER, DIMENSION(:) :: zdifcase ! case of the equation resolution (1->4)
  118. REAL(wp), POINTER, DIMENSION(:) :: zftrice ! solar radiation transmitted through the ice
  119. REAL(wp), POINTER, DIMENSION(:) :: zihic
  120. REAL(wp), POINTER, DIMENSION(:,:) :: ztcond_i ! Ice thermal conductivity
  121. REAL(wp), POINTER, DIMENSION(:,:) :: zradtr_i ! Radiation transmitted through the ice
  122. REAL(wp), POINTER, DIMENSION(:,:) :: zradab_i ! Radiation absorbed in the ice
  123. REAL(wp), POINTER, DIMENSION(:,:) :: zkappa_i ! Kappa factor in the ice
  124. REAL(wp), POINTER, DIMENSION(:,:) :: ztib ! Old temperature in the ice
  125. REAL(wp), POINTER, DIMENSION(:,:) :: zeta_i ! Eta factor in the ice
  126. REAL(wp), POINTER, DIMENSION(:,:) :: ztitemp ! Temporary temperature in the ice to check the convergence
  127. REAL(wp), POINTER, DIMENSION(:,:) :: zspeche_i ! Ice specific heat
  128. REAL(wp), POINTER, DIMENSION(:,:) :: z_i ! Vertical cotes of the layers in the ice
  129. REAL(wp), POINTER, DIMENSION(:,:) :: zradtr_s ! Radiation transmited through the snow
  130. REAL(wp), POINTER, DIMENSION(:,:) :: zradab_s ! Radiation absorbed in the snow
  131. REAL(wp), POINTER, DIMENSION(:,:) :: zkappa_s ! Kappa factor in the snow
  132. REAL(wp), POINTER, DIMENSION(:,:) :: zeta_s ! Eta factor in the snow
  133. REAL(wp), POINTER, DIMENSION(:,:) :: ztstemp ! Temporary temperature in the snow to check the convergence
  134. REAL(wp), POINTER, DIMENSION(:,:) :: ztsb ! Temporary temperature in the snow
  135. REAL(wp), POINTER, DIMENSION(:,:) :: z_s ! Vertical cotes of the layers in the snow
  136. REAL(wp), POINTER, DIMENSION(:,:) :: zindterm ! 'Ind'ependent term
  137. REAL(wp), POINTER, DIMENSION(:,:) :: zindtbis ! Temporary 'ind'ependent term
  138. REAL(wp), POINTER, DIMENSION(:,:) :: zdiagbis ! Temporary 'dia'gonal term
  139. REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrid ! Tridiagonal system terms
  140. ! diag errors on heat
  141. REAL(wp), POINTER, DIMENSION(:) :: zdq, zq_ini, zhfx_err
  142. ! Mono-category
  143. REAL(wp) :: zepsilon ! determines thres. above which computation of G(h) is done
  144. REAL(wp) :: zratio_s ! dummy factor
  145. REAL(wp) :: zratio_i ! dummy factor
  146. REAL(wp) :: zh_thres ! thickness thres. for G(h) computation
  147. REAL(wp) :: zhe ! dummy factor
  148. REAL(wp) :: zkimean ! mean sea ice thermal conductivity
  149. REAL(wp) :: zfac ! dummy factor
  150. REAL(wp) :: zihe ! dummy factor
  151. REAL(wp) :: zheshth ! dummy factor
  152. REAL(wp), POINTER, DIMENSION(:) :: zghe ! G(he), th. conduct enhancement factor, mono-cat
  153. !!------------------------------------------------------------------
  154. !
  155. CALL wrk_alloc( jpij, numeqmin, numeqmax )
  156. CALL wrk_alloc( jpij, isnow, ztsub, ztsubit, zh_i, zh_s, zfsw )
  157. CALL wrk_alloc( jpij, zf, dzf, zqns_ice_b, zerrit, zdifcase, zftrice, zihic, zghe )
  158. CALL wrk_alloc( jpij,nlay_i+1, ztcond_i, zradtr_i, zradab_i, zkappa_i, ztib, zeta_i, ztitemp, z_i, zspeche_i, kjstart=0 )
  159. CALL wrk_alloc( jpij,nlay_s+1, zradtr_s, zradab_s, zkappa_s, ztsb, zeta_s, ztstemp, z_s, kjstart=0 )
  160. CALL wrk_alloc( jpij,nlay_i+3, zindterm, zindtbis, zdiagbis )
  161. CALL wrk_alloc( jpij,nlay_i+3,3, ztrid )
  162. CALL wrk_alloc( jpij, zdq, zq_ini, zhfx_err )
  163. ! --- diag error on heat diffusion - PART 1 --- !
  164. zdq(:) = 0._wp ; zq_ini(:) = 0._wp
  165. DO ji = kideb, kiut
  166. zq_ini(ji) = ( SUM( q_i_1d(ji,1:nlay_i) ) * ht_i_1d(ji) * r1_nlay_i + &
  167. & SUM( q_s_1d(ji,1:nlay_s) ) * ht_s_1d(ji) * r1_nlay_s )
  168. END DO
  169. !------------------------------------------------------------------------------!
  170. ! 1) Initialization !
  171. !------------------------------------------------------------------------------!
  172. DO ji = kideb , kiut
  173. isnow(ji)= 1._wp - MAX( 0._wp , SIGN(1._wp, - ht_s_1d(ji) ) ) ! is there snow or not
  174. ! layer thickness
  175. zh_i(ji) = ht_i_1d(ji) * r1_nlay_i
  176. zh_s(ji) = ht_s_1d(ji) * r1_nlay_s
  177. END DO
  178. !--------------------
  179. ! Ice / snow layers
  180. !--------------------
  181. z_s(:,0) = 0._wp ! vert. coord. of the up. lim. of the 1st snow layer
  182. z_i(:,0) = 0._wp ! vert. coord. of the up. lim. of the 1st ice layer
  183. DO jk = 1, nlay_s ! vert. coord of the up. lim. of the layer-th snow layer
  184. DO ji = kideb , kiut
  185. z_s(ji,jk) = z_s(ji,jk-1) + ht_s_1d(ji) * r1_nlay_s
  186. END DO
  187. END DO
  188. DO jk = 1, nlay_i ! vert. coord of the up. lim. of the layer-th ice layer
  189. DO ji = kideb , kiut
  190. z_i(ji,jk) = z_i(ji,jk-1) + ht_i_1d(ji) * r1_nlay_i
  191. END DO
  192. END DO
  193. !
  194. !------------------------------------------------------------------------------|
  195. ! 2) Radiation |
  196. !------------------------------------------------------------------------------|
  197. !
  198. !-------------------
  199. ! Computation of i0
  200. !-------------------
  201. ! i0 describes the fraction of solar radiation which does not contribute
  202. ! to the surface energy budget but rather penetrates inside the ice.
  203. ! We assume that no radiation is transmitted through the snow
  204. ! If there is no no snow
  205. ! zfsw = (1-i0).qsr_ice is absorbed at the surface
  206. ! zftrice = io.qsr_ice is below the surface
  207. ! ftr_ice = io.qsr_ice.exp(-k(h_i)) transmitted below the ice
  208. ! fr1_i0_1d = i0 for a thin ice cover, fr1_i0_2d = i0 for a thick ice cover
  209. zhsu = 0.1_wp ! threshold for the computation of i0
  210. DO ji = kideb , kiut
  211. ! switches
  212. isnow(ji) = 1._wp - MAX( 0._wp , SIGN( 1._wp , - ht_s_1d(ji) ) )
  213. ! hs > 0, isnow = 1
  214. zihic(ji) = MAX( 0._wp , 1._wp - ( ht_i_1d(ji) / zhsu ) )
  215. i0(ji) = ( 1._wp - isnow(ji) ) * ( fr1_i0_1d(ji) + zihic(ji) * fr2_i0_1d(ji) )
  216. END DO
  217. !-------------------------------------------------------
  218. ! Solar radiation absorbed / transmitted at the surface
  219. ! Derivative of the non solar flux
  220. !-------------------------------------------------------
  221. DO ji = kideb , kiut
  222. zfsw (ji) = qsr_ice_1d(ji) * ( 1 - i0(ji) ) ! Shortwave radiation absorbed at surface
  223. zftrice(ji) = qsr_ice_1d(ji) * i0(ji) ! Solar radiation transmitted below the surface layer
  224. dzf (ji) = dqns_ice_1d(ji) ! derivative of incoming nonsolar flux
  225. zqns_ice_b(ji) = qns_ice_1d(ji) ! store previous qns_ice_1d value
  226. END DO
  227. !---------------------------------------------------------
  228. ! Transmission - absorption of solar radiation in the ice
  229. !---------------------------------------------------------
  230. DO ji = kideb, kiut ! snow initialization
  231. zradtr_s(ji,0) = zftrice(ji) ! radiation penetrating through snow
  232. END DO
  233. DO jk = 1, nlay_s ! Radiation through snow
  234. DO ji = kideb, kiut
  235. ! ! radiation transmitted below the layer-th snow layer
  236. zradtr_s(ji,jk) = zradtr_s(ji,0) * EXP( - zraext_s * ( MAX ( 0._wp , z_s(ji,jk) ) ) )
  237. ! ! radiation absorbed by the layer-th snow layer
  238. zradab_s(ji,jk) = zradtr_s(ji,jk-1) - zradtr_s(ji,jk)
  239. END DO
  240. END DO
  241. DO ji = kideb, kiut ! ice initialization
  242. zradtr_i(ji,0) = zradtr_s(ji,nlay_s) * isnow(ji) + zftrice(ji) * ( 1._wp - isnow(ji) )
  243. END DO
  244. DO jk = 1, nlay_i ! Radiation through ice
  245. DO ji = kideb, kiut
  246. ! ! radiation transmitted below the layer-th ice layer
  247. zradtr_i(ji,jk) = zradtr_i(ji,0) * EXP( - rn_kappa_i * ( MAX ( 0._wp , z_i(ji,jk) ) ) )
  248. ! ! radiation absorbed by the layer-th ice layer
  249. zradab_i(ji,jk) = zradtr_i(ji,jk-1) - zradtr_i(ji,jk)
  250. END DO
  251. END DO
  252. DO ji = kideb, kiut ! Radiation transmitted below the ice
  253. ftr_ice_1d(ji) = zradtr_i(ji,nlay_i)
  254. END DO
  255. !------------------------------------------------------------------------------|
  256. ! 3) Iterative procedure begins |
  257. !------------------------------------------------------------------------------|
  258. !
  259. DO ji = kideb, kiut ! Old surface temperature
  260. ztsub (ji) = t_su_1d(ji) ! temperature at the beg of iter pr.
  261. ztsubit(ji) = t_su_1d(ji) ! temperature at the previous iter
  262. t_su_1d(ji) = MIN( t_su_1d(ji), rt0 - ztsu_err ) ! necessary
  263. zerrit (ji) = 1000._wp ! initial value of error
  264. END DO
  265. DO jk = 1, nlay_s ! Old snow temperature
  266. DO ji = kideb , kiut
  267. ztsb(ji,jk) = t_s_1d(ji,jk)
  268. END DO
  269. END DO
  270. DO jk = 1, nlay_i ! Old ice temperature
  271. DO ji = kideb , kiut
  272. ztib(ji,jk) = t_i_1d(ji,jk)
  273. END DO
  274. END DO
  275. nconv = 0 ! number of iterations
  276. zerritmax = 1000._wp ! maximal value of error on all points
  277. DO WHILE ( zerritmax > rn_terr_dif .AND. nconv < nn_conv_dif )
  278. !
  279. nconv = nconv + 1
  280. !
  281. !------------------------------------------------------------------------------|
  282. ! 4) Sea ice thermal conductivity |
  283. !------------------------------------------------------------------------------|
  284. !
  285. IF( nn_ice_thcon == 0 ) THEN ! Untersteiner (1964) formula
  286. DO ji = kideb , kiut
  287. ztcond_i(ji,0) = rcdic + zbeta * s_i_1d(ji,1) / MIN( -epsi10, t_i_1d(ji,1) - rt0 )
  288. ztcond_i(ji,0) = MAX( ztcond_i(ji,0), zkimin )
  289. END DO
  290. DO jk = 1, nlay_i-1
  291. DO ji = kideb , kiut
  292. ztcond_i(ji,jk) = rcdic + zbeta * ( s_i_1d(ji,jk) + s_i_1d(ji,jk+1) ) / &
  293. MIN(-2.0_wp * epsi10, t_i_1d(ji,jk) + t_i_1d(ji,jk+1) - 2.0_wp * rt0)
  294. ztcond_i(ji,jk) = MAX( ztcond_i(ji,jk), zkimin )
  295. END DO
  296. END DO
  297. ENDIF
  298. IF( nn_ice_thcon == 1 ) THEN ! Pringle et al formula included: 2.11 + 0.09 S/T - 0.011.T
  299. DO ji = kideb , kiut
  300. ztcond_i(ji,0) = rcdic + 0.090_wp * s_i_1d(ji,1) / MIN( -epsi10, t_i_1d(ji,1) - rt0 ) &
  301. & - 0.011_wp * ( t_i_1d(ji,1) - rt0 )
  302. ztcond_i(ji,0) = MAX( ztcond_i(ji,0), zkimin )
  303. END DO
  304. DO jk = 1, nlay_i-1
  305. DO ji = kideb , kiut
  306. ztcond_i(ji,jk) = rcdic + &
  307. & 0.09_wp * ( s_i_1d(ji,jk) + s_i_1d(ji,jk+1) ) &
  308. & / MIN( -2._wp * epsi10, t_i_1d(ji,jk) + t_i_1d(ji,jk+1) - 2.0_wp * rt0 ) &
  309. & - 0.0055_wp * ( t_i_1d(ji,jk) + t_i_1d(ji,jk+1) - 2.0 * rt0 )
  310. ztcond_i(ji,jk) = MAX( ztcond_i(ji,jk), zkimin )
  311. END DO
  312. END DO
  313. DO ji = kideb , kiut
  314. ztcond_i(ji,nlay_i) = rcdic + 0.090_wp * s_i_1d(ji,nlay_i) / MIN( -epsi10, t_bo_1d(ji) - rt0 ) &
  315. & - 0.011_wp * ( t_bo_1d(ji) - rt0 )
  316. ztcond_i(ji,nlay_i) = MAX( ztcond_i(ji,nlay_i), zkimin )
  317. END DO
  318. ENDIF
  319. !
  320. !------------------------------------------------------------------------------|
  321. ! 5) G(he) - enhancement of thermal conductivity in mono-category case |
  322. !------------------------------------------------------------------------------|
  323. !
  324. ! Computation of effective thermal conductivity G(h)
  325. ! Used in mono-category case only to simulate an ITD implicitly
  326. ! Fichefet and Morales Maqueda, JGR 1997
  327. zghe(:) = 1._wp
  328. SELECT CASE ( nn_monocat )
  329. CASE (1,3) ! LIM3
  330. zepsilon = 0.1_wp
  331. zh_thres = EXP( 1._wp ) * zepsilon * 0.5_wp
  332. DO ji = kideb, kiut
  333. ! Mean sea ice thermal conductivity
  334. zkimean = SUM( ztcond_i(ji,0:nlay_i) ) / REAL( nlay_i+1, wp )
  335. ! Effective thickness he (zhe)
  336. zfac = 1._wp / ( rn_cdsn + zkimean )
  337. zratio_s = rn_cdsn * zfac
  338. zratio_i = zkimean * zfac
  339. zhe = zratio_s * ht_i_1d(ji) + zratio_i * ht_s_1d(ji)
  340. ! G(he)
  341. rswitch = MAX( 0._wp , SIGN( 1._wp , zhe - zh_thres ) ) ! =0 if zhe < zh_thres, if >
  342. zghe(ji) = ( 1._wp - rswitch ) + rswitch * 0.5_wp * ( 1._wp + LOG( 2._wp * zhe / zepsilon ) )
  343. ! Impose G(he) < 2.
  344. zghe(ji) = MIN( zghe(ji), 2._wp )
  345. END DO
  346. END SELECT
  347. !
  348. !------------------------------------------------------------------------------|
  349. ! 6) kappa factors |
  350. !------------------------------------------------------------------------------|
  351. !
  352. !--- Snow
  353. DO ji = kideb, kiut
  354. zfac = 1. / MAX( epsi10 , zh_s(ji) )
  355. zkappa_s(ji,0) = zghe(ji) * rn_cdsn * zfac
  356. zkappa_s(ji,nlay_s) = zghe(ji) * rn_cdsn * zfac
  357. END DO
  358. DO jk = 1, nlay_s-1
  359. DO ji = kideb , kiut
  360. zkappa_s(ji,jk) = zghe(ji) * 2.0 * rn_cdsn / MAX( epsi10, 2.0 * zh_s(ji) )
  361. END DO
  362. END DO
  363. !--- Ice
  364. DO jk = 1, nlay_i-1
  365. DO ji = kideb , kiut
  366. zkappa_i(ji,jk) = zghe(ji) * 2.0 * ztcond_i(ji,jk) / MAX( epsi10 , 2.0 * zh_i(ji) )
  367. END DO
  368. END DO
  369. !--- Snow-ice interface
  370. DO ji = kideb , kiut
  371. zfac = 1./ MAX( epsi10 , zh_i(ji) )
  372. zkappa_i(ji,0) = zghe(ji) * ztcond_i(ji,0) * zfac
  373. zkappa_i(ji,nlay_i) = zghe(ji) * ztcond_i(ji,nlay_i) * zfac
  374. zkappa_s(ji,nlay_s) = zghe(ji) * zghe(ji) * 2.0 * rn_cdsn * ztcond_i(ji,0) / &
  375. & MAX( epsi10, ( zghe(ji) * ztcond_i(ji,0) * zh_s(ji) + zghe(ji) * rn_cdsn * zh_i(ji) ) )
  376. zkappa_i(ji,0) = zkappa_s(ji,nlay_s) * isnow(ji) + zkappa_i(ji,0) * ( 1._wp - isnow(ji) )
  377. END DO
  378. !
  379. !------------------------------------------------------------------------------|
  380. ! 7) Sea ice specific heat, eta factors |
  381. !------------------------------------------------------------------------------|
  382. !
  383. DO jk = 1, nlay_i
  384. DO ji = kideb , kiut
  385. ztitemp(ji,jk) = t_i_1d(ji,jk)
  386. zspeche_i(ji,jk) = cpic + zgamma * s_i_1d(ji,jk) / MAX( ( t_i_1d(ji,jk) - rt0 ) * ( ztib(ji,jk) - rt0 ), epsi10 )
  387. zeta_i(ji,jk) = rdt_ice / MAX( rhoic * zspeche_i(ji,jk) * zh_i(ji), epsi10 )
  388. END DO
  389. END DO
  390. DO jk = 1, nlay_s
  391. DO ji = kideb , kiut
  392. ztstemp(ji,jk) = t_s_1d(ji,jk)
  393. zeta_s(ji,jk) = rdt_ice / MAX( rhosn * cpic * zh_s(ji), epsi10 )
  394. END DO
  395. END DO
  396. !
  397. !------------------------------------------------------------------------------|
  398. ! 8) surface flux computation |
  399. !------------------------------------------------------------------------------|
  400. !
  401. IF ( ln_it_qnsice ) THEN
  402. DO ji = kideb , kiut
  403. ! update of the non solar flux according to the update in T_su
  404. qns_ice_1d(ji) = qns_ice_1d(ji) + dqns_ice_1d(ji) * ( t_su_1d(ji) - ztsubit(ji) )
  405. END DO
  406. ENDIF
  407. ! Update incoming flux
  408. DO ji = kideb , kiut
  409. ! update incoming flux
  410. zf(ji) = zfsw(ji) & ! net absorbed solar radiation
  411. & + qns_ice_1d(ji) ! non solar total flux (LWup, LWdw, SH, LH)
  412. END DO
  413. !
  414. !------------------------------------------------------------------------------|
  415. ! 9) tridiagonal system terms |
  416. !------------------------------------------------------------------------------|
  417. !
  418. !!layer denotes the number of the layer in the snow or in the ice
  419. !!numeq denotes the reference number of the equation in the tridiagonal
  420. !!system, terms of tridiagonal system are indexed as following :
  421. !!1 is subdiagonal term, 2 is diagonal and 3 is superdiagonal one
  422. !!ice interior terms (top equation has the same form as the others)
  423. DO numeq=1,nlay_i+3
  424. DO ji = kideb , kiut
  425. ztrid(ji,numeq,1) = 0.
  426. ztrid(ji,numeq,2) = 0.
  427. ztrid(ji,numeq,3) = 0.
  428. zindterm(ji,numeq)= 0.
  429. zindtbis(ji,numeq)= 0.
  430. zdiagbis(ji,numeq)= 0.
  431. ENDDO
  432. ENDDO
  433. DO numeq = nlay_s + 2, nlay_s + nlay_i
  434. DO ji = kideb , kiut
  435. jk = numeq - nlay_s - 1
  436. ztrid(ji,numeq,1) = - zeta_i(ji,jk) * zkappa_i(ji,jk-1)
  437. ztrid(ji,numeq,2) = 1.0 + zeta_i(ji,jk) * ( zkappa_i(ji,jk-1) + zkappa_i(ji,jk) )
  438. ztrid(ji,numeq,3) = - zeta_i(ji,jk) * zkappa_i(ji,jk)
  439. zindterm(ji,numeq) = ztib(ji,jk) + zeta_i(ji,jk) * zradab_i(ji,jk)
  440. END DO
  441. ENDDO
  442. numeq = nlay_s + nlay_i + 1
  443. DO ji = kideb , kiut
  444. !!ice bottom term
  445. ztrid(ji,numeq,1) = - zeta_i(ji,nlay_i)*zkappa_i(ji,nlay_i-1)
  446. ztrid(ji,numeq,2) = 1.0 + zeta_i(ji,nlay_i) * ( zkappa_i(ji,nlay_i) * zg1 + zkappa_i(ji,nlay_i-1) )
  447. ztrid(ji,numeq,3) = 0.0
  448. zindterm(ji,numeq) = ztib(ji,nlay_i) + zeta_i(ji,nlay_i) * &
  449. & ( zradab_i(ji,nlay_i) + zkappa_i(ji,nlay_i) * zg1 * t_bo_1d(ji) )
  450. ENDDO
  451. DO ji = kideb , kiut
  452. IF ( ht_s_1d(ji) > 0.0 ) THEN
  453. !
  454. !------------------------------------------------------------------------------|
  455. ! snow-covered cells |
  456. !------------------------------------------------------------------------------|
  457. !
  458. !!snow interior terms (bottom equation has the same form as the others)
  459. DO numeq = 3, nlay_s + 1
  460. jk = numeq - 1
  461. ztrid(ji,numeq,1) = - zeta_s(ji,jk) * zkappa_s(ji,jk-1)
  462. ztrid(ji,numeq,2) = 1.0 + zeta_s(ji,jk) * ( zkappa_s(ji,jk-1) + zkappa_s(ji,jk) )
  463. ztrid(ji,numeq,3) = - zeta_s(ji,jk)*zkappa_s(ji,jk)
  464. zindterm(ji,numeq) = ztsb(ji,jk) + zeta_s(ji,jk) * zradab_s(ji,jk)
  465. END DO
  466. !!case of only one layer in the ice (ice equation is altered)
  467. IF ( nlay_i.eq.1 ) THEN
  468. ztrid(ji,nlay_s+2,3) = 0.0
  469. zindterm(ji,nlay_s+2) = zindterm(ji,nlay_s+2) + zkappa_i(ji,1) * t_bo_1d(ji)
  470. ENDIF
  471. IF ( t_su_1d(ji) < rt0 ) THEN
  472. !------------------------------------------------------------------------------|
  473. ! case 1 : no surface melting - snow present |
  474. !------------------------------------------------------------------------------|
  475. zdifcase(ji) = 1.0
  476. numeqmin(ji) = 1
  477. numeqmax(ji) = nlay_i + nlay_s + 1
  478. !!surface equation
  479. ztrid(ji,1,1) = 0.0
  480. ztrid(ji,1,2) = dzf(ji) - zg1s * zkappa_s(ji,0)
  481. ztrid(ji,1,3) = zg1s * zkappa_s(ji,0)
  482. zindterm(ji,1) = dzf(ji) * t_su_1d(ji) - zf(ji)
  483. !!first layer of snow equation
  484. ztrid(ji,2,1) = - zkappa_s(ji,0) * zg1s * zeta_s(ji,1)
  485. ztrid(ji,2,2) = 1.0 + zeta_s(ji,1) * ( zkappa_s(ji,1) + zkappa_s(ji,0) * zg1s )
  486. ztrid(ji,2,3) = - zeta_s(ji,1)* zkappa_s(ji,1)
  487. zindterm(ji,2) = ztsb(ji,1) + zeta_s(ji,1) * zradab_s(ji,1)
  488. ELSE
  489. !
  490. !------------------------------------------------------------------------------|
  491. ! case 2 : surface is melting - snow present |
  492. !------------------------------------------------------------------------------|
  493. !
  494. zdifcase(ji) = 2.0
  495. numeqmin(ji) = 2
  496. numeqmax(ji) = nlay_i + nlay_s + 1
  497. !!first layer of snow equation
  498. ztrid(ji,2,1) = 0.0
  499. ztrid(ji,2,2) = 1.0 + zeta_s(ji,1) * ( zkappa_s(ji,1) + zkappa_s(ji,0) * zg1s )
  500. ztrid(ji,2,3) = - zeta_s(ji,1)*zkappa_s(ji,1)
  501. zindterm(ji,2) = ztsb(ji,1) + zeta_s(ji,1) * &
  502. & ( zradab_s(ji,1) + zkappa_s(ji,0) * zg1s * t_su_1d(ji) )
  503. ENDIF
  504. ELSE
  505. !
  506. !------------------------------------------------------------------------------|
  507. ! cells without snow |
  508. !------------------------------------------------------------------------------|
  509. !
  510. IF ( t_su_1d(ji) < rt0 ) THEN
  511. !
  512. !------------------------------------------------------------------------------|
  513. ! case 3 : no surface melting - no snow |
  514. !------------------------------------------------------------------------------|
  515. !
  516. zdifcase(ji) = 3.0
  517. numeqmin(ji) = nlay_s + 1
  518. numeqmax(ji) = nlay_i + nlay_s + 1
  519. !!surface equation
  520. ztrid(ji,numeqmin(ji),1) = 0.0
  521. ztrid(ji,numeqmin(ji),2) = dzf(ji) - zkappa_i(ji,0)*zg1
  522. ztrid(ji,numeqmin(ji),3) = zkappa_i(ji,0)*zg1
  523. zindterm(ji,numeqmin(ji)) = dzf(ji)*t_su_1d(ji) - zf(ji)
  524. !!first layer of ice equation
  525. ztrid(ji,numeqmin(ji)+1,1) = - zkappa_i(ji,0) * zg1 * zeta_i(ji,1)
  526. ztrid(ji,numeqmin(ji)+1,2) = 1.0 + zeta_i(ji,1) * ( zkappa_i(ji,1) + zkappa_i(ji,0) * zg1 )
  527. ztrid(ji,numeqmin(ji)+1,3) = - zeta_i(ji,1) * zkappa_i(ji,1)
  528. zindterm(ji,numeqmin(ji)+1)= ztib(ji,1) + zeta_i(ji,1) * zradab_i(ji,1)
  529. !!case of only one layer in the ice (surface & ice equations are altered)
  530. IF ( nlay_i == 1 ) THEN
  531. ztrid(ji,numeqmin(ji),1) = 0.0
  532. ztrid(ji,numeqmin(ji),2) = dzf(ji) - zkappa_i(ji,0) * 2.0
  533. ztrid(ji,numeqmin(ji),3) = zkappa_i(ji,0) * 2.0
  534. ztrid(ji,numeqmin(ji)+1,1) = -zkappa_i(ji,0) * 2.0 * zeta_i(ji,1)
  535. ztrid(ji,numeqmin(ji)+1,2) = 1.0 + zeta_i(ji,1) * ( zkappa_i(ji,0) * 2.0 + zkappa_i(ji,1) )
  536. ztrid(ji,numeqmin(ji)+1,3) = 0.0
  537. zindterm(ji,numeqmin(ji)+1) = ztib(ji,1) + zeta_i(ji,1) * &
  538. & ( zradab_i(ji,1) + zkappa_i(ji,1) * t_bo_1d(ji) )
  539. ENDIF
  540. ELSE
  541. !
  542. !------------------------------------------------------------------------------|
  543. ! case 4 : surface is melting - no snow |
  544. !------------------------------------------------------------------------------|
  545. !
  546. zdifcase(ji) = 4.0
  547. numeqmin(ji) = nlay_s + 2
  548. numeqmax(ji) = nlay_i + nlay_s + 1
  549. !!first layer of ice equation
  550. ztrid(ji,numeqmin(ji),1) = 0.0
  551. ztrid(ji,numeqmin(ji),2) = 1.0 + zeta_i(ji,1) * ( zkappa_i(ji,1) + zkappa_i(ji,0) * zg1 )
  552. ztrid(ji,numeqmin(ji),3) = - zeta_i(ji,1) * zkappa_i(ji,1)
  553. zindterm(ji,numeqmin(ji)) = ztib(ji,1) + zeta_i(ji,1) * &
  554. & ( zradab_i(ji,1) + zkappa_i(ji,0) * zg1 * t_su_1d(ji) )
  555. !!case of only one layer in the ice (surface & ice equations are altered)
  556. IF ( nlay_i == 1 ) THEN
  557. ztrid(ji,numeqmin(ji),1) = 0.0
  558. ztrid(ji,numeqmin(ji),2) = 1.0 + zeta_i(ji,1) * ( zkappa_i(ji,0) * 2.0 + zkappa_i(ji,1) )
  559. ztrid(ji,numeqmin(ji),3) = 0.0
  560. zindterm(ji,numeqmin(ji)) = ztib(ji,1) + zeta_i(ji,1) * ( zradab_i(ji,1) + zkappa_i(ji,1) * t_bo_1d(ji) ) &
  561. & + t_su_1d(ji) * zeta_i(ji,1) * zkappa_i(ji,0) * 2.0
  562. ENDIF
  563. ENDIF
  564. ENDIF
  565. END DO
  566. !
  567. !------------------------------------------------------------------------------|
  568. ! 10) tridiagonal system solving |
  569. !------------------------------------------------------------------------------|
  570. !
  571. ! Solve the tridiagonal system with Gauss elimination method.
  572. ! Thomas algorithm, from Computational fluid Dynamics, J.D. ANDERSON,
  573. ! McGraw-Hill 1984.
  574. maxnumeqmax = 0
  575. minnumeqmin = nlay_i+5
  576. DO ji = kideb , kiut
  577. zindtbis(ji,numeqmin(ji)) = zindterm(ji,numeqmin(ji))
  578. zdiagbis(ji,numeqmin(ji)) = ztrid(ji,numeqmin(ji),2)
  579. minnumeqmin = MIN(numeqmin(ji),minnumeqmin)
  580. maxnumeqmax = MAX(numeqmax(ji),maxnumeqmax)
  581. END DO
  582. DO jk = minnumeqmin+1, maxnumeqmax
  583. DO ji = kideb , kiut
  584. numeq = min(max(numeqmin(ji)+1,jk),numeqmax(ji))
  585. zdiagbis(ji,numeq) = ztrid(ji,numeq,2) - ztrid(ji,numeq,1) * ztrid(ji,numeq-1,3) / zdiagbis(ji,numeq-1)
  586. zindtbis(ji,numeq) = zindterm(ji,numeq) - ztrid(ji,numeq,1) * zindtbis(ji,numeq-1) / zdiagbis(ji,numeq-1)
  587. END DO
  588. END DO
  589. DO ji = kideb , kiut
  590. ! ice temperatures
  591. t_i_1d(ji,nlay_i) = zindtbis(ji,numeqmax(ji)) / zdiagbis(ji,numeqmax(ji))
  592. END DO
  593. DO numeq = nlay_i + nlay_s, nlay_s + 2, -1
  594. DO ji = kideb , kiut
  595. jk = numeq - nlay_s - 1
  596. t_i_1d(ji,jk) = ( zindtbis(ji,numeq) - ztrid(ji,numeq,3) * t_i_1d(ji,jk+1) ) / zdiagbis(ji,numeq)
  597. END DO
  598. END DO
  599. DO ji = kideb , kiut
  600. ! snow temperatures
  601. IF (ht_s_1d(ji) > 0._wp) &
  602. t_s_1d(ji,nlay_s) = ( zindtbis(ji,nlay_s+1) - ztrid(ji,nlay_s+1,3) * t_i_1d(ji,1) ) &
  603. & / zdiagbis(ji,nlay_s+1) * MAX( 0.0, SIGN( 1.0, ht_s_1d(ji) ) )
  604. ! surface temperature
  605. isnow(ji) = 1._wp - MAX( 0._wp , SIGN( 1._wp , -ht_s_1d(ji) ) )
  606. ztsubit(ji) = t_su_1d(ji)
  607. IF( t_su_1d(ji) < rt0 ) &
  608. t_su_1d(ji) = ( zindtbis(ji,numeqmin(ji)) - ztrid(ji,numeqmin(ji),3) * &
  609. & ( isnow(ji) * t_s_1d(ji,1) + ( 1._wp - isnow(ji) ) * t_i_1d(ji,1) ) ) / zdiagbis(ji,numeqmin(ji))
  610. END DO
  611. !
  612. !--------------------------------------------------------------------------
  613. ! 11) Has the scheme converged ?, end of the iterative procedure |
  614. !--------------------------------------------------------------------------
  615. !
  616. ! check that nowhere it has started to melt
  617. ! zerrit(ji) is a measure of error, it has to be under terr_dif
  618. DO ji = kideb , kiut
  619. t_su_1d(ji) = MAX( MIN( t_su_1d(ji) , rt0 ) , 190._wp )
  620. zerrit(ji) = ABS( t_su_1d(ji) - ztsubit(ji) )
  621. END DO
  622. DO jk = 1, nlay_s
  623. DO ji = kideb , kiut
  624. t_s_1d(ji,jk) = MAX( MIN( t_s_1d(ji,jk), rt0 ), 190._wp )
  625. zerrit(ji) = MAX( zerrit(ji), ABS( t_s_1d(ji,jk) - ztstemp(ji,jk) ) )
  626. END DO
  627. END DO
  628. DO jk = 1, nlay_i
  629. DO ji = kideb , kiut
  630. ztmelt_i = -tmut * s_i_1d(ji,jk) + rt0
  631. t_i_1d(ji,jk) = MAX( MIN( t_i_1d(ji,jk), ztmelt_i ), 190._wp )
  632. zerrit(ji) = MAX( zerrit(ji), ABS( t_i_1d(ji,jk) - ztitemp(ji,jk) ) )
  633. END DO
  634. END DO
  635. ! Compute spatial maximum over all errors
  636. ! note that this could be optimized substantially by iterating only the non-converging points
  637. zerritmax = 0._wp
  638. DO ji = kideb, kiut
  639. zerritmax = MAX( zerritmax, zerrit(ji) )
  640. END DO
  641. IF( lk_mpp ) CALL mpp_max( zerritmax, kcom=ncomm_ice )
  642. END DO ! End of the do while iterative procedure
  643. IF( ln_icectl .AND. lwp ) THEN
  644. WRITE(numout,*) ' zerritmax : ', zerritmax
  645. WRITE(numout,*) ' nconv : ', nconv
  646. ENDIF
  647. !
  648. !-------------------------------------------------------------------------!
  649. ! 12) Fluxes at the interfaces !
  650. !-------------------------------------------------------------------------!
  651. DO ji = kideb, kiut
  652. ! ! surface ice conduction flux
  653. isnow(ji) = 1._wp - MAX( 0._wp, SIGN( 1._wp, -ht_s_1d(ji) ) )
  654. fc_su(ji) = - isnow(ji) * zkappa_s(ji,0) * zg1s * (t_s_1d(ji,1) - t_su_1d(ji)) &
  655. & - ( 1._wp - isnow(ji) ) * zkappa_i(ji,0) * zg1 * (t_i_1d(ji,1) - t_su_1d(ji))
  656. ! ! bottom ice conduction flux
  657. fc_bo_i(ji) = - zkappa_i(ji,nlay_i) * ( zg1*(t_bo_1d(ji) - t_i_1d(ji,nlay_i)) )
  658. END DO
  659. ! --- computes sea ice energy of melting compulsory for limthd_dh --- !
  660. CALL lim_thd_enmelt( kideb, kiut )
  661. ! --- diagnose the change in non-solar flux due to surface temperature change --- !
  662. IF ( ln_it_qnsice ) THEN
  663. DO ji = kideb, kiut
  664. hfx_err_dif_1d(ji) = hfx_err_dif_1d(ji) - ( qns_ice_1d(ji) - zqns_ice_b(ji) ) * a_i_1d(ji)
  665. END DO
  666. END IF
  667. ! --- diag conservation imbalance on heat diffusion - PART 2 --- !
  668. DO ji = kideb, kiut
  669. zdq(ji) = - zq_ini(ji) + ( SUM( q_i_1d(ji,1:nlay_i) ) * ht_i_1d(ji) * r1_nlay_i + &
  670. & SUM( q_s_1d(ji,1:nlay_s) ) * ht_s_1d(ji) * r1_nlay_s )
  671. IF( t_su_1d(ji) < rt0 ) THEN ! case T_su < 0degC
  672. zhfx_err(ji) = qns_ice_1d(ji) + qsr_ice_1d(ji) - zradtr_i(ji,nlay_i) - fc_bo_i(ji) + zdq(ji) * r1_rdtice
  673. ELSE ! case T_su = 0degC
  674. zhfx_err(ji) = fc_su(ji) + i0(ji) * qsr_ice_1d(ji) - zradtr_i(ji,nlay_i) - fc_bo_i(ji) + zdq(ji) * r1_rdtice
  675. ENDIF
  676. hfx_err_1d(ji) = hfx_err_1d(ji) + zhfx_err(ji) * a_i_1d(ji)
  677. ! total heat that is sent to the ocean (i.e. not used in the heat diffusion equation)
  678. hfx_err_dif_1d(ji) = hfx_err_dif_1d(ji) + zhfx_err(ji) * a_i_1d(ji)
  679. END DO
  680. !-----------------------------------------
  681. ! Heat flux used to warm/cool ice in W.m-2
  682. !-----------------------------------------
  683. DO ji = kideb, kiut
  684. IF( t_su_1d(ji) < rt0 ) THEN ! case T_su < 0degC
  685. hfx_dif_1d(ji) = hfx_dif_1d(ji) + &
  686. & ( qns_ice_1d(ji) + qsr_ice_1d(ji) - zradtr_i(ji,nlay_i) - fc_bo_i(ji) ) * a_i_1d(ji)
  687. ELSE ! case T_su = 0degC
  688. hfx_dif_1d(ji) = hfx_dif_1d(ji) + &
  689. & ( fc_su(ji) + i0(ji) * qsr_ice_1d(ji) - zradtr_i(ji,nlay_i) - fc_bo_i(ji) ) * a_i_1d(ji)
  690. ENDIF
  691. ! correction on the diagnosed heat flux due to non-convergence of the algorithm used to solve heat equation
  692. hfx_dif_1d(ji) = hfx_dif_1d(ji) - zhfx_err(ji) * a_i_1d(ji)
  693. END DO
  694. !
  695. CALL wrk_dealloc( jpij, numeqmin, numeqmax )
  696. CALL wrk_dealloc( jpij, isnow, ztsub, ztsubit, zh_i, zh_s, zfsw )
  697. CALL wrk_dealloc( jpij, zf, dzf, zqns_ice_b, zerrit, zdifcase, zftrice, zihic, zghe )
  698. CALL wrk_dealloc( jpij,nlay_i+1, ztcond_i, zradtr_i, zradab_i, zkappa_i, ztib, zeta_i, ztitemp, z_i, zspeche_i, kjstart = 0 )
  699. CALL wrk_dealloc( jpij,nlay_s+1, zradtr_s, zradab_s, zkappa_s, ztsb, zeta_s, ztstemp, z_s, kjstart = 0 )
  700. CALL wrk_dealloc( jpij,nlay_i+3, zindterm, zindtbis, zdiagbis )
  701. CALL wrk_dealloc( jpij,nlay_i+3,3, ztrid )
  702. CALL wrk_dealloc( jpij, zdq, zq_ini, zhfx_err )
  703. END SUBROUTINE lim_thd_dif
  704. SUBROUTINE lim_thd_enmelt( kideb, kiut )
  705. !!-----------------------------------------------------------------------
  706. !! *** ROUTINE lim_thd_enmelt ***
  707. !!
  708. !! ** Purpose : Computes sea ice energy of melting q_i (J.m-3) from temperature
  709. !!
  710. !! ** Method : Formula (Bitz and Lipscomb, 1999)
  711. !!-------------------------------------------------------------------
  712. INTEGER, INTENT(in) :: kideb, kiut ! bounds for the spatial loop
  713. !
  714. INTEGER :: ji, jk ! dummy loop indices
  715. REAL(wp) :: ztmelts ! local scalar
  716. !!-------------------------------------------------------------------
  717. !
  718. DO jk = 1, nlay_i ! Sea ice energy of melting
  719. DO ji = kideb, kiut
  720. ztmelts = - tmut * s_i_1d(ji,jk) + rt0
  721. t_i_1d(ji,jk) = MIN( t_i_1d(ji,jk), ztmelts ) ! Force t_i_1d to be lower than melting point
  722. ! (sometimes dif scheme produces abnormally high temperatures)
  723. q_i_1d(ji,jk) = rhoic * ( cpic * ( ztmelts - t_i_1d(ji,jk) ) &
  724. & + lfus * ( 1.0 - ( ztmelts-rt0 ) / ( t_i_1d(ji,jk) - rt0 ) ) &
  725. & - rcp * ( ztmelts-rt0 ) )
  726. END DO
  727. END DO
  728. DO jk = 1, nlay_s ! Snow energy of melting
  729. DO ji = kideb, kiut
  730. q_s_1d(ji,jk) = rhosn * ( cpic * ( rt0 - t_s_1d(ji,jk) ) + lfus )
  731. END DO
  732. END DO
  733. !
  734. END SUBROUTINE lim_thd_enmelt
  735. #else
  736. !!----------------------------------------------------------------------
  737. !! Dummy Module No LIM-3 sea-ice model
  738. !!----------------------------------------------------------------------
  739. CONTAINS
  740. SUBROUTINE lim_thd_dif ! Empty routine
  741. END SUBROUTINE lim_thd_dif
  742. #endif
  743. !!======================================================================
  744. END MODULE limthd_dif