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 NEMO/branches/UKMO/NEMO_4.0_GO8_coupled_iodef/src/ICE – NEMO

source: NEMO/branches/UKMO/NEMO_4.0_GO8_coupled_iodef/src/ICE/icethd_do.F90 @ 11367

Last change on this file since 11367 was 11367, checked in by dancopsey, 5 years ago

More print statements including fix

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