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.
limthd_lac.F90 in NEMO/releases/release-3.6/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: NEMO/releases/release-3.6/NEMOGCM/NEMO/LIM_SRC_3/limthd_lac.F90 @ 10379

Last change on this file since 10379 was 6316, checked in by cetlod, 8 years ago

3.6 stable : new realistic calculation of sea-ice albedo ( we keep the existing one ), see ticket #1678

  • Property svn:keywords set to Id
File size: 25.0 KB
Line 
1MODULE 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
35   IMPLICIT NONE
36   PRIVATE
37
38   PUBLIC lim_thd_lac     ! called by lim_thd
39
40   !!----------------------------------------------------------------------
41   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
42   !! $Id$
43   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45CONTAINS
46
47   SUBROUTINE lim_thd_lac
48      !!-------------------------------------------------------------------
49      !!               ***   ROUTINE lim_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 frldb 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 ::   nbpac            ! local integers
75      INTEGER ::   ii, ij, iter     !   -       -
76      REAL(wp)  ::   ztmelts, zdv, zfrazb, zweight, zde                         ! local scalars
77      REAL(wp) ::   zgamafr, zvfrx, zvgx, ztaux, ztwogp, zf                     !   -      -
78      REAL(wp) ::   ztenagm, zvfry, zvgy, ztauy, zvrel2, zfp, zsqcd , zhicrit   !   -      -
79      CHARACTER (len = 15) :: fieldid
80
81      REAL(wp) ::   zQm          ! enthalpy exchanged with the ocean (J/m2, >0 towards ocean)
82      REAL(wp) ::   zEi          ! sea ice specific enthalpy (J/kg)
83      REAL(wp) ::   zEw          ! seawater specific enthalpy (J/kg)
84      REAL(wp) ::   zfmdt        ! mass flux x time step (kg/m2, >0 towards ocean)
85     
86      REAL(wp) ::   zv_newfra
87 
88      INTEGER , POINTER, DIMENSION(:) ::   jcat        ! indexes of categories where new ice grows
89      REAL(wp), POINTER, DIMENSION(:) ::   zswinew     ! switch for new ice or not
90
91      REAL(wp), POINTER, DIMENSION(:) ::   zv_newice   ! volume of accreted ice
92      REAL(wp), POINTER, DIMENSION(:) ::   za_newice   ! fractional area of accreted ice
93      REAL(wp), POINTER, DIMENSION(:) ::   zh_newice   ! thickness of accreted ice
94      REAL(wp), POINTER, DIMENSION(:) ::   ze_newice   ! heat content of accreted ice
95      REAL(wp), POINTER, DIMENSION(:) ::   zs_newice   ! salinity of accreted ice
96      REAL(wp), POINTER, DIMENSION(:) ::   zo_newice   ! age of accreted ice
97      REAL(wp), POINTER, DIMENSION(:) ::   zdv_res     ! residual volume in case of excessive heat budget
98      REAL(wp), POINTER, DIMENSION(:) ::   zda_res     ! residual area in case of excessive heat budget
99      REAL(wp), POINTER, DIMENSION(:) ::   zat_i_1d    ! total ice fraction   
100      REAL(wp), POINTER, DIMENSION(:) ::   zv_frazb    ! accretion of frazil ice at the ice bottom
101      REAL(wp), POINTER, DIMENSION(:) ::   zvrel_1d    ! relative ice / frazil velocity (1D vector)
102
103      REAL(wp), POINTER, DIMENSION(:,:) ::   zv_b      ! old volume of ice in category jl
104      REAL(wp), POINTER, DIMENSION(:,:) ::   za_b      ! old area of ice in category jl
105      REAL(wp), POINTER, DIMENSION(:,:) ::   za_i_1d   ! 1-D version of a_i
106      REAL(wp), POINTER, DIMENSION(:,:) ::   zv_i_1d   ! 1-D version of v_i
107      REAL(wp), POINTER, DIMENSION(:,:) ::   zsmv_i_1d ! 1-D version of smv_i
108
109      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ze_i_1d !: 1-D version of e_i
110
111      REAL(wp), POINTER, DIMENSION(:,:) ::   zvrel     ! relative ice / frazil velocity
112
113      REAL(wp) :: zcai = 1.4e-3_wp                     ! ice-air drag (clem: should be dependent on coupling/forcing used)
114      !!-----------------------------------------------------------------------!
115
116      CALL wrk_alloc( jpij, jcat )   ! integer
117      CALL wrk_alloc( jpij, zswinew, zv_newice, za_newice, zh_newice, ze_newice, zs_newice, zo_newice )
118      CALL wrk_alloc( jpij, zdv_res, zda_res, zat_i_1d, zv_frazb, zvrel_1d )
119      CALL wrk_alloc( jpij,jpl, zv_b, za_b, za_i_1d, zv_i_1d, zsmv_i_1d )
120      CALL wrk_alloc( jpij,nlay_i,jpl, ze_i_1d )
121      CALL wrk_alloc( jpi,jpj, zvrel )
122
123      CALL lim_var_agg(1)
124      CALL lim_var_glo2eqv
125      !------------------------------------------------------------------------------|
126      ! 2) Convert units for ice internal energy
127      !------------------------------------------------------------------------------|
128      DO jl = 1, jpl
129         DO jk = 1, nlay_i
130            DO jj = 1, jpj
131               DO ji = 1, jpi
132                  !Energy of melting q(S,T) [J.m-3]
133                  rswitch          = MAX(  0._wp , SIGN( 1._wp , v_i(ji,jj,jl) - epsi20 )  )   !0 if no ice
134                  e_i(ji,jj,jk,jl) = rswitch * e_i(ji,jj,jk,jl) / MAX( v_i(ji,jj,jl), epsi20 ) * REAL( nlay_i, wp )
135               END DO
136            END DO
137         END DO
138      END DO
139
140      !------------------------------------------------------------------------------!
141      ! 3) Collection thickness of ice formed in leads and polynyas
142      !------------------------------------------------------------------------------!   
143      ! hicol is the thickness of new ice formed in open water
144      ! hicol can be either prescribed (frazswi = 0) or computed (frazswi = 1)
145      ! Frazil ice forms in open water, is transported by wind
146      ! accumulates at the edge of the consolidated ice edge
147      ! where it forms aggregates of a specific thickness called
148      ! collection thickness.
149
150      ! Note : the following algorithm currently breaks vectorization
151      !
152
153      zvrel(:,:) = 0._wp
154
155      ! Default new ice thickness
156      WHERE( qlead(:,:) < 0._wp ) ; hicol = rn_hnewice
157      ELSEWHERE                   ; hicol = 0._wp
158      END WHERE
159
160      IF( ln_frazil ) THEN
161
162         !--------------------
163         ! Physical constants
164         !--------------------
165         hicol(:,:) = 0._wp
166
167         zhicrit = 0.04 ! frazil ice thickness
168         ztwogp  = 2. * rau0 / ( grav * 0.3 * ( rau0 - rhoic ) ) ! reduced grav
169         zsqcd   = 1.0 / SQRT( 1.3 * zcai ) ! 1/SQRT(airdensity*drag)
170         zgamafr = 0.03
171
172         DO jj = 2, jpj
173            DO ji = 2, jpi
174               IF ( qlead(ji,jj) < 0._wp ) THEN
175                  !-------------
176                  ! Wind stress
177                  !-------------
178                  ! C-grid wind stress components
179                  ztaux         = ( utau_ice(ji-1,jj  ) * umask(ji-1,jj  ,1)   &
180                     &          +   utau_ice(ji  ,jj  ) * umask(ji  ,jj  ,1) ) * 0.5_wp
181                  ztauy         = ( vtau_ice(ji  ,jj-1) * vmask(ji  ,jj-1,1)   &
182                     &          +   vtau_ice(ji  ,jj  ) * vmask(ji  ,jj  ,1) ) * 0.5_wp
183                  ! Square root of wind stress
184                  ztenagm       =  SQRT( SQRT( ztaux * ztaux + ztauy * ztauy ) )
185
186                  !---------------------
187                  ! Frazil ice velocity
188                  !---------------------
189                  rswitch = MAX( 0._wp, SIGN( 1._wp , ztenagm - epsi10 ) )
190                  zvfrx   = rswitch * zgamafr * zsqcd * ztaux / MAX( ztenagm, epsi10 )
191                  zvfry   = rswitch * zgamafr * zsqcd * ztauy / MAX( ztenagm, epsi10 )
192
193                  !-------------------
194                  ! Pack ice velocity
195                  !-------------------
196                  ! C-grid ice velocity
197                  rswitch = MAX(  0._wp, SIGN( 1._wp , at_i(ji,jj) )  )
198                  zvgx    = rswitch * ( u_ice(ji-1,jj  ) * umask(ji-1,jj  ,1)  + u_ice(ji,jj) * umask(ji,jj,1) ) * 0.5_wp
199                  zvgy    = rswitch * ( v_ice(ji  ,jj-1) * vmask(ji  ,jj-1,1)  + v_ice(ji,jj) * vmask(ji,jj,1) ) * 0.5_wp
200
201                  !-----------------------------------
202                  ! Relative frazil/pack ice velocity
203                  !-----------------------------------
204                  ! absolute relative velocity
205                  zvrel2 = MAX(  ( zvfrx - zvgx ) * ( zvfrx - zvgx )   &
206                     &         + ( zvfry - zvgy ) * ( zvfry - zvgy ) , 0.15 * 0.15 )
207                  zvrel(ji,jj) = SQRT( zvrel2 )
208
209                  !---------------------
210                  ! Iterative procedure
211                  !---------------------
212                  hicol(ji,jj) = zhicrit +   ( zhicrit + 0.1 )    &
213                     &                   / ( ( zhicrit + 0.1 ) * ( zhicrit + 0.1 ) -  zhicrit * zhicrit ) * ztwogp * zvrel2
214
215                  iter = 1
216                  DO WHILE ( iter < 20 ) 
217                     zf  = ( hicol(ji,jj) - zhicrit ) * ( hicol(ji,jj) * hicol(ji,jj) - zhicrit * zhicrit ) -   &
218                        &    hicol(ji,jj) * zhicrit * ztwogp * zvrel2
219                     zfp = ( hicol(ji,jj) - zhicrit ) * ( 3.0 * hicol(ji,jj) + zhicrit ) - zhicrit * ztwogp * zvrel2
220
221                     hicol(ji,jj) = hicol(ji,jj) - zf/zfp
222                     iter = iter + 1
223                  END DO
224
225               ENDIF ! end of selection of pixels where ice forms
226
227            END DO
228         END DO 
229         !
230         CALL lbc_lnk( zvrel(:,:), 'T', 1. )
231         CALL lbc_lnk( hicol(:,:), 'T', 1. )
232
233      ENDIF ! End of computation of frazil ice collection thickness
234
235      !------------------------------------------------------------------------------!
236      ! 4) Identify grid points where new ice forms
237      !------------------------------------------------------------------------------!
238
239      !-------------------------------------
240      ! Select points for new ice formation
241      !-------------------------------------
242      ! This occurs if open water energy budget is negative
243      nbpac = 0
244      npac(:) = 0
245      !
246      DO jj = 1, jpj
247         DO ji = 1, jpi
248            IF ( qlead(ji,jj)  <  0._wp ) THEN
249               nbpac = nbpac + 1
250               npac( nbpac ) = (jj - 1) * jpi + ji
251            ENDIF
252         END DO
253      END DO
254
255      ! debug point to follow
256      jiindex_1d = 0
257      IF( ln_icectl ) THEN
258         DO ji = mi0(iiceprt), mi1(iiceprt)
259            DO jj = mj0(jiceprt), mj1(jiceprt)
260               IF ( qlead(ji,jj)  <  0._wp ) THEN
261                  jiindex_1d = (jj - 1) * jpi + ji
262               ENDIF
263            END DO
264         END DO
265      ENDIF
266   
267      IF( ln_icectl ) WRITE(numout,*) 'lim_thd_lac : nbpac = ', nbpac
268
269      !------------------------------
270      ! Move from 2-D to 1-D vectors
271      !------------------------------
272      ! If ocean gains heat do nothing. Otherwise compute new ice formation
273
274      IF ( nbpac > 0 ) THEN
275
276         CALL tab_2d_1d( nbpac, zat_i_1d  (1:nbpac)     , at_i         , jpi, jpj, npac(1:nbpac) )
277         DO jl = 1, jpl
278            CALL tab_2d_1d( nbpac, za_i_1d  (1:nbpac,jl), a_i  (:,:,jl), jpi, jpj, npac(1:nbpac) )
279            CALL tab_2d_1d( nbpac, zv_i_1d  (1:nbpac,jl), v_i  (:,:,jl), jpi, jpj, npac(1:nbpac) )
280            CALL tab_2d_1d( nbpac, zsmv_i_1d(1:nbpac,jl), smv_i(:,:,jl), jpi, jpj, npac(1:nbpac) )
281            DO jk = 1, nlay_i
282               CALL tab_2d_1d( nbpac, ze_i_1d(1:nbpac,jk,jl), e_i(:,:,jk,jl) , jpi, jpj, npac(1:nbpac) )
283            END DO
284         END DO
285
286         CALL tab_2d_1d( nbpac, qlead_1d  (1:nbpac)     , qlead     , jpi, jpj, npac(1:nbpac) )
287         CALL tab_2d_1d( nbpac, t_bo_1d   (1:nbpac)     , t_bo      , jpi, jpj, npac(1:nbpac) )
288         CALL tab_2d_1d( nbpac, sfx_opw_1d(1:nbpac)     , sfx_opw   , jpi, jpj, npac(1:nbpac) )
289         CALL tab_2d_1d( nbpac, wfx_opw_1d(1:nbpac)     , wfx_opw   , jpi, jpj, npac(1:nbpac) )
290         CALL tab_2d_1d( nbpac, hicol_1d  (1:nbpac)     , hicol     , jpi, jpj, npac(1:nbpac) )
291         CALL tab_2d_1d( nbpac, zvrel_1d  (1:nbpac)     , zvrel     , jpi, jpj, npac(1:nbpac) )
292
293         CALL tab_2d_1d( nbpac, hfx_thd_1d(1:nbpac)     , hfx_thd   , jpi, jpj, npac(1:nbpac) )
294         CALL tab_2d_1d( nbpac, hfx_opw_1d(1:nbpac)     , hfx_opw   , jpi, jpj, npac(1:nbpac) )
295         CALL tab_2d_1d( nbpac, rn_amax_1d(1:nbpac)     , rn_amax_2d, jpi, jpj, npac(1:nbpac) )
296
297         !------------------------------------------------------------------------------!
298         ! 5) Compute thickness, salinity, enthalpy, age, area and volume of new ice
299         !------------------------------------------------------------------------------!
300
301         !-----------------------------------------
302         ! Keep old ice areas and volume in memory
303         !-----------------------------------------
304         zv_b(1:nbpac,:) = zv_i_1d(1:nbpac,:) 
305         za_b(1:nbpac,:) = za_i_1d(1:nbpac,:)
306
307         !----------------------
308         ! Thickness of new ice
309         !----------------------
310         zh_newice(1:nbpac) = hicol_1d(1:nbpac)
311
312         !----------------------
313         ! Salinity of new ice
314         !----------------------
315         SELECT CASE ( nn_icesal )
316         CASE ( 1 )                    ! Sice = constant
317            zs_newice(1:nbpac) = rn_icesal
318         CASE ( 2 )                    ! Sice = F(z,t) [Vancoppenolle et al (2005)]
319            DO ji = 1, nbpac
320               ii =   MOD( npac(ji) - 1 , jpi ) + 1
321               ij =      ( npac(ji) - 1 ) / jpi + 1
322               zs_newice(ji) = MIN(  4.606 + 0.91 / zh_newice(ji) , rn_simax , 0.5 * sss_m(ii,ij)  )
323            END DO
324         CASE ( 3 )                    ! Sice = F(z) [multiyear ice]
325            zs_newice(1:nbpac) =   2.3
326         END SELECT
327
328         !-------------------------
329         ! Heat content of new ice
330         !-------------------------
331         ! We assume that new ice is formed at the seawater freezing point
332         DO ji = 1, nbpac
333            ztmelts       = - tmut * zs_newice(ji) + rt0                  ! Melting point (K)
334            ze_newice(ji) =   rhoic * (  cpic * ( ztmelts - t_bo_1d(ji) )                             &
335               &                       + lfus * ( 1.0 - ( ztmelts - rt0 ) / MIN( t_bo_1d(ji) - rt0, -epsi10 ) )   &
336               &                       - rcp  *         ( ztmelts - rt0 )  )
337         END DO
338
339         !----------------
340         ! Age of new ice
341         !----------------
342         DO ji = 1, nbpac
343            zo_newice(ji) = 0._wp
344         END DO
345
346         !-------------------
347         ! Volume of new ice
348         !-------------------
349         DO ji = 1, nbpac
350
351            zEi           = - ze_newice(ji) * r1_rhoic             ! specific enthalpy of forming ice [J/kg]
352
353            zEw           = rcp * ( t_bo_1d(ji) - rt0 )            ! specific enthalpy of seawater at t_bo_1d [J/kg]
354                                                                   ! clem: we suppose we are already at the freezing point (condition qlead<0 is satisfyied)
355                                                                   
356            zdE           = zEi - zEw                              ! specific enthalpy difference [J/kg]
357                                             
358            zfmdt         = - qlead_1d(ji) / zdE                   ! Fm.dt [kg/m2] (<0)
359                                                                   ! clem: we use qlead instead of zqld (limthd) because we suppose we are at the freezing point   
360            zv_newice(ji) = - zfmdt * r1_rhoic
361
362            zQm           = zfmdt * zEw                            ! heat to the ocean >0 associated with mass flux 
363
364            ! Contribution to heat flux to the ocean [W.m-2], >0 
365            hfx_thd_1d(ji) = hfx_thd_1d(ji) + zfmdt * zEw * r1_rdtice
366            ! Total heat flux used in this process [W.m-2] 
367            hfx_opw_1d(ji) = hfx_opw_1d(ji) - zfmdt * zdE * r1_rdtice
368            ! mass flux
369            wfx_opw_1d(ji) = wfx_opw_1d(ji) - zv_newice(ji) * rhoic * r1_rdtice
370            ! salt flux
371            sfx_opw_1d(ji) = sfx_opw_1d(ji) - zv_newice(ji) * rhoic * zs_newice(ji) * r1_rdtice
372         END DO
373         
374         zv_frazb(:) = 0._wp
375         IF( ln_frazil ) THEN
376            ! A fraction zfrazb of frazil ice is accreted at the ice bottom
377            DO ji = 1, nbpac
378               rswitch       = 1._wp - MAX( 0._wp, SIGN( 1._wp , - zat_i_1d(ji) ) )
379               zfrazb        = rswitch * ( TANH( rn_Cfrazb * ( zvrel_1d(ji) - rn_vfrazb ) ) + 1.0 ) * 0.5 * rn_maxfrazb
380               zv_frazb(ji)  =         zfrazb   * zv_newice(ji)
381               zv_newice(ji) = ( 1.0 - zfrazb ) * zv_newice(ji)
382            END DO
383         END IF
384         
385         !-----------------
386         ! Area of new ice
387         !-----------------
388         DO ji = 1, nbpac
389            za_newice(ji) = zv_newice(ji) / zh_newice(ji)
390         END DO
391
392         !------------------------------------------------------------------------------!
393         ! 6) Redistribute new ice area and volume into ice categories                  !
394         !------------------------------------------------------------------------------!
395
396         !------------------------
397         ! 6.1) lateral ice growth
398         !------------------------
399         ! If lateral ice growth gives an ice concentration gt 1, then
400         ! we keep the excessive volume in memory and attribute it later to bottom accretion
401         DO ji = 1, nbpac
402            IF ( za_newice(ji) >  ( rn_amax_1d(ji) - zat_i_1d(ji) ) ) THEN
403               zda_res(ji)   = za_newice(ji) - ( rn_amax_1d(ji) - zat_i_1d(ji) )
404               zdv_res(ji)   = zda_res  (ji) * zh_newice(ji) 
405               za_newice(ji) = za_newice(ji) - zda_res  (ji)
406               zv_newice(ji) = zv_newice(ji) - zdv_res  (ji)
407            ELSE
408               zda_res(ji) = 0._wp
409               zdv_res(ji) = 0._wp
410            ENDIF
411         END DO
412
413         ! find which category to fill
414         zat_i_1d(:) = 0._wp
415         DO jl = 1, jpl
416            DO ji = 1, nbpac
417               IF( zh_newice(ji) > hi_max(jl-1) .AND. zh_newice(ji) <= hi_max(jl) ) THEN
418                  za_i_1d (ji,jl) = za_i_1d (ji,jl) + za_newice(ji)
419                  zv_i_1d (ji,jl) = zv_i_1d (ji,jl) + zv_newice(ji)
420                  jcat    (ji)    = jl
421               ENDIF
422               zat_i_1d(ji) = zat_i_1d(ji) + za_i_1d  (ji,jl)
423            END DO
424         END DO
425
426         ! Heat content
427         DO ji = 1, nbpac
428            jl = jcat(ji)                                                    ! categroy in which new ice is put
429            zswinew  (ji) = MAX( 0._wp , SIGN( 1._wp , - za_b(ji,jl) ) )   ! 0 if old ice
430         END DO
431
432         DO jk = 1, nlay_i
433            DO ji = 1, nbpac
434               jl = jcat(ji)
435               rswitch = MAX( 0._wp, SIGN( 1._wp , zv_i_1d(ji,jl) - epsi20 ) )
436               ze_i_1d(ji,jk,jl) = zswinew(ji)   *   ze_newice(ji) +                                                    &
437                  &        ( 1.0 - zswinew(ji) ) * ( ze_newice(ji) * zv_newice(ji) + ze_i_1d(ji,jk,jl) * zv_b(ji,jl) )  &
438                  &        * rswitch / MAX( zv_i_1d(ji,jl), epsi20 )
439            END DO
440         END DO
441
442         !------------------------------------------------
443         ! 6.2) bottom ice growth + ice enthalpy remapping
444         !------------------------------------------------
445         DO jl = 1, jpl
446
447            ! for remapping
448            h_i_old (1:nbpac,0:nlay_i+1) = 0._wp
449            qh_i_old(1:nbpac,0:nlay_i+1) = 0._wp
450            DO jk = 1, nlay_i
451               DO ji = 1, nbpac
452                  h_i_old (ji,jk) = zv_i_1d(ji,jl) * r1_nlay_i
453                  qh_i_old(ji,jk) = ze_i_1d(ji,jk,jl) * h_i_old(ji,jk)
454               END DO
455            END DO
456
457            ! new volumes including lateral/bottom accretion + residual
458            DO ji = 1, nbpac
459               rswitch        = MAX( 0._wp, SIGN( 1._wp , zat_i_1d(ji) - epsi20 ) )
460               zv_newfra      = rswitch * ( zdv_res(ji) + zv_frazb(ji) ) * za_i_1d(ji,jl) / MAX( zat_i_1d(ji) , epsi20 )
461               za_i_1d(ji,jl) = rswitch * za_i_1d(ji,jl)               
462               zv_i_1d(ji,jl) = zv_i_1d(ji,jl) + zv_newfra
463               ! for remapping
464               h_i_old (ji,nlay_i+1) = zv_newfra
465               qh_i_old(ji,nlay_i+1) = ze_newice(ji) * zv_newfra
466            ENDDO
467            ! --- Ice enthalpy remapping --- !
468            CALL lim_thd_ent( 1, nbpac, ze_i_1d(1:nbpac,:,jl) ) 
469         ENDDO
470
471         !-----------------
472         ! Update salinity
473         !-----------------
474         DO jl = 1, jpl
475            DO ji = 1, nbpac
476               zdv   = zv_i_1d(ji,jl) - zv_b(ji,jl)
477               zsmv_i_1d(ji,jl) = zsmv_i_1d(ji,jl) + zdv * zs_newice(ji)
478            END DO
479         END DO
480
481         !------------------------------------------------------------------------------!
482         ! 7) Change 2D vectors to 1D vectors
483         !------------------------------------------------------------------------------!
484         DO jl = 1, jpl
485            CALL tab_1d_2d( nbpac, a_i (:,:,jl), npac(1:nbpac), za_i_1d (1:nbpac,jl), jpi, jpj )
486            CALL tab_1d_2d( nbpac, v_i (:,:,jl), npac(1:nbpac), zv_i_1d (1:nbpac,jl), jpi, jpj )
487            CALL tab_1d_2d( nbpac, smv_i (:,:,jl), npac(1:nbpac), zsmv_i_1d(1:nbpac,jl) , jpi, jpj )
488            DO jk = 1, nlay_i
489               CALL tab_1d_2d( nbpac, e_i(:,:,jk,jl), npac(1:nbpac), ze_i_1d(1:nbpac,jk,jl), jpi, jpj )
490            END DO
491         END DO
492         CALL tab_1d_2d( nbpac, sfx_opw, npac(1:nbpac), sfx_opw_1d(1:nbpac), jpi, jpj )
493         CALL tab_1d_2d( nbpac, wfx_opw, npac(1:nbpac), wfx_opw_1d(1:nbpac), jpi, jpj )
494
495         CALL tab_1d_2d( nbpac, hfx_thd, npac(1:nbpac), hfx_thd_1d(1:nbpac), jpi, jpj )
496         CALL tab_1d_2d( nbpac, hfx_opw, npac(1:nbpac), hfx_opw_1d(1:nbpac), jpi, jpj )
497         !
498      ENDIF ! nbpac > 0
499
500      !------------------------------------------------------------------------------!
501      ! 8) Change units for e_i
502      !------------------------------------------------------------------------------!   
503      DO jl = 1, jpl
504         DO jk = 1, nlay_i
505            DO jj = 1, jpj
506               DO ji = 1, jpi
507                  ! heat content in J/m2
508                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * v_i(ji,jj,jl) * r1_nlay_i 
509               END DO
510            END DO
511         END DO
512      END DO
513
514      !
515      CALL wrk_dealloc( jpij, jcat )   ! integer
516      CALL wrk_dealloc( jpij, zswinew, zv_newice, za_newice, zh_newice, ze_newice, zs_newice, zo_newice )
517      CALL wrk_dealloc( jpij, zdv_res, zda_res, zat_i_1d, zv_frazb, zvrel_1d )
518      CALL wrk_dealloc( jpij,jpl, zv_b, za_b, za_i_1d, zv_i_1d, zsmv_i_1d )
519      CALL wrk_dealloc( jpij,nlay_i,jpl, ze_i_1d )
520      CALL wrk_dealloc( jpi,jpj, zvrel )
521      !
522   END SUBROUTINE lim_thd_lac
523
524#else
525   !!----------------------------------------------------------------------
526   !!   Default option                               NO  LIM3 sea-ice model
527   !!----------------------------------------------------------------------
528CONTAINS
529   SUBROUTINE lim_thd_lac           ! Empty routine
530   END SUBROUTINE lim_thd_lac
531#endif
532
533   !!======================================================================
534END MODULE limthd_lac
Note: See TracBrowser for help on using the repository browser.