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

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

source: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icethd_do.F90 @ 8531

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

changes in style - part6 - more clarity (still not finished)

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