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

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

changes in style - part6 - pure cosmetics

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