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 trunk/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: trunk/NEMOGCM/NEMO/LIM_SRC_3/limthd_lac.F90 @ 7813

Last change on this file since 7813 was 7753, checked in by mocavero, 7 years ago

Reverting trunk to remove OpenMP

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