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 @ 2524

Last change on this file since 2524 was 2477, checked in by cetlod, 13 years ago

v3.2:remove hardcoded value of num_sal in limrst.F90, see ticket #633

  • Property svn:keywords set to Id
File size: 34.3 KB
Line 
1MODULE limthd_lac
2   !!----------------------------------------------------------------------
3   !!   'key_lim3'                                      LIM3 sea-ice model
4   !!----------------------------------------------------------------------
5   !!======================================================================
6   !!                       ***  MODULE limthd_lac   ***
7   !!                lateral thermodynamic growth of the ice
8   !!======================================================================
9#if defined key_lim3
10   !!----------------------------------------------------------------------
11   !!   lim_lat_acr    : lateral accretion of ice
12   !! * Modules used
13   USE par_oce          ! ocean parameters
14   USE dom_oce
15   USE in_out_manager
16   USE phycst
17   USE sbc_oce         ! Surface boundary condition: ocean fields
18   USE sbc_ice         ! Surface boundary condition: ice fields
19   USE thd_ice
20   USE dom_ice
21   USE par_ice
22   USE ice
23   USE limtab
24   USE limcons
25
26   IMPLICIT NONE
27   PRIVATE
28
29   !! * Routine accessibility
30   PUBLIC lim_thd_lac     ! called by lim_thd
31
32   !! * Module variables
33   REAL(wp)  ::           &  ! constant values
34      epsi20 = 1.e-20  ,  &
35      epsi13 = 1.e-13  ,  &
36      epsi11 = 1.e-13  ,  &
37      epsi03 = 1.e-03  ,  &
38      epsi06 = 1.e-06  ,  &
39      zeps   = 1.e-10  ,  &
40      zzero  = 0.e0    ,  &
41      zone   = 1.e0
42
43   !!----------------------------------------------------------------------
44   !!   LIM 3.0,  UCL-ASTR-LOCEAN-IPSL (2008)
45   !! $Id$
46   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
47   !!----------------------------------------------------------------------
48
49CONTAINS
50
51   SUBROUTINE lim_thd_lac
52      !!-------------------------------------------------------------------
53      !!               ***   ROUTINE lim_thd_lac  ***
54      !! 
55      !! ** Purpose : Computation of the evolution of the ice thickness and
56      !!      concentration as a function of the heat balance in the leads.
57      !!      It is only used for lateral accretion
58      !!       
59      !! ** Method  : Ice is formed in the open water when ocean lose heat
60      !!      (heat budget of open water Bl is negative) .
61      !!      Computation of the increase of 1-A (ice concentration) fol-
62      !!      lowing the law :
63      !!      (dA/dt)acc = F[ (1-A)/(1-a) ] * [ Bl / (Li*h0) ]
64      !!       where - h0 is the thickness of ice created in the lead
65      !!             - a is a minimum fraction for leads
66      !!             - F is a monotonic non-increasing function defined as:
67      !!                  F(X)=( 1 - X**exld )**(1.0/exld)
68      !!             - exld is the exponent closure rate (=2 default val.)
69      !!
70      !! ** Action : - Adjustment of snow and ice thicknesses and heat
71      !!                content in brine pockets
72      !!             - Updating ice internal temperature
73      !!             - Computation of variation of ice volume and mass
74      !!             - Computation of frldb after lateral accretion and
75      !!               update ht_s_b, ht_i_b and tbif_1d(:,:)     
76      !!
77      !! ** References : Not available yet
78      !!
79      !! History :
80      !!   3.0  !  12-05 (M. Vancoppenolle)  Thorough rewrite of the routine
81      !!                                     Salinity variations in sea ice,
82      !!                                     Multi-layer code
83      !!   3.1  !  01-06 (M. Vancoppenolle)  ITD
84      !!   3.2  !  04-07 (M. Vancoppenolle)  Mass and energy conservation tested
85      !!------------------------------------------------------------------------
86      !! * Arguments
87      !! * Local variables
88      INTEGER ::             &
89         ji,jj,jk,jl,jm  ,   &  !: dummy loop indices
90         layer           ,   &  !: layer index
91         nbpac                  !: nb of pts for lateral accretion
92
93      INTEGER ::             &
94         zji             ,   &  !: ji of dummy test point
95         zjj             ,   &  !: jj of dummy test point
96         iter                   !: iteration for frazil ice computation
97
98      INTEGER, DIMENSION(jpij) :: &
99         zcatac          ,   &  !:  indexes of categories where new ice grows
100         zswinew                !: switch for new ice or not
101
102      REAL(wp), DIMENSION(jpij) :: &
103         zv_newice       ,   &  !: volume of accreted ice
104         za_newice       ,   &  !: fractional area of accreted ice
105         zh_newice       ,   &  !: thickness of accreted ice
106         ze_newice       ,   &  !: heat content of accreted ice
107         zs_newice       ,   &  !: salinity of accreted ice
108         zo_newice       ,   &  !: age of accreted ice
109         zdv_res         ,   &  !: residual volume in case of excessive heat budget
110         zda_res         ,   &  !: residual area in case of excessive heat budget
111         zat_i_ac        ,   &  !: total ice fraction   
112         zat_i_lev       ,   &  !: total ice fraction for level ice only (type 1)   
113         zdh_frazb       ,   &  !: accretion of frazil ice at the ice bottom
114         zvrel_ac               !: relative ice / frazil velocity (1D vector)
115
116      REAL(wp), DIMENSION(jpij,jpl) :: &
117         zhice_old       ,   &  !: previous ice thickness
118         zdummy          ,   &  !: dummy thickness of new ice
119         zdhicbot        ,   &  !: thickness of new ice which is accreted vertically
120         zv_old          ,   &  !: old volume of ice in category jl
121         za_old          ,   &  !: old area of ice in category jl
122         za_i_ac         ,   &  !: 1-D version of a_i
123         zv_i_ac         ,   &  !: 1-D version of v_i
124         zoa_i_ac        ,   &  !: 1-D version of oa_i
125         zsmv_i_ac              !: 1-D version of smv_i
126
127      REAL(wp), DIMENSION(jpij,jkmax,jpl) :: &
128         ze_i_ac                !: 1-D version of e_i
129
130      REAL(wp), DIMENSION(jpij) :: &
131         zqbgow          ,   &  !: heat budget of the open water (negative)
132         zdhex                  !: excessively thick accreted sea ice (hlead-hice)
133
134      REAL(wp)  ::           &
135         ztmelts         ,   &  !: melting point of an ice layer
136         zdv             ,   &  !: increase in ice volume in each category
137         zfrazb                 !: fraction of frazil ice accreted at the ice bottom
138
139      ! Redistribution of energy after bottom accretion
140      REAL(wp)  ::           &  !: Energy redistribution
141         zqold           ,   &  !: old ice enthalpy
142         zweight         ,   &  !: weight of redistribution
143         zeps6           ,   &  !: epsilon value
144         zalphai         ,   &  !: factor describing how old and new layers overlap each other [m]
145         zindb           
146
147      REAL(wp), DIMENSION(jpij,jkmax+1,jpl) :: &
148         zqm0            ,   &  !: old layer-system heat content
149         zthick0                !: old ice thickness
150
151      ! Frazil ice collection thickness
152      LOGICAL :: &              !: iterate frazil ice collection thickness
153         iterate_frazil
154
155      REAL(wp), DIMENSION(jpi,jpj) :: &
156         zvrel                  !: relative ice / frazil velocity
157
158      REAL(wp) ::            &
159         zgamafr          ,  &  !: mult. coeff. between frazil vel. and wind speed
160         ztenagm          ,  &  !: square root of wind stress
161         zvfrx            ,  &  !: x-component of frazil velocity
162         zvfry            ,  &  !: y-component of frazil velocity
163         zvgx             ,  &  !: x-component of ice velocity
164         zvgy             ,  &  !: y-component of ice velocity
165         ztaux            ,  &  !: x-component of wind stress
166         ztauy            ,  &  !: y-component of wind stress
167         ztwogp           ,  &  !: dummy factor including reduced gravity
168         zvrel2           ,  &  !: square of the relative ice-frazil velocity
169         zf               ,  &  !: F for Newton-Raphson procedure
170         zfp              ,  &  !: dF for Newton-Raphson procedure
171         zhicol_new       ,  &  !: updated collection thickness
172         zsqcd            ,  &  !: 1 / square root of ( airdensity * drag )
173         zhicrit                !: minimum thickness of frazil ice
174
175      ! Variables for energy conservation
176      REAL (wp), DIMENSION(jpi,jpj) :: &  !
177         vt_i_init, vt_i_final,   &  !  ice volume summed over categories
178         vt_s_init, vt_s_final,   &  !  snow volume summed over categories
179         et_i_init, et_i_final,   &  !  ice energy summed over categories
180         et_s_init                   !  snow energy summed over categories
181
182      REAL(wp) ::            &
183         zde                         ! :increment of energy in category jl
184
185      CHARACTER (len = 15) :: fieldid
186
187      !!-----------------------------------------------------------------------!
188
189      et_i_init(:,:) = 0.0
190      et_s_init(:,:) = 0.0
191      vt_i_init(:,:) = 0.0
192      vt_s_init(:,:) = 0.0
193      zeps6   = 1.0e-6
194
195      !------------------------------------------------------------------------------!
196      ! 1) Conservation check and changes in each ice category
197      !------------------------------------------------------------------------------!
198      IF ( con_i ) THEN
199         CALL lim_column_sum (jpl, v_i, vt_i_init)
200         CALL lim_column_sum (jpl, v_s, vt_s_init)
201         CALL lim_column_sum_energy (jpl, nlay_i, e_i, et_i_init)
202         CALL lim_column_sum (jpl,   e_s(:,:,1,:) , et_s_init)
203      ENDIF
204
205      !------------------------------------------------------------------------------|
206      ! 2) Convert units for ice internal energy
207      !------------------------------------------------------------------------------|
208      DO jl = 1, jpl
209         DO jk = 1, nlay_i
210            DO jj = 1, jpj
211               DO ji = 1, jpi
212                  !Energy of melting q(S,T) [J.m-3]
213                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / &
214                     MAX( area(ji,jj) * v_i(ji,jj,jl) ,  zeps ) * &
215                     nlay_i
216                  zindb      = 1.0-MAX(0.0,SIGN(1.0,-v_i(ji,jj,jl))) !0 if no ice and 1 if yes
217                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl)*unit_fac*zindb
218               END DO
219            END DO
220         END DO
221      END DO
222
223      !------------------------------------------------------------------------------!
224      ! 3) Collection thickness of ice formed in leads and polynyas
225      !------------------------------------------------------------------------------!   
226      ! hicol is the thickness of new ice formed in open water
227      ! hicol can be either prescribed (frazswi = 0)
228      ! or computed (frazswi = 1)
229      ! Frazil ice forms in open water, is transported by wind
230      ! accumulates at the edge of the consolidated ice edge
231      ! where it forms aggregates of a specific thickness called
232      ! collection thickness.
233
234      ! Note : the following algorithm currently breaks vectorization
235      !
236
237      zvrel(:,:) = 0.0
238
239      ! Default new ice thickness
240      DO jj = 1, jpj
241         DO ji = 1, jpi
242            hicol(ji,jj) = hiccrit(1)
243         END DO
244      END DO
245
246      IF (fraz_swi.eq.1.0) THEN
247
248         !--------------------
249         ! Physical constants
250         !--------------------
251         hicol(:,:) = 0.0
252
253         zhicrit = 0.04 ! frazil ice thickness
254         ztwogp  = 2. * rau0 / ( grav * 0.3 * ( rau0 - rhoic ) ) ! reduced grav
255         zsqcd   = 1.0 / SQRT( 1.3 * cai ) ! 1/SQRT(airdensity*drag)
256         zgamafr = 0.03
257
258         DO jj = 1, jpj
259            DO ji = 1, jpi
260
261               IF ( tms(ji,jj) * ( qcmif(ji,jj) - qldif(ji,jj) ) > 0.e0 ) THEN
262                  !-------------
263                  ! Wind stress
264                  !-------------
265                  ! C-grid wind stress components
266                  ztaux         = ( utau_ice(ji-1,jj  ) * tmu(ji-1,jj  ) &
267                     &          +   utau_ice(ji  ,jj  ) * tmu(ji  ,jj  ) ) / 2.0
268                  ztauy         = ( vtau_ice(ji  ,jj-1) * tmv(ji  ,jj-1) &
269                     &          +   vtau_ice(ji  ,jj  ) * tmv(ji  ,jj  ) ) / 2.0
270                  ! Square root of wind stress
271                  ztenagm       =  SQRT( SQRT( ztaux * ztaux + ztauy * ztauy ) )
272
273                  !---------------------
274                  ! Frazil ice velocity
275                  !---------------------
276                  zvfrx         = zgamafr * zsqcd * ztaux / MAX(ztenagm,zeps)
277                  zvfry         = zgamafr * zsqcd * ztauy / MAX(ztenagm,zeps)
278
279                  !-------------------
280                  ! Pack ice velocity
281                  !-------------------
282                  ! C-grid ice velocity
283                  zindb = MAX(0.0, SIGN(1.0, at_i(ji,jj) ))
284                  zvgx  = zindb * ( u_ice(ji-1,jj  ) * tmu(ji-1,jj  ) &
285                     + u_ice(ji,jj    ) * tmu(ji  ,jj  ) ) / 2.0
286                  zvgy  = zindb * ( v_ice(ji  ,jj-1) * tmv(ji  ,jj-1) &
287                     + v_ice(ji,jj    ) * tmv(ji  ,jj  ) ) / 2.0
288
289                  !-----------------------------------
290                  ! Relative frazil/pack ice velocity
291                  !-----------------------------------
292                  ! absolute relative velocity
293                  zvrel2        = MAX( ( zvfrx - zvgx ) * ( zvfrx - zvgx ) + &
294                     ( zvfry - zvgy ) * ( zvfry - zvgy )   &
295                     , 0.15 * 0.15 )
296                  zvrel(ji,jj)  = SQRT(zvrel2)
297
298                  !---------------------
299                  ! Iterative procedure
300                  !---------------------
301                  hicol(ji,jj) = zhicrit + 0.1 
302                  hicol(ji,jj) = zhicrit + hicol(ji,jj) /      & 
303                     ( hicol(ji,jj) * hicol(ji,jj) - &
304                     zhicrit * zhicrit ) * ztwogp * zvrel2
305
306                  iter = 1
307                  iterate_frazil = .true.
308
309                  DO WHILE ( iter .LT. 100 .AND. iterate_frazil ) 
310                     zf = ( hicol(ji,jj) - zhicrit ) * ( hicol(ji,jj)**2 - zhicrit**2 ) &
311                        - hicol(ji,jj) * zhicrit * ztwogp * zvrel2
312                     zfp = ( hicol(ji,jj) - zhicrit ) * ( 3.0*hicol(ji,jj) + zhicrit ) &
313                        - zhicrit * ztwogp * zvrel2
314                     zhicol_new = hicol(ji,jj) - zf/zfp
315                     hicol(ji,jj)   = zhicol_new
316
317                     iter = iter + 1
318
319                  END DO ! do while
320
321               ENDIF ! end of selection of pixels where ice forms
322
323            END DO ! loop on ji ends
324         END DO ! loop on jj ends
325
326      ENDIF ! End of computation of frazil ice collection thickness
327
328      !------------------------------------------------------------------------------!
329      ! 4) Identify grid points where new ice forms
330      !------------------------------------------------------------------------------!
331
332      !-------------------------------------
333      ! Select points for new ice formation
334      !-------------------------------------
335      ! This occurs if open water energy budget is negative
336      nbpac = 0
337      DO jj = 1, jpj
338         DO ji = 1, jpi
339            IF ( tms(ji,jj) * ( qcmif(ji,jj) - qldif(ji,jj) ) > 0.e0 ) THEN
340               nbpac = nbpac + 1
341               npac( nbpac ) = (jj - 1) * jpi + ji
342               IF ( (ji.eq.jiindx).AND.(jj.eq.jjindx) ) THEN
343                  jiindex_1d = nbpac
344               ENDIF
345            ENDIF
346         END DO
347      END DO
348
349      IF( ln_nicep ) THEN
350         WRITE(numout,*) 'lim_thd_lac : nbpac = ', nbpac
351      ENDIF
352
353      !------------------------------
354      ! Move from 2-D to 1-D vectors
355      !------------------------------
356      ! If ocean gains heat do nothing
357      ! 0therwise compute new ice formation
358
359      IF ( nbpac > 0 ) THEN
360
361         CALL tab_2d_1d( nbpac, zat_i_ac  (1:nbpac)     , at_i         ,       &
362            jpi, jpj, npac(1:nbpac) )
363         DO jl = 1, jpl
364            CALL tab_2d_1d( nbpac, za_i_ac(1:nbpac,jl)  , a_i(:,:,jl)  ,       &
365               jpi, jpj, npac(1:nbpac) )
366            CALL tab_2d_1d( nbpac, zv_i_ac(1:nbpac,jl)  , v_i(:,:,jl)  ,       &
367               jpi, jpj, npac(1:nbpac) )
368            CALL tab_2d_1d( nbpac, zoa_i_ac(1:nbpac,jl) , oa_i(:,:,jl) ,       &
369               jpi, jpj, npac(1:nbpac) )
370            CALL tab_2d_1d( nbpac, zsmv_i_ac(1:nbpac,jl), smv_i(:,:,jl),       &
371               jpi, jpj, npac(1:nbpac) )
372            DO jk = 1, nlay_i
373               CALL tab_2d_1d( nbpac, ze_i_ac(1:nbpac,jk,jl), e_i(:,:,jk,jl) , &
374                  jpi, jpj, npac(1:nbpac) )
375            END DO ! jk
376         END DO ! jl
377
378         CALL tab_2d_1d( nbpac, qldif_1d  (1:nbpac)     , qldif ,              &
379            jpi, jpj, npac(1:nbpac) )
380         CALL tab_2d_1d( nbpac, qcmif_1d  (1:nbpac)     , qcmif ,              &
381            jpi, jpj, npac(1:nbpac) )
382         CALL tab_2d_1d( nbpac, t_bo_b    (1:nbpac)     , t_bo  ,              &
383            jpi, jpj, npac(1:nbpac) )
384         CALL tab_2d_1d( nbpac, fseqv_1d  (1:nbpac)     , fseqv ,              &
385            jpi, jpj, npac(1:nbpac) )
386         CALL tab_2d_1d( nbpac, hicol_b   (1:nbpac)     , hicol ,              &
387            jpi, jpj, npac(1:nbpac) )
388         CALL tab_2d_1d( nbpac, zvrel_ac  (1:nbpac)     , zvrel ,              &
389            jpi, jpj, npac(1:nbpac) )
390
391         !------------------------------------------------------------------------------!
392         ! 5) Compute thickness, salinity, enthalpy, age, area and volume of new ice
393         !------------------------------------------------------------------------------!
394
395         !----------------------
396         ! Thickness of new ice
397         !----------------------
398         DO ji = 1, nbpac
399            zh_newice(ji)     = hiccrit(1)
400         END DO
401         IF ( fraz_swi .EQ. 1.0 ) zh_newice(:) = hicol_b(:)
402
403         !----------------------
404         ! Salinity of new ice
405         !----------------------
406
407         IF ( num_sal .EQ. 1 ) THEN
408            zs_newice(:)      =   bulk_sal
409         ENDIF ! num_sal
410
411         IF ( ( num_sal .EQ. 2 ) .OR. ( num_sal .EQ. 4 ) ) THEN
412
413            DO ji = 1, nbpac
414               zs_newice(ji)  =   MIN( 4.606 + 0.91 / zh_newice(ji) , s_i_max )
415               zji            =   MOD( npac(ji) - 1, jpi ) + 1
416               zjj            =   ( npac(ji) - 1 ) / jpi + 1
417               zs_newice(ji)  =   MIN( 0.5*sss_m(zji,zjj) , zs_newice(ji) )
418            END DO ! jl
419
420         ENDIF ! num_sal
421
422         IF ( num_sal .EQ. 3 ) THEN
423            zs_newice(:)      =   2.3
424         ENDIF ! num_sal
425
426         !-------------------------
427         ! Heat content of new ice
428         !-------------------------
429         ! We assume that new ice is formed at the seawater freezing point
430         DO ji = 1, nbpac
431            ztmelts           = - tmut * zs_newice(ji) + rtt ! Melting point (K)
432            ze_newice(ji)     =   rhoic * ( cpic * ( ztmelts - t_bo_b(ji) )    &
433               + lfus * ( 1.0 - ( ztmelts - rtt )   &
434               / ( t_bo_b(ji) - rtt ) )           &
435               - rcp * ( ztmelts-rtt ) )
436            ze_newice(ji)     =   MAX( ze_newice(ji) , 0.0 ) +                 &
437               MAX( 0.0 , SIGN( 1.0 , - ze_newice(ji) ) )   & 
438               * rhoic * lfus
439         END DO ! ji
440         !----------------
441         ! Age of new ice
442         !----------------
443         DO ji = 1, nbpac
444            zo_newice(ji)     = 0.0
445         END DO ! ji
446
447         !--------------------------
448         ! Open water energy budget
449         !--------------------------
450         DO ji = 1, nbpac
451            zqbgow(ji)        = qldif_1d(ji) - qcmif_1d(ji) !<0
452         END DO ! ji
453
454         !-------------------
455         ! Volume of new ice
456         !-------------------
457         DO ji = 1, nbpac
458            zv_newice(ji)     = - zqbgow(ji) / ze_newice(ji)
459
460            ! A fraction zfrazb of frazil ice is accreted at the ice bottom
461            zfrazb        = ( TANH ( Cfrazb * ( zvrel_ac(ji) - vfrazb ) )     & 
462               + 1.0 ) / 2.0 * maxfrazb
463            zdh_frazb(ji) = zfrazb*zv_newice(ji)
464            zv_newice(ji) = ( 1.0 - zfrazb ) * zv_newice(ji)
465         END DO
466
467         !---------------------------------
468         ! Salt flux due to new ice growth
469         !---------------------------------
470         IF ( ( num_sal .EQ. 4 ) ) THEN
471            DO ji = 1, nbpac
472               zji            = MOD( npac(ji) - 1, jpi ) + 1
473               zjj            = ( npac(ji) - 1 ) / jpi + 1
474               fseqv_1d(ji)   = fseqv_1d(ji) +                                     &
475                  ( sss_m(zji,zjj) - bulk_sal      ) * rhoic *       &
476                  zv_newice(ji) / rdt_ice
477            END DO
478         ELSE
479            DO ji = 1, nbpac
480               zji            = MOD( npac(ji) - 1, jpi ) + 1
481               zjj            = ( npac(ji) - 1 ) / jpi + 1
482               fseqv_1d(ji)   = fseqv_1d(ji) +                                     &
483                  ( sss_m(zji,zjj) - zs_newice(ji) ) * rhoic *       &
484                  zv_newice(ji) / rdt_ice
485            END DO ! ji
486         ENDIF
487
488         !------------------------------------
489         ! Diags for energy conservation test
490         !------------------------------------
491         DO ji = 1, nbpac
492            ! Volume
493            zji                  = MOD( npac(ji) - 1, jpi ) + 1
494            zjj                  = ( npac(ji) - 1 ) / jpi + 1
495            vt_i_init(zji,zjj)   = vt_i_init(zji,zjj) + zv_newice(ji)
496            ! Energy
497            zde                  = ze_newice(ji) / unit_fac
498            zde                  = zde * area(zji,zjj) * zv_newice(ji)
499            et_i_init(zji,zjj)   = et_i_init(zji,zjj) + zde
500         END DO
501
502         ! keep new ice volume in memory
503         CALL tab_1d_2d( nbpac, v_newice , npac(1:nbpac), zv_newice(1:nbpac) , &
504            jpi, jpj )
505
506         !-----------------
507         ! Area of new ice
508         !-----------------
509         DO ji = 1, nbpac
510            za_newice(ji)     = zv_newice(ji) / zh_newice(ji)
511            ! diagnostic
512            zji                  = MOD( npac(ji) - 1, jpi ) + 1
513            zjj                  = ( npac(ji) - 1 ) / jpi + 1
514            diag_lat_gr(zji,zjj) = zv_newice(ji) / rdt_ice
515         END DO !ji
516
517         !------------------------------------------------------------------------------!
518         ! 6) Redistribute new ice area and volume into ice categories                  !
519         !------------------------------------------------------------------------------!
520
521         !-----------------------------------------
522         ! Keep old ice areas and volume in memory
523         !-----------------------------------------
524         zv_old(:,:) = zv_i_ac(:,:) 
525         za_old(:,:) = za_i_ac(:,:)
526
527         !-------------------------------------------
528         ! Compute excessive new ice area and volume
529         !-------------------------------------------
530         ! If lateral ice growth gives an ice concentration gt 1, then
531         ! we keep the excessive volume in memory and attribute it later
532         ! to bottom accretion
533         DO ji = 1, nbpac
534            ! vectorize
535            IF ( za_newice(ji) .GT. ( 1.0 - zat_i_ac(ji) ) ) THEN
536               zda_res(ji)    = za_newice(ji) - (1.0 - zat_i_ac(ji) )
537               zdv_res(ji)    = zda_res(ji) * zh_newice(ji) 
538               za_newice(ji)  = za_newice(ji) - zda_res(ji)
539               zv_newice(ji)  = zv_newice(ji) - zdv_res(ji)
540            ELSE
541               zda_res(ji) = 0.0
542               zdv_res(ji) = 0.0
543            ENDIF
544         END DO ! ji
545
546         !------------------------------------------------
547         ! Laterally redistribute new ice volume and area
548         !------------------------------------------------
549         zat_i_ac(:) = 0.0
550
551         DO jl = 1, jpl
552            DO ji = 1, nbpac
553               ! vectorize
554               IF (       ( hi_max(jl-1)  .LT. zh_newice(ji) ) &
555                  .AND. ( zh_newice(ji) .LE. hi_max(jl)    ) ) THEN
556                  za_i_ac(ji,jl) = za_i_ac(ji,jl) + za_newice(ji)
557                  zv_i_ac(ji,jl) = zv_i_ac(ji,jl) + zv_newice(ji)
558                  zat_i_ac(ji)   = zat_i_ac(ji) + za_i_ac(ji,jl)
559                  zcatac(ji)     = jl
560               ENDIF
561            END DO ! ji
562         END DO ! jl
563
564         !----------------------------------
565         ! Heat content - lateral accretion
566         !----------------------------------
567         DO ji = 1, nbpac
568            jl = zcatac(ji) ! categroy in which new ice is put
569            ! zindb = 0 if no ice and 1 if yes
570            zindb            = 1.0 - MAX ( 0.0 , SIGN ( 1.0 , -za_old(ji,jl) ) ) 
571            ! old ice thickness
572            zhice_old(ji,jl)  = zv_old(ji,jl)                                  &
573               / MAX ( za_old(ji,jl) , zeps ) * zindb
574            ! difference in thickness
575            zdhex(ji)      = MAX( 0.0, zh_newice(ji) - zhice_old(ji,jl) ) 
576            ! is ice totally new in category jl ?
577            zswinew(ji)    = MAX( 0.0, SIGN( 1.0 , - za_old(ji,jl) + epsi11 ) )
578         END DO
579
580         DO jk = 1, nlay_i
581            DO ji = 1, nbpac
582               jl = zcatac(ji)
583               zqold              = ze_i_ac(ji,jk,jl) ! [ J.m-3 ]
584               zalphai            = MIN( zhice_old(ji,jl) * jk  / nlay_i ,     &
585                  zh_newice(ji) )                       &
586                  - MIN( zhice_old(ji,jl) * ( jk - 1 )         &
587                  / nlay_i , zh_newice(ji) )
588               ze_i_ac(ji,jk,jl) =                                             &
589                  zswinew(ji)           * ze_newice(ji)                           &
590                  + ( 1.0 - zswinew(ji) ) *                                         &
591                  ( za_old(ji,jl)  * zqold * zhice_old(ji,jl) / nlay_i            &
592                  + za_newice(ji)  * ze_newice(ji) * zalphai                      &
593                  + za_newice(ji)  * ze_newice(ji) * zdhex(ji) / nlay_i ) /       &
594                  ( ( zv_i_ac(ji,jl) ) / nlay_i )
595
596            END DO !ji
597         END DO !jl
598
599         !-----------------------------------------------
600         ! Add excessive volume of new ice at the bottom
601         !-----------------------------------------------
602         ! If the ice concentration exceeds 1, the remaining volume of new ice
603         ! is equally redistributed among all ice categories in which there is
604         ! ice
605
606         ! Fraction of level ice
607         jm = 1
608         zat_i_lev(:) = 0.0
609
610         DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
611            DO ji = 1, nbpac
612               zat_i_lev(ji) = zat_i_lev(ji) + za_i_ac(ji,jl) 
613            END DO
614         END DO
615
616         IF( ln_nicep ) WRITE(numout,*) ' zv_i_ac : ', zv_i_ac(jiindx, 1:jpl)
617         DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
618            DO ji = 1, nbpac
619               zindb      =  MAX( 0.0, SIGN( 1.0, zdv_res(ji) ) )
620               zv_i_ac(ji,jl) = zv_i_ac(ji,jl) +                               &
621                  zindb * zdv_res(ji) * za_i_ac(ji,jl) /         &
622                  MAX( zat_i_lev(ji) , epsi06 )
623            END DO ! ji
624         END DO ! jl
625         IF( ln_nicep ) WRITE(numout,*) ' zv_i_ac : ', zv_i_ac(jiindx, 1:jpl)
626
627         !---------------------------------
628         ! Heat content - bottom accretion
629         !---------------------------------
630         jm = 1
631         DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
632            DO ji = 1, nbpac
633               ! zindb = 0 if no ice and 1 if yes
634               zindb            =  1.0 -  MAX( 0.0 , SIGN( 1.0                 & 
635                  , - za_i_ac(ji,jl ) ) ) 
636               zhice_old(ji,jl) =  zv_i_ac(ji,jl) /                            &
637                  MAX( za_i_ac(ji,jl) , zeps ) * zindb
638               zdhicbot(ji,jl)  =  zdv_res(ji) / MAX( za_i_ac(ji,jl) , zeps )  & 
639                  *  zindb &
640                  +  zindb * zdh_frazb(ji) ! frazil ice
641               ! may coalesce
642               ! thickness of residual ice
643               zdummy(ji,jl)    = zv_i_ac(ji,jl)/MAX(za_i_ac(ji,jl),zeps)*zindb
644            END DO !ji
645         END DO !jl
646
647         ! old layers thicknesses and enthalpies
648         DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
649            DO jk = 1, nlay_i
650               DO ji = 1, nbpac
651                  zthick0(ji,jk,jl)=  zhice_old(ji,jl) / nlay_i
652                  zqm0   (ji,jk,jl)=  ze_i_ac(ji,jk,jl) * zthick0(ji,jk,jl)
653               END DO !ji
654            END DO !jk
655         END DO !jl
656
657         DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
658            DO ji = 1, nbpac
659               zthick0(ji,nlay_i+1,jl) =  zdhicbot(ji,jl)
660               zqm0   (ji,nlay_i+1,jl) =  ze_newice(ji)*zdhicbot(ji,jl)
661            END DO ! ji
662         END DO ! jl
663
664         ! Redistributing energy on the new grid
665         ze_i_ac(:,:,:) = 0.0
666         DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
667            DO jk = 1, nlay_i
668               DO layer = 1, nlay_i + 1
669                  DO ji = 1, nbpac
670                     zindb            =  1.0 -  MAX( 0.0 , SIGN( 1.0 ,         & 
671                        - za_i_ac(ji,jl ) ) ) 
672                     ! Redistributing energy on the new grid
673                     zweight         =  MAX (  &
674                        MIN( zhice_old(ji,jl) * layer , zdummy(ji,jl) * jk ) -    &
675                        MAX( zhice_old(ji,jl) * ( layer - 1 ) , zdummy(ji,jl) *   &
676                        ( jk - 1 ) ) , 0.0 )                                  &
677                        /  ( MAX(nlay_i * zthick0(ji,layer,jl),zeps) ) * zindb
678                     ze_i_ac(ji,jk,jl) =  ze_i_ac(ji,jk,jl) +                  &
679                        zweight * zqm0(ji,layer,jl) 
680                  END DO ! ji
681               END DO ! layer
682            END DO ! jk
683         END DO ! jl
684
685         DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
686            DO jk = 1, nlay_i
687               DO ji = 1, nbpac
688                  zindb                =  1.0 - MAX( 0.0 , SIGN( 1.0           &
689                     , - zv_i_ac(ji,jl) ) ) !0 if no ice
690                  ze_i_ac(ji,jk,jl)    = ze_i_ac(ji,jk,jl) /                   &
691                     MAX( zv_i_ac(ji,jl) , zeps)           &
692                     * za_i_ac(ji,jl) * nlay_i * zindb
693               END DO
694            END DO
695         END DO
696
697         !------------
698         ! Update age
699         !------------
700         DO jl = 1, jpl
701            DO ji = 1, nbpac
702               !--ice age
703               zindb            = 1.0 - MAX( 0.0 , SIGN( 1.0 , -               &
704                  za_i_ac(ji,jl) ) )  ! 0 if no ice and 1 if yes
705               zoa_i_ac(ji,jl)  = za_old(ji,jl) * zoa_i_ac(ji,jl) /            &
706                  MAX( za_i_ac(ji,jl) , zeps ) * zindb   
707            END DO ! ji
708         END DO ! jl   
709
710         !-----------------
711         ! Update salinity
712         !-----------------
713         IF ( ( num_sal .EQ. 2 ) .OR. ( num_sal .EQ. 4 ) ) THEN
714
715            DO jl = 1, jpl
716               DO ji = 1, nbpac
717                  !zindb = 0 if no ice and 1 if yes
718                  zindb            = 1.0 - MAX( 0.0 , SIGN( 1.0 , -               &
719                     zv_i_ac(ji,jl) ) )  ! 0 if no ice and 1 if yes
720                  zdv              = zv_i_ac(ji,jl) - zv_old(ji,jl)
721                  zsmv_i_ac(ji,jl) = ( zsmv_i_ac(ji,jl) + zdv * zs_newice(ji) ) * &
722                     zindb
723               END DO ! ji
724            END DO ! jl   
725
726         ENDIF ! num_sal
727
728
729         !------------------------------------------------------------------------------!
730         ! 8) Change 2D vectors to 1D vectors
731         !------------------------------------------------------------------------------!
732
733         DO jl = 1, jpl
734            CALL tab_1d_2d( nbpac, a_i(:,:,jl) , npac(1:nbpac) ,               &
735               za_i_ac(1:nbpac,jl) , jpi, jpj )
736            CALL tab_1d_2d( nbpac, v_i(:,:,jl) , npac(1:nbpac) ,               &
737               zv_i_ac(1:nbpac,jl) , jpi, jpj )
738            CALL tab_1d_2d( nbpac, oa_i(:,:,jl), npac(1:nbpac) ,               &
739               zoa_i_ac(1:nbpac,jl), jpi, jpj )
740            IF ( ( num_sal .EQ. 2 ) .OR. ( num_sal .EQ. 4 ) ) &
741               CALL tab_1d_2d( nbpac, smv_i(:,:,jl) , npac(1:nbpac) ,             &
742               zsmv_i_ac(1:nbpac,jl) , jpi, jpj )
743            DO jk = 1, nlay_i
744               CALL tab_1d_2d( nbpac, e_i(:,:,jk,jl) , npac(1:nbpac),          &
745                  ze_i_ac(1:nbpac,jk,jl), jpi, jpj )
746            END DO ! jk
747         END DO !jl
748         CALL tab_1d_2d( nbpac, fseqv , npac(1:nbpac), fseqv_1d  (1:nbpac) ,   &
749            jpi, jpj )
750
751      ENDIF ! nbpac > 0
752
753      !------------------------------------------------------------------------------!
754      ! 9) Change units for e_i
755      !------------------------------------------------------------------------------!   
756
757      DO jl = 1, jpl
758         DO jk = 1, nlay_i
759            DO jj = 1, jpj
760               DO ji = 1, jpi
761                  ! Correct dimensions to avoid big values
762                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / unit_fac
763
764                  ! Mutliply by ice volume, and divide by number
765                  ! of layers to get heat content in 10^9 Joules
766                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * &
767                     area(ji,jj) * v_i(ji,jj,jl) / &
768                     nlay_i
769               END DO
770            END DO
771         END DO
772      END DO
773
774      !------------------------------------------------------------------------------|
775      ! 10) Conservation check and changes in each ice category
776      !------------------------------------------------------------------------------|
777
778      IF ( con_i ) THEN
779         CALL lim_column_sum (jpl,   v_i, vt_i_final)
780         fieldid = 'v_i, limthd_lac'
781         CALL lim_cons_check (vt_i_init, vt_i_final, 1.0e-6, fieldid) 
782
783         CALL lim_column_sum_energy(jpl, nlay_i, e_i, et_i_final)
784         fieldid = 'e_i, limthd_lac'
785         CALL lim_cons_check (et_i_final, et_i_final, 1.0e-3, fieldid) 
786
787         CALL lim_column_sum (jpl,   v_s, vt_s_final)
788         fieldid = 'v_s, limthd_lac'
789         CALL lim_cons_check (vt_s_init, vt_s_final, 1.0e-6, fieldid) 
790
791         !     CALL lim_column_sum (jpl,   e_s(:,:,1,:) , et_s_init)
792         !     fieldid = 'e_s, limthd_lac'
793         !     CALL lim_cons_check (et_s_init, et_s_final, 1.0e-3, fieldid)
794
795         IF( ln_nicep ) THEN
796            WRITE(numout,*) ' vt_i_init : ', vt_i_init(jiindx,jjindx)
797            WRITE(numout,*) ' vt_i_final: ', vt_i_final(jiindx,jjindx)
798            WRITE(numout,*) ' et_i_init : ', et_i_init(jiindx,jjindx)
799            WRITE(numout,*) ' et_i_final: ', et_i_final(jiindx,jjindx)
800         ENDIF
801
802      ENDIF
803
804   END SUBROUTINE lim_thd_lac
805
806#else
807   !!======================================================================
808   !!                       ***  MODULE limthd_lac   ***
809   !!                           no sea ice model
810   !!======================================================================
811CONTAINS
812   SUBROUTINE lim_thd_lac           ! Empty routine
813   END SUBROUTINE lim_thd_lac
814#endif
815END MODULE limthd_lac
Note: See TracBrowser for help on using the repository browser.