New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
icethd_lac.F90 in branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icethd_lac.F90 @ 8514

Last change on this file since 8514 was 8514, checked in by clem, 7 years ago

changes in style - part5 - almost done

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