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_zdf_2.F90 in branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/LIM_SRC_2 – NEMO

source: branches/2012/dev_r3385_NOCS04_HAMF/NEMOGCM/NEMO/LIM_SRC_2/limthd_zdf_2.F90 @ 3396

Last change on this file since 3396 was 3396, checked in by acc, 12 years ago

Branch: dev_r3385_NOCS04_HAMF; #665. Stage 1 of 2012 development: porting of changes on old development branch (2011/DEV_r1837_mass_heat_salt_fluxes) into new branch. Corrected a few errors on the way. This branch now compiles but is incomplete. Still missing LIM3 changes which must reside on a certain persons laptop somewhere

  • Property svn:keywords set to Id
File size: 46.9 KB
Line 
1MODULE limthd_zdf_2
2   !!======================================================================
3   !!                       ***  MODULE limthd_zdf_2 ***
4   !!                thermodynamic growth and decay of the ice
5   !!======================================================================
6   !! History :  1.0  !  01-04 (LIM) Original code
7   !!            2.0  !  02-08 (C. Ethe, G. Madec) F90
8   !!----------------------------------------------------------------------
9#if defined key_lim2
10   !!----------------------------------------------------------------------
11   !!   'key_lim2'                                    LIM 2.0 sea-ice model
12   !!----------------------------------------------------------------------
13   !!   lim_thd_zdf_2 : vertical accr./abl. and lateral ablation of sea ice
14   !!----------------------------------------------------------------------
15   USE par_oce          ! ocean parameters
16   USE phycst           ! ???
17   USE thd_ice_2
18   USE ice_2
19   USE limistate_2
20   USE in_out_manager
21   USE lib_mpp          ! MPP library
22   USE wrk_nemo         ! work arrays
23   USE cpl_oasis3, ONLY : lk_cpl
24     
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   lim_thd_zdf_2        ! called by lim_thd_2
29
30   REAL(wp) ::   epsi20 = 1.e-20  ,  &  ! constant values
31      &          epsi13 = 1.e-13  ,  &
32      &          zzero  = 0.e0    ,  &
33      &          zone   = 1.e0
34   !!----------------------------------------------------------------------
35   !! NEMO/LIM2 3.3 , UCL - NEMO Consortium (2010)
36   !! $Id$
37   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
38   !!----------------------------------------------------------------------
39CONTAINS
40
41   SUBROUTINE lim_thd_zdf_2( kideb , kiut )
42      !!------------------------------------------------------------------
43      !!                ***  ROUTINE lim_thd_zdf_2  ***
44      !!             
45      !! ** Purpose : This routine determines the time evolution of snow
46      !!      and sea-ice thicknesses, concentration and heat content
47      !!      due to the vertical and lateral thermodynamic accretion-
48      !!      ablation processes. One only treats the case of lat. abl.
49      !!      For lateral accretion, see routine lim_lat_accr
50      !!
51      !! ** Method  : The representation of vertical growth and decay of
52      !!      the sea-ice model is based upon the diffusion of heat
53      !!      through the external and internal boundaries of a
54      !!      three-layer system (two layers of ice and one layer and
55      !!      one layer of snow, if present, on top of the ice).
56      !!
57      !! ** Action  : - Calculation of some intermediates variables
58      !!              - Calculation of surface temperature
59      !!              - Calculation of available heat for surface ablation
60      !!              - Calculation of the changes in internal temperature
61      !!                of the three-layer system, due to vertical diffusion
62      !!                processes
63      !!              - Performs surface ablation and bottom accretion-ablation
64      !!              - Performs snow-ice formation
65      !!              - Performs lateral ablation
66      !!
67      !! References : Fichefet T. and M. Maqueda 1997, J. Geophys. Res., 102(C6), 12609-12646   
68      !!              Fichefet T. and M. Maqueda 1999, Clim. Dyn, 15(4), 251-268 
69      !!------------------------------------------------------------------
70      INTEGER, INTENT(in) ::   kideb    ! Start point on which the  the computation is applied
71      INTEGER, INTENT(in) ::   kiut     ! End point on which the  the computation is applied
72      !!
73      INTEGER ::   ji       ! dummy loop indices
74      REAL(wp), POINTER, DIMENSION(:) ::   zqcmlts        ! energy due to surface melting
75      REAL(wp), POINTER, DIMENSION(:) ::   zqcmltb        ! energy due to bottom melting
76      REAL(wp), POINTER, DIMENSION(:) ::   ztsmlt         ! snow/ice surface melting temperature
77      REAL(wp), POINTER, DIMENSION(:) ::   ztbif          ! int. temp. at the mid-point of the 1st layer of the snow/ice sys.
78      REAL(wp), POINTER, DIMENSION(:) ::   zksn           ! effective conductivity of snow
79      REAL(wp), POINTER, DIMENSION(:) ::   zkic           ! effective conductivity of ice
80      REAL(wp), POINTER, DIMENSION(:) ::   zksndh         ! thermal cond. at the mid-point of the 1st layer of the snow/ice sys.
81      REAL(wp), POINTER, DIMENSION(:) ::   zfcsu          ! conductive heat flux at the surface of the snow/ice system
82      REAL(wp), POINTER, DIMENSION(:) ::   zfcsudt        ! = zfcsu * dt
83      REAL(wp), POINTER, DIMENSION(:) ::   zi0            ! frac. of the net SW rad. which is not absorbed at the surface
84      REAL(wp), POINTER, DIMENSION(:) ::   z1mi0          ! fraction of the net SW radiation absorbed at the surface
85      REAL(wp), POINTER, DIMENSION(:) ::   zqmax          ! maximum energy stored in brine pockets
86      REAL(wp), POINTER, DIMENSION(:) ::   zrcpdt         ! h_su*rho_su*cp_su/dt(h_su being the thick. of surf. layer)
87      REAL(wp), POINTER, DIMENSION(:) ::   zts_old        ! previous surface temperature
88      REAL(wp), POINTER, DIMENSION(:) ::   zidsn , z1midsn , zidsnic ! temporary variables
89      REAL(wp), POINTER, DIMENSION(:) ::   zfnet          ! net heat flux at the top surface( incl. conductive heat flux)
90      REAL(wp), POINTER, DIMENSION(:) ::   zsprecip       ! snow accumulation
91      REAL(wp), POINTER, DIMENSION(:) ::   zhsnw_old      ! previous snow thickness
92      REAL(wp), POINTER, DIMENSION(:) ::   zdhictop       ! change in ice thickness due to top surf ablation/accretion
93      REAL(wp), POINTER, DIMENSION(:) ::   zdhicbot       ! change in ice thickness due to bottom surf abl/acc
94      REAL(wp), POINTER, DIMENSION(:) ::   zqsup          ! energy transmitted to ocean (coming from top surf abl/acc)
95      REAL(wp), POINTER, DIMENSION(:) ::   zqocea         ! energy transmitted to ocean (coming from bottom sur abl/acc)
96      REAL(wp), POINTER, DIMENSION(:) ::   zfrl_old       ! previous sea/ice fraction
97      REAL(wp), POINTER, DIMENSION(:) ::   zfrld_1d       ! new sea/ice fraction
98      REAL(wp), POINTER, DIMENSION(:) ::   zep            ! internal temperature of the 2nd layer of the snow/ice system
99      REAL(wp), DIMENSION(3) :: & 
100            zplediag  &    ! principle diagonal, subdiag. and supdiag. of the
101          , zsubdiag  &    ! tri-diagonal matrix coming from the computation
102          , zsupdiag  &    ! of the temperatures inside the snow-ice system
103          , zsmbr          ! second member
104       REAL(wp) ::    &
105            zhsu      &    ! thickness of surface layer
106          , zhe       &    ! effective thickness for compu. of equ. thermal conductivity
107          , zheshth   &    ! = zhe / thth
108          , zghe      &    ! correction factor of the thermal conductivity
109          , zumsb     &    ! parameter for numerical method to solve heat-diffusion eq.
110          , zkhsn     &    ! conductivity at the snow layer
111          , zkhic     &    ! conductivity at the ice layers
112          , zkint     &    ! equivalent conductivity at the snow-ice interface
113          , zkhsnint  &    ! = zkint*dt / (hsn*rhosn*cpsn) 
114          , zkhicint  &    ! = 2*zkint*dt / (hic*rhoic*cpic)
115          , zpiv1, zpiv2 & ! temporary scalars used to solve the tri-diagonal system
116          , zb2, zd2  &    ! temporary scalars used to solve the tri-diagonal system
117          , zb3, zd3  &    ! temporary scalars used to solve the tri-diagonal system
118          , ztint          ! equivalent temperature at the snow-ice interface
119       REAL(wp) ::    & 
120            zexp      &    ! exponential function of the ice thickness
121          , zfsab     &    ! part of solar radiation stored in brine pockets
122          , zfts      &    ! value of energy balance function when the temp. equal surf. temp.
123          , zdfts     &    ! value of derivative of ztfs when the temp. equal surf. temp.
124          , zdts      &    ! surface temperature increment
125          , zqsnw_mlt &    ! energy needed to melt snow
126          , zdhsmlt   &    ! change in snow thickness due to melt
127          , zhsn      &    ! snow thickness (previous+accumulation-melt)
128          , zqsn_mlt_rem & ! remaining heat coming from snow melting
129          , zqice_top_mlt &! energy used to melt ice at top surface
130          , zdhssub   &    ! change in snow thick. due to sublimation or evaporation
131          , zdhisub   &    ! change in ice thick. due to sublimation or evaporation   
132          , zdhsn     &    ! snow ice thickness increment
133          , zdtsn     &    ! snow internal temp. increment
134          , zdtic     &    ! ice internal temp. increment
135          , zqnes          ! conductive energy due to ice melting in the first ice layer
136       REAL(wp) ::    & 
137            ztbot     &    ! temperature at the bottom surface
138          , zfcbot    &    ! conductive heat flux at bottom surface
139          , zqice_bot &    ! energy used for bottom melting/growing
140          , zqice_bot_mlt &! energy used for bottom melting
141          , zqstbif_bot  & ! part of energy stored in brine pockets used for bottom melting
142          , zqstbif_old  & ! temporary var. for zqstbif_bot
143          , zdhicmlt  &    ! change in ice thickness due to bottom melting
144          , zdhicm    &    ! change in ice thickness var.
145          , zdhsnm    &    ! change in snow thickness var.
146          , zhsnfi    &    ! snow thickness var.
147          , zc1, zpc1 &    ! temporary variables
148          , zc2, zpc2 &    ! temporary variables
149          , zp1, zp2  &    ! temporary variables
150          , ztb2, ztb3     ! temporary variables
151       REAL(wp) ::    & 
152            zdrmh     &    ! change in snow/ice thick. after snow-ice formation
153          , zhicnew   &    ! new ice thickness
154          , zhsnnew   &    ! new snow thickness
155          , zquot     &
156          , ztneq     &    ! temporary temp. variables
157          , zqice     &
158          , zqicetot  &    ! total heat inside the snow/ice system
159          , zdfrl     &    ! change in ice concentration
160          , zdvsnvol  &    ! change in snow volume
161          , zdrfrl1, zdrfrl2, zihsn, zidhb, zihic &  ! temporary scalars
162          , zihe, zihq, ziexp, ziqf, zihnf        &  ! temporary scalars
163          , zibmlt, ziqr, zihgnew, zind, ztmp        ! temporary scalars
164       !!----------------------------------------------------------------------
165       CALL wrk_alloc( jpij, ztsmlt, ztbif  , zksn    , zkic    , zksndh , zfcsu  , zfcsudt , zi0      , z1mi0   , zqmax    )
166       CALL wrk_alloc( jpij, zrcpdt, zts_old, zidsn   , z1midsn , zidsnic, zfnet  , zsprecip, zhsnw_old, zdhictop, zdhicbot )
167       CALL wrk_alloc( jpij, zqsup , zqocea , zfrl_old, zfrld_1d, zep    , zqcmlts, zqcmltb                                 )
168
169       !-----------------------------------------------------------------------
170       !  1. Boundaries conditions for snow/ice system internal temperature
171       !       - If tbif_1d(ji,1) > rt0_snow, tbif_1d(ji,1) = rt0_snow
172       !       - If tbif_1d(ji,2/3) > rt0_ice, tbif_1d(ji,2/3) = rt0_ice
173       !     Computation of energies due to surface and bottom melting
174       !-----------------------------------------------------------------------
175       
176       DO ji = kideb , kiut
177          ! do nothing if the snow (ice) thickness falls below its minimum thickness
178          zihsn = MAX( zzero , SIGN( zone , hsndif - h_snow_1d(ji) ) )
179          zihic = MAX( zzero , SIGN( zone , hicdif - h_ice_1d(ji) ) )
180          !--energy required to bring snow to its melting point (rt0_snow)
181          zqcmlts(ji) = ( MAX ( zzero , rcpsn * h_snow_1d(ji) * ( tbif_1d(ji,1) - rt0_snow ) ) ) * ( 1.0 - zihsn )
182          !--energy required to bring ice to its melting point (rt0_ice)
183          zqcmltb(ji) = ( MAX( zzero , rcpic * ( tbif_1d(ji,2) - rt0_ice ) * ( h_ice_1d(ji) / 2. ) )  &
184             &          + MAX( zzero , rcpic * ( tbif_1d(ji,3) - rt0_ice ) * ( h_ice_1d(ji) / 2. ) )  &
185             &          ) * ( 1.0 - zihic  )
186          !--limitation of snow/ice system internal temperature
187          tbif_1d(ji,1)   = MIN( rt0_snow, tbif_1d(ji,1) )
188          tbif_1d(ji,2)   = MIN( rt0_ice , tbif_1d(ji,2) )
189          tbif_1d(ji,3)   = MIN( rt0_ice , tbif_1d(ji,3) )
190       END DO
191
192       !-------------------------------------------
193       !  2. Calculate some intermediate variables. 
194       !-------------------------------------------
195       
196       ! initialisation of the thickness of surface layer
197       zhsu = hnzst 
198
199       DO ji = kideb , kiut
200          zind   = MAX( zzero , SIGN( zone , zhsu - h_snow_1d(ji) ) )
201          zihsn  = MAX( zzero , SIGN( zone , hsndif - h_snow_1d(ji) ) )
202          zihsn  = MAX( zihsn , zind )
203          zihic  = MAX( zzero , sign( zone , hicdif - h_ice_1d(ji) ) )
204          !     2.1. Computation of surface melting temperature
205          !----------------------------------------------------
206          zind  = MAX( zzero , SIGN( zone , -h_snow_1d(ji) ) )
207          ztsmlt(ji) = ( 1.0 - zind ) * rt0_snow + zind * rt0_ice
208          !
209          !     2.2. Effective conductivity of snow and ice
210          !-----------------------------------------------
211
212          !---computation of the correction factor on the thermal conductivity
213          !-- (Morales Maqueda, 1995 ; Fichefet and Morales Maqueda, 1997)
214          zhe      =  ( rcdsn / ( rcdsn + rcdic ) ) * h_ice_1d(ji)   &
215             &     + ( rcdic / ( rcdsn + rcdic ) ) * h_snow_1d(ji) 
216          zihe     = MAX( zzero , SIGN( zone , 2.0 * zhe - thth ) )
217          zheshth  = zhe / thth
218          zghe     = ( 1.0 - zihe ) * zheshth * ( 2.0 - zheshth )   &
219             &     +         zihe   * 0.5 * ( 1.5 + LOG( 2.0 * zheshth ) )
220
221          !---effective conductivities
222          zksn(ji)  = zghe * rcdsn 
223          zkic(ji)  = zghe * rcdic
224
225          !
226          !     2.3. Computation of the conductive heat flux from the snow/ice
227          !          system interior toward the top surface
228          !------------------------------------------------------------------
229
230          !---Thermal conductivity at the mid-point of the first snow/ice system layer
231          zksndh(ji) =   ( ( 1.0 - zihsn ) * 2.0 * zksn(ji) + zihsn * 4.0 * zkic(ji) )   &
232             &         / ( ( 1.0 - zihsn ) *  h_snow_1d(ji)                              &
233             &           +        zihsn   *  ( ( 1.0 + 3.0 * zihic ) * h_ice_1d(ji)      &
234             &           + 4.0 * zkic(ji)/zksn(ji) * h_snow_1d(ji) ) )
235
236          !---internal temperature at the mid-point of the first snow/ice system layer
237          ztbif(ji)  = ( 1.0 - zihsn ) * tbif_1d(ji,1)                       &
238             &       +         zihsn   * ( ( 1.0 - zihic ) * tbif_1d(ji,2)   &
239             &       +         zihic   * tfu_1d(ji)   )
240          !---conductive heat flux
241          zfcsu(ji) = zksndh(ji) * ( ztbif(ji) - sist_1d(ji) )
242
243       END DO
244
245       !--------------------------------------------------------------------
246       !  3. Calculate :
247       !     - fstbif_1d, part of solar radiation absorbing inside the ice
248       !       assuming an exponential absorption (Grenfell and Maykut, 1977)
249       !     - zqmax,  maximum energy stored in brine pockets
250       !     - qstbif_1d, total energy stored in brine pockets (updating)
251       !-------------------------------------------------------------------
252
253       DO ji = kideb , kiut
254          zihsn  = MAX( zzero , SIGN (zone , -h_snow_1d(ji) ) )
255          zihic  = MAX( zzero , 1.0 - ( h_ice_1d(ji) / zhsu ) )     
256          zind   = MAX( zzero , SIGN (zone , hicdif - h_ice_1d(ji) ) )
257          !--Computation of the fraction of the net shortwave radiation which
258          !--penetrates inside the ice cover ( See Forcat)
259          zi0(ji)  = zihsn * ( fr1_i0_1d(ji) + zihic * fr2_i0_1d(ji) )
260          zexp     = MIN( zone , EXP( -1.5 * ( h_ice_1d(ji) - zhsu ) ) )
261          fstbif_1d(ji) = zi0(ji) * qsr_ice_1d(ji) * zexp
262          !--Computation of maximum energy stored in brine pockets zqmax and update
263          !--the total energy stored in brine pockets, if less than zqmax
264          zqmax(ji) = MAX( zzero , 0.5 * xlic * ( h_ice_1d(ji) - hicmin ) )
265          zfsab   = zi0(ji) * qsr_ice_1d(ji) * ( 1.0 - zexp )
266          zihq    = ( 1.0 - zind ) * MAX(zzero, SIGN( zone , qstbif_1d(ji) - zqmax(ji) ) ) &
267             &    +         zind   * zone
268          qstbif_1d(ji) = ( qstbif_1d(ji) + ( 1.0 - zihq ) * zfsab * rdt_ice ) * swiqst
269          !--fraction of shortwave radiation absorbed at surface
270          ziexp = zihq * zexp + ( 1.0 - zihq ) * ( swiqst + ( 1.0 - swiqst ) * zexp )
271          z1mi0(ji) = 1.0 - zi0(ji) * ziexp
272       END DO
273
274       !--------------------------------------------------------------------------------
275       !  4. Computation of the surface temperature : determined by considering the
276       !     budget of a thin layer of thick. zhsu at the top surface (H. Grenier, 1995)
277       !     and based on a surface energy balance :
278       !     hsu * rcp * dT/dt = Fsr + Fnsr(T) + Fcs(T),
279       !     where - Fsr is the net absorbed solar radiation,
280       !           - Fnsr is the total non solar radiation (incoming and outgoing long-wave,
281       !             sensible and latent heat fluxes)
282       !           - Fcs the conductive heat flux at the top of surface
283       !------------------------------------------------------------------------------
284
285       !     4.1. Computation of intermediate values
286       !---------------------------------------------
287       DO ji = kideb, kiut
288          zrcpdt(ji) = ( rcpsn * MIN( h_snow_1d(ji) , zhsu )    &
289             &       + rcpic * MAX( zhsu - h_snow_1d(ji) , zzero ) ) / rdt_ice
290          zts_old(ji) =  sist_1d(ji)
291       END DO
292
293       !     4.2. Computation of surface temperature by expanding the eq. of energy balance
294       !          with Ts = Tp + DT. One obtain , F(Tp) + DT * DF(Tp) = 0
295       !          where  - F(Tp) = Fsr + Fnsr(Tp) + Fcs(Tp)
296       !                 - DF(Tp)= (dFnsr(Tp)/dT) + (dFcs(Tp)/dT) - hsu*rcp/dt
297       !---------------------------------------------------------------------------------
298
299       DO ji = kideb, kiut
300          !---computation of the derivative of energy balance function
301          zdfts    =  zksndh(ji)   & ! contribution of the conductive heat flux
302             &      + zrcpdt(ji)   & ! contribution of hsu * rcp / dt
303             &      - dqns_ice_1d (ji)     ! contribution of the total non solar radiation
304          !---computation of the energy balance function
305          zfts    = - z1mi0 (ji) * qsr_ice_1d(ji)   & ! net absorbed solar radiation
306             &      - qns_ice_1d(ji)                & ! total non solar radiation
307             &      - zfcsu (ji)                      ! conductive heat flux from the surface
308          !---computation of surface temperature increment 
309          zdts    = -zfts / zdfts
310          !---computation of the new surface temperature
311          sist_1d(ji) = sist_1d(ji) + zdts
312       END DO
313
314       !----------------------------------------------------------------------------
315       !  5. Boundary condition at the top surface
316       !--    IF Tsb < Tmelt, Fnet = Fcs (the net heat flux equal the conductive heat flux)
317       !      Otherwise Tsb = Tmelt and Qnet(Tmelt) > 0
318       !      Fnet(Tmelt) is therefore the net surface flux needed for melting
319       !----------------------------------------------------------------------------
320       
321       
322       !     5.1.  Limitation of surface temperature and update total non solar fluxes,
323       !          latent heat flux and conductive flux at the top surface
324       !---------------------------------------------------------------------- 
325                     
326       IF ( .NOT. lk_cpl ) THEN   ! duplicate the loop for performances issues
327          DO ji = kideb, kiut
328             sist_1d(ji) = MIN( ztsmlt(ji) , sist_1d(ji) )
329             qns_ice_1d(ji) = qns_ice_1d(ji) + dqns_ice_1d(ji) * ( sist_1d(ji) - zts_old(ji) )
330             qla_ice_1d(ji) = qla_ice_1d(ji) + dqla_ice_1d(ji) * ( sist_1d(ji) - zts_old(ji) )
331             zfcsu(ji)  = zksndh(ji) * ( ztbif(ji) - sist_1d(ji) )
332          END DO
333       ELSE
334          DO ji = kideb, kiut
335             sist_1d(ji) = MIN( ztsmlt(ji) , sist_1d(ji) )
336             qla_ice_1d(ji) = -9999.   ! default definition, not used as parsub = 0. in this case
337             zfcsu(ji)  = zksndh(ji) * ( ztbif(ji) - sist_1d(ji) )
338          END DO
339       ENDIF
340
341       !     5.2. Calculate available heat for surface ablation.
342       !---------------------------------------------------------------------
343
344       DO ji = kideb, kiut
345          zfnet(ji) = qns_ice_1d(ji) + z1mi0(ji) * qsr_ice_1d(ji) + zfcsu(ji)         
346          zfnet(ji) = MAX( zzero , zfnet(ji) )
347          zfnet(ji) = zfnet(ji) * MAX( zzero , SIGN( zone , sist_1d(ji) - ztsmlt(ji) ) )
348       END DO
349
350       !-------------------------------------------------------------------------
351       !  6. Calculate changes in internal temperature due to vertical diffusion   
352       !     processes. The evolution of this temperature is governed by the one-
353       !     dimensionnal heat-diffusion equation.
354       !     Given the temperature tbif(1/2/3), at time m we solve a set
355       !     of finite difference equations to obtain new tempe. Each tempe is coupled
356       !     to the temp. immediatly above and below by heat conduction terms. Thus
357       !     we have a set of equations of the form A * T = B, where A is a tridiagonal
358       !     matrix, T a vector whose components are the unknown new temp.
359       !-------------------------------------------------------------------------
360       
361       !--parameter for the numerical methode use to solve the heat-diffusion equation
362       !- implicit, explicit or Crank-Nicholson
363       zumsb = 1.0 - sbeta 
364       DO ji = kideb, kiut
365          zidsn(ji)   = MAX ( zzero, SIGN( zone, hsndif - h_snow_1d(ji) ) ) 
366          z1midsn(ji) = 1.0 - zidsn(ji)
367          zihic       = MAX ( zzero, SIGN( zone, hicdif - h_ice_1d(ji) ) ) 
368          zidsnic(ji) = zidsn(ji) *  zihic 
369          zfcsudt(ji) = zfcsu(ji) * rdt_ice 
370       END DO
371   
372       DO ji = kideb, kiut
373
374          !     6.1 Calculate intermediate variables.
375          !----------------------------------------
376
377          !--conductivity at the snow surface
378          zkhsn = 2.0 * zksn(ji) * rdt_ice / rcpsn
379          !--conductivity at the ice surface
380          zkhic = 4.0 * zkic(ji) * rdt_ice / MAX( h_ice_1d(ji) * h_ice_1d(ji) * rcpic , epsi20 )
381          !--conductivity at the snow/ice interface
382          zkint = 4.0 * zksn(ji) * zkic(ji)  &
383             &        / ( zksn(ji) * h_ice_1d(ji) + 2.0 * zkic(ji) * h_snow_1d(ji) * z1midsn(ji)) 
384          zkhsnint = zkint * rdt_ice / rcpsn
385          zkhicint = zkint * 2.0 * rdt_ice / MAX( h_ice_1d(ji) * rcpic , epsi20 )
386         
387          !     6.2. Fulfill the linear system matrix.
388          !-----------------------------------------
389!$$$          zplediag(1) = 1 + sbeta * z1midsn(ji) * ( zkhsn + zkhsnint )       
390          zplediag(1) =   zidsn(ji) + z1midsn(ji) * h_snow_1d(ji)   &
391             &          + sbeta * z1midsn(ji) * zkhsnint 
392          zplediag(2) = 1 + sbeta * ( z1midsn(ji) * zkhicint + zkhic ) 
393          zplediag(3) = 1 + 3.0 * sbeta * zkhic   
394
395          zsubdiag(1) =  0.e0             
396          zsubdiag(2) = -1.e0 * z1midsn(ji) * sbeta * zkhicint
397          zsubdiag(3) = -1.e0 * sbeta * zkhic 
398
399          zsupdiag(1) = -1.e0 * z1midsn(ji) * sbeta * zkhsnint 
400          zsupdiag(2) = zsubdiag(3)
401          zsupdiag(3) =  0.e0
402         
403          !     6.3. Fulfill the idependent term vector.
404          !-------------------------------------------
405         
406!$$$          zsmbr(1) = zidsn(ji) * sist_1d(ji) + z1midsn(ji) *   &
407!$$$             &         ( tbif_1d(ji,1) + zkhsn * sist_1d(ji)
408!$$$             &         - zumsb * ( zkhsn * tbif_1d(ji,1)
409!$$$             &                   + zkhsnint * ( tbif_1d(ji,1) - tbif_1d(ji,2) ) ) )
410          zsmbr(1) = zidsn(ji) * sist_1d(ji) + z1midsn(ji) *    &
411             &       ( h_snow_1d(ji) * tbif_1d(ji,1) - ( zfcsudt(ji) / rcpsn )  &
412             &       - zumsb * zkhsnint * ( tbif_1d(ji,1) - tbif_1d(ji,2) ) )
413
414          zsmbr(2) =  tbif_1d(ji,2)  &
415             &      - zidsn(ji) * ( 1.0 - zidsnic(ji) ) &
416             &        * ( zfcsudt(ji) / MAX( h_ice_1d(ji) * rcpic , epsi20 ) ) &
417             &      + zumsb * ( zkhicint * ( tbif_1d(ji,1) - tbif_1d(ji,2) ) &
418             &                   - zkhic * ( tbif_1d(ji,2) - tbif_1d(ji,3) )  )
419
420          zsmbr(3) =  tbif_1d(ji,3)  &
421             &      + zkhic * ( 2.0 * tfu_1d(ji) &
422             &                + zumsb * ( tbif_1d(ji,2) - 3.0 * tbif_1d(ji,3) ) )
423         
424          !     6.4. Solve the system (Gauss elimination method).
425          !----------------------------------------------------
426         
427          zpiv1 = zsubdiag(2) / zplediag(1) 
428          zb2   = zplediag(2) - zpiv1 * zsupdiag(1)
429          zd2   = zsmbr(2) - zpiv1 * zsmbr(1)
430
431          zpiv2 = zsubdiag(3) / zb2
432          zb3   = zplediag(3) - zpiv2 * zsupdiag(2)
433          zd3   = zsmbr(3) - zpiv2 * zd2
434
435          tbif_1d(ji,3) = zd3 / zb3
436          tbif_1d(ji,2) = ( zd2 - zsupdiag(2) * tbif_1d(ji,3) ) / zb2
437          tbif_1d(ji,1) = ( zsmbr(1) - zsupdiag(1) * tbif_1d(ji,2) ) / zplediag(1)           
438
439          !--- taking into account the particular case of  zidsnic(ji) = 1
440          ztint =  (  zkic(ji) * h_snow_1d(ji) * tfu_1d (ji)    &
441             &      + zksn(ji) * h_ice_1d(ji) * sist_1d(ji) )   &
442             &   / ( zkic(ji) * h_snow_1d(ji) + zksn(ji) * h_ice_1d(ji) ) 
443
444          tbif_1d(ji,1) = ( 1.0 - zidsnic(ji) ) * tbif_1d(ji,1)   &
445             &                + zidsnic(ji)   * ( ztint + sist_1d(ji) ) / 2.0
446          tbif_1d(ji,2) = ( 1.0 - zidsnic(ji) ) * tbif_1d(ji,2)   &
447             &                + zidsnic(ji)   * ( 3.0 * ztint + tfu_1d(ji) ) / 4.0
448          tbif_1d(ji,3) = ( 1.0 - zidsnic(ji) ) * tbif_1d(ji,3)   &
449             &                + zidsnic(ji)   * ( ztint + 3.0 * tfu_1d(ji) ) / 4.0     
450       END DO
451 
452       !----------------------------------------------------------------------
453       !  9. Take into account surface ablation and bottom accretion-ablation.|
454       !----------------------------------------------------------------------
455       
456       !---Snow accumulation in one thermodynamic time step
457       zsprecip(kideb:kiut) = sprecip_1d(kideb:kiut) * rdt_ice / rhosn
458
459
460       DO ji = kideb, kiut
461         
462          !      9.1. Surface ablation and update of snow thickness and qstbif_1d
463          !--------------------------------------------------------------------
464         
465          !--------------------------------------------------------------------------
466          !--      Melting snow processes :
467          !--      Melt at the upper surface is computed from the difference between
468          !--      the net heat flux (including the conductive heat flux) at the upper
469          !--      surface and the pre-existing energy due to surface melting
470          !------------------------------------------------------------------------------
471         
472          !-- store the snow thickness
473          zhsnw_old(ji) =  h_snow_1d(ji)
474          !--computation of the energy needed to melt snow
475          zqsnw_mlt  = zfnet(ji) * rdt_ice - zqcmlts(ji)
476          !--change in snow thickness due to melt
477          zdhsmlt = - zqsnw_mlt / xlsn
478         
479          !-- compute new snow thickness, taking into account the part of snow accumulation
480          !   (as snow precipitation) and the part of snow lost due to melt
481          zhsn =  h_snow_1d(ji) + zsprecip(ji) + zdhsmlt
482          h_snow_1d(ji) = MAX( zzero , zhsn )
483          !-- compute the volume of snow lost after surface melting and the associated mass
484          dvsbq_1d(ji) =  ( 1.0 - frld_1d(ji) ) * ( h_snow_1d(ji) - zhsnw_old(ji) - zsprecip(ji) )
485          dvsbq_1d(ji) =  MIN( zzero , dvsbq_1d(ji) )
486          ztmp = rhosn * dvsbq_1d(ji)
487          rdm_snw_1d(ji) =  ztmp
488          !--heat content of the water provided to the ocean (referenced to rt0)
489          rdq_snw_1d(ji) =  cpic * ztmp * ( rt0_snow - rt0 )
490          !-- If the snow is completely melted the remaining heat is used to melt ice
491          zqsn_mlt_rem  = MAX( zzero , -zhsn ) * xlsn
492          zqice_top_mlt = zqsn_mlt_rem 
493          zqstbif_old   = qstbif_1d(ji)
494
495          !--------------------------------------------------------------------------
496          !--      Melting ice processes at the top surface :
497          !--      The energy used to melt ice, zqice_top_mlt, is taken from the energy
498          !--      stored in brine pockets qstbif_1d and the remaining energy coming
499          !--      from the melting snow process zqsn_mlt_rem.
500          !--      If qstbif_1d > zqsn_mlt_rem then, one uses only a zqsn_mlt_rem part
501          !--      of qstbif_1d to melt ice,
502          !--         zqice_top_mlt = zqice_top_mlt + zqsn_mlt_rem
503          !--         qstbif_1d = qstbif_1d - zqsn_mlt_rem
504          !--      Otherwise one uses all qstbif_1d to melt ice
505          !--         zqice_top_mlt = zqice_top_mlt + qstbif_1d
506          !--         qstbif_1d = 0
507          !------------------------------------------------------
508         
509          ziqf =  MAX ( zzero , SIGN( zone , qstbif_1d(ji) - zqsn_mlt_rem  ) )
510          zqice_top_mlt =         ziqf   * ( zqice_top_mlt + zqsn_mlt_rem )   &
511             &          + ( 1.0 - ziqf ) * ( zqice_top_mlt + qstbif_1d(ji)  )
512
513          qstbif_1d(ji) =         ziqf   * ( qstbif_1d(ji) - zqsn_mlt_rem )   &
514             &          + ( 1.0 - ziqf ) * ( qstbif_1d(ji) - qstbif_1d(ji)  )
515
516          !--    The contribution of the energy stored in brine pockets qstbif_1d to melt
517          !--    ice is taking into account only when qstbif_1d is less than zqmax.
518          !--    Otherwise, only the remaining energy coming from the melting snow
519          !--    process is used
520          zihq =  MAX ( zzero , SIGN( zone , qstbif_1d(ji) - zqmax(ji) ) )
521
522          zqice_top_mlt =         zihq   * zqice_top_mlt   &
523             &          + ( 1.0 - zihq ) * zqsn_mlt_rem
524
525          qstbif_1d(ji) =         zihq   * qstbif_1d(ji)   &
526             &          + ( 1.0 - zihq ) * zqstbif_old
527
528          !--change in ice thickness due to melt at the top surface
529          zdhictop(ji) = -zqice_top_mlt / xlic
530          !--compute the volume formed after surface melting
531          dvsbq_1d(ji) =  zdhictop(ji) * ( 1.0 - frld_1d(ji) )
532
533          !-------------------------------------------------------------------------
534          !--      A small variation at the surface also occurs because of sublimation
535          !--      associated with the latent flux. If qla_ice_1d is negative, snow condensates at
536          !        the surface. Otherwise, snow evaporates
537          !-----------------------------------------------------------------------
538          !----change in snow and ice thicknesses due to sublimation or evaporation
539          zdhssub  = parsub * ( qla_ice_1d(ji) / ( rhosn * xsn ) ) * rdt_ice 
540          zhsn     = h_snow_1d(ji) - zdhssub
541          zdhisub  = MAX( zzero , -zhsn ) * rhosn/rhoic
542          zdhictop(ji) =  zdhictop(ji) - zdhisub
543          h_snow_1d(ji)  =  MAX( zzero , zhsn )
544          !-------------------------------------------------
545          !--  Update Internal temperature and qstbif_1d.
546          !-------------------------------------------
547          zihsn  =  MAX( zzero , SIGN( zone, -h_snow_1d(ji) ) )
548          tbif_1d(ji,1) = ( 1.0 - zihsn ) * tbif_1d(ji,1) + zihsn   * tfu_1d(ji)
549          !--change in snow internal temperature if snow has increased
550          zihnf = MAX( zzero , SIGN( zone , h_snow_1d(ji) - zhsnw_old(ji) ) )
551          zdhsn = 1.0 - zhsnw_old(ji) / MAX( h_snow_1d(ji) , epsi20 )
552          zdtsn = zdhsn * ( sist_1d(ji) - tbif_1d(ji,1) )
553          tbif_1d(ji,1) = tbif_1d(ji,1) + z1midsn(ji) * zihnf * zdtsn
554          !--energy created due to ice melting in the first ice layer
555          zqnes  = ( rt0_ice - tbif_1d(ji,2) ) * rcpic * ( h_ice_1d(ji) / 2. )
556          !--change in first ice layer internal temperature
557          ziqr  = MAX( zzero , SIGN( zone , qstbif_1d(ji) - zqnes ) )
558          zdtic = qstbif_1d(ji) / ( rcpic * ( h_ice_1d(ji) / 2. ) )
559          tbif_1d(ji,2) =  ziqr * rt0_ice + ( 1 - ziqr ) * ( tbif_1d(ji,2) + zdtic )
560          !--update qstbif_1d
561          qstbif_1d(ji) = ziqr * ( qstbif_1d(ji) - zqnes ) * swiqst
562
563
564          !--      9.2. Calculate bottom accretion-ablation and update qstbif_1d.
565          !             Growth and melting at bottom ice surface are governed by 
566          !                 -xlic * Dh = (Fcb - Fbot ) * Dt
567          !             where Fbot is the net downward heat flux from ice to the ocean
568          !            and Fcb is the conductive heat flux at the bottom surface
569          !---------------------------------------------------------------------------
570          ztbot = ( 1.0 - zidsnic(ji) ) * tbif_1d(ji,3) + zidsnic(ji) * sist_1d(ji)
571          !---computes conductive heat flux at bottom surface
572          zfcbot =  4.0 * zkic(ji) * ( tfu_1d(ji) - ztbot )   &
573             &   / ( h_ice_1d(ji) + zidsnic(ji) * ( 3. * h_ice_1d(ji) &
574             &   + 4.0 * zkic(ji)/zksn(ji) * h_snow_1d(ji) ) )
575          !---computation of net energy needed for bottom melting/growing
576          zqice_bot = ( zfcbot - ( fbif_1d(ji) + qlbbq_1d(ji) ) ) * rdt_ice
577          zqstbif_bot = qstbif_1d(ji)
578          !---switch to know if bottom surface melts ( = 1 ) or grows ( = 0 )occurs
579          zibmlt = MAX( zzero , SIGN( zone , -zqice_bot ) )
580          !--particular case of melting (in the same way as the top surface)
581          zqice_bot_mlt = zqice_bot 
582          zqstbif_old = zqstbif_bot
583
584          ziqf =  MAX ( zzero , SIGN( zone , qstbif_1d(ji) + zqice_bot_mlt  ) )
585          zqice_bot_mlt =         ziqf   * ( zqice_bot_mlt + zqice_bot_mlt ) &
586             &          + ( 1.0 - ziqf ) * ( zqice_bot_mlt + qstbif_1d(ji)  )         
587          qstbif_1d(ji)   =         ziqf   * ( qstbif_1d(ji) + zqice_bot_mlt ) &
588             &          + ( 1.0 - ziqf ) * ( qstbif_1d(ji) - qstbif_1d(ji)  )
589          !--    The contribution of the energy stored in brine pockets qstbif_1d to melt
590          !--    ice is taking into account only when qstbif_1d is less than zqmax.
591          zihq =  MAX ( zzero , SIGN( zone , qstbif_1d(ji) - zqmax(ji) ) )
592          zqice_bot_mlt =         zihq   * zqice_bot_mlt   &
593             &          + ( 1.0 - zihq ) * zqice_bot
594          qstbif_1d(ji)   =         zihq   * qstbif_1d(ji)   &
595             &             + ( 1.0 - zihq ) * zqstbif_old
596
597          !---treatment of the case of melting/growing
598          zqice_bot   =         zibmlt   * ( zqice_bot_mlt - zqcmltb(ji) )   &
599             &        + ( 1.0 - zibmlt ) * ( zqice_bot - zqcmltb(ji)  )
600          qstbif_1d(ji) =         zibmlt   * qstbif_1d(ji)   &
601             &           + ( 1.0 - zibmlt ) * zqstbif_bot
602
603          !--computes change in ice thickness due to melt or growth
604          zdhicbot(ji) = zqice_bot / xlic
605          !--limitation of bottom melting if so : hmelt maximum melting at bottom
606          zdhicmlt  = MAX( hmelt , zdhicbot(ji) ) 
607          !-- output part due to bottom melting only
608          IF( zdhicmlt < 0.e0 ) rdvomif_1d(ji) = ( 1.0 - frld_1d(ji) ) * zdhicmlt
609          !--energy after bottom melting/growing
610          zqsup(ji) = ( 1.0 - frld_1d(ji) ) * xlic * ( zdhicmlt - zdhicbot(ji) )
611          !-- compute the new thickness and the newly formed volume after bottom melting/growing
612          zdhicbot(ji)  = zdhicmlt
613          dvbbq_1d(ji) = ( 1.0 - frld_1d(ji) ) * zdhicbot(ji)
614
615
616          !        9.3.  Updating ice thickness after top surface ablation
617          !              and bottom surface accretion/ablation
618          !---------------------------------------------------------------
619          zhicnew  = h_ice_1d(ji) + zdhictop(ji) + zdhicbot(ji)
620
621          !
622          !        9.4. Case of total ablation (ice is gone but snow may be left)
623          !-------------------------------------------------------------------
624          zhsn  = h_snow_1d(ji)
625          zihgnew = 1.0 - MAX( zzero , SIGN( zone , -zhicnew ) )
626          zihsn   = MAX( zzero , SIGN( zone , -zhsn ) )
627          !---convert
628          zdhicm  = ( 1.0 - zihgnew ) * ( zhicnew - qstbif_1d(ji) / xlic )
629          zdhsnm  = ( 1.0 - zihsn ) * zdhicm * rhoic / rhosn
630          !---updating new ice thickness and computing the newly formed ice mass
631          zhicnew   =  zihgnew * zhicnew
632          ztmp    =  ( 1.0 - frld_1d(ji) ) * ( zhicnew - h_ice_1d(ji) ) * rhoic
633          rdm_ice_1d(ji) =  rdm_ice_1d(ji) + ztmp
634          !---heat content of the water provided to the ocean (referenced to rt0)
635          !   use of rt0_ice is OK for melting ice; in the case of freezing, tfu_1d should be used.
636          !   This is done in 9.5 section (see below)
637          rdq_ice_1d(ji) =  cpic * ztmp * ( rt0_ice - rt0 )
638          !---updating new snow thickness and computing the newly formed snow mass
639          zhsnfi   = zhsn + zdhsnm
640          h_snow_1d(ji) = MAX( zzero , zhsnfi )
641          ztmp = ( 1.0 - frld_1d(ji) ) * ( h_snow_1d(ji) - zhsn ) * rhosn
642          rdm_snw_1d(ji) = rdm_snw_1d(ji) + ztmp
643          !---updating the heat content of the water provided to the ocean (referenced to rt0)
644          rdq_snw_1d(ji) = rdq_snw_1d(ji) + cpic * ztmp * ( rt0_snow - rt0 )
645          !--remaining energy in case of total ablation
646          zqocea(ji) = - ( zihsn * xlic * zdhicm + xlsn * ( zhsnfi - h_snow_1d(ji) ) ) * ( 1.0 - frld_1d(ji) )
647          qstbif_1d(ji) = zihgnew * qstbif_1d(ji)
648
649          !
650          !        9.5. Update internal temperature and ice thickness.
651          !-------------------------------------------------------
652          !
653          sist_1d(ji) = zihgnew * sist_1d(ji) + ( 1.0 - zihgnew ) * tfu_1d(ji)
654          zidhb  = MAX( zzero , SIGN( zone , - zdhicbot(ji) ) )
655          zc1    = - zhicnew * 0.5
656          zpc1   = MIN( 0.5 * zone , - h_ice_1d(ji) * 0.5 - zdhictop(ji) )
657          zc2    = - zhicnew
658          zpc2   =  zidhb * zc2 + ( 1.0 - zidhb ) * ( - h_ice_1d(ji) - zdhictop(ji) )
659          zp1    =  MAX( zpc1 , zc1 )
660          zp2    =  MAX( zpc2 , zc1 )
661          zep(ji) =  tbif_1d(ji,2)
662          ztb2  = 2.0 * (         - zp1   * tbif_1d(ji,2)  &
663             &  + ( zp1 - zp2 ) * tbif_1d(ji,3)  &
664             &  + ( zp2 - zc1 ) * tfu_1d(ji) ) / MAX( zhicnew , epsi20 ) 
665          tbif_1d(ji,2) = zihgnew * ztb2 + ( 1.0 - zihgnew ) * tfu_1d(ji)
666          !---
667          zp1  =  MIN( zpc1 , zc1 )
668          zp2  =  MIN( zpc2 , zc1 )
669          zp1  =  MAX( zc2  , zp1 )
670          ztb3 =  2.0 * (   ( 1.0 - zidhb ) * (  ( zc1 - zp2 ) * tbif_1d(ji,3)  &
671             &                                 + ( zp2 - zc2 ) * tfu_1d(ji) )   &
672             &               +      zidhb   * (  ( zc1 - zp1 ) * zep(ji)      &
673             &                                 + ( zp1 - zc2 ) * tbif_1d(ji,3))  ) / MAX( zhicnew , epsi20 )
674          tbif_1d(ji,3) =  zihgnew * ztb3 + ( 1.0 - zihgnew ) * tfu_1d(ji)
675          h_ice_1d(ji)  =  zhicnew
676          ! update the ice heat content given to the ocean in freezing case
677          ! (part due to difference between rt0_ice and tfu_1d)
678          ztmp = ( 1. - zidhb ) * rhoic * dvbbq_1d(ji)
679          rdq_ice_1d(ji) = rdq_ice_1d(ji) + cpic * ztmp * ( tfu_1d(ji) - rt0_ice )
680       END DO
681
682
683       !----------------------------------------------------------------------------
684       !  10. Surface accretion.
685       !      The change of ice thickness after snow/ice formation is such that
686       !      the interface between snow and ice is located at the same height
687       !      as the ocean surface. It is given by (Fichefet and Morales Maqueda 1999)
688       !          D(h_ice) = (- D(hsn)/alph) =  [rhosn*hsn - (rau0 - rhoic)*hic]
689       !                                     / [alph*rhosn+rau0 - rhoic]
690       !----------------------------------------------------------------------------
691       !
692       DO ji = kideb , kiut
693
694          !--  Computation of the change of ice thickness after snow-ice formation
695          zdrmh =  ( rhosn * h_snow_1d(ji) + ( rhoic - rau0 ) * h_ice_1d(ji) )  &
696             &  / ( alphs * rhosn + rau0 - rhoic )
697          zdrmh = MAX( zzero , zdrmh )
698
699          !--New ice and snow thicknesses Fichefet and Morales Maqueda (1999)
700          zhicnew  = MAX( h_ice_1d(ji) , h_ice_1d(ji) + zdrmh )
701          zhsnnew  = MIN( h_snow_1d(ji) , h_snow_1d(ji) - alphs * zdrmh )
702          !---Compute new ice temperatures. snow temperature remains unchanged
703          !   Lepparanta (1983):
704          zihic = 1.0 - MAX( zzero , SIGN( zone , -zhicnew ) )
705          zquot  = ( 1.0 - zihic ) &
706             &   +         zihic * MIN( zone , h_ice_1d(ji) / MAX( zhicnew , epsi20 ) ) 
707          ztneq  =         alphs * cnscg * tbif_1d(ji,1)    &
708             &   + ( 1.0 - alphs * ( rhosn/rhoic ) ) * tfu_1d(ji)
709          zep(ji) = tbif_1d(ji,2)
710          tbif_1d(ji,2) = ztneq - zquot * zquot * ( ztneq - tbif_1d(ji,2) )
711          tbif_1d(ji,3) = 2.0 * ztneq &
712             &        + zquot * ( tbif_1d(ji,3) + zep(ji) - 2.0 * ztneq ) - tbif_1d(ji,2)
713
714          !---  Lepparanta (1983) (latent heat released during white ice formation
715          !     goes to the ocean -for lateral ablation-)
716          qldif_1d(ji)  = qldif_1d(ji) + zdrmh * ( 1.0 - alphs * ( rhosn/rhoic ) ) * xlic * ( 1.0 - frld_1d(ji) )
717          !--   Changes in ice volume and ice mass Lepparanta (1983):
718          dvnbq_1d(ji) = ( 1.0 - frld_1d(ji) ) * ( zhicnew - h_ice_1d(ji) )
719          dmgwi_1d(ji) = dmgwi_1d(ji) + ( 1.0 -frld_1d(ji) ) * ( h_snow_1d(ji) - zhsnnew ) * rhosn
720          !---  volume change of ice and snow (used for ocean-ice freshwater flux computation)
721          ztmp = ( 1.0 - frld_1d(ji) ) * ( zhicnew - h_ice_1d (ji) ) * rhoic
722          rdm_ice_1d(ji) = rdm_ice_1d(ji) + ztmp
723          rdq_ice_1d(ji) = rdq_ice_1d(ji) + cpic * ztmp * ( tfu_1d(ji) - rt0 )
724          !!gm BUG ??   snow ==>  only needed for nn_ice_embd == 0  (standard levitating sea-ice)
725          ztmp = ( 1.0 - frld_1d(ji) )   * ( zhsnnew - h_snow_1d(ji) ) * rhosn
726          rdm_snw_1d(ji) = rdm_snw_1d(ji) + ztmp
727          rdq_snw_1d(ji) = rdq_snw_1d(ji) + cpic * ztmp * ( rt0_snow - rt0 )
728
729          !---  Actualize new snow and ice thickness.
730          h_snow_1d(ji)  = zhsnnew
731          h_ice_1d (ji)  = zhicnew
732
733       END DO
734
735       !----------------------------------------------------
736       !  11. Lateral ablation (Changes in sea/ice fraction)
737       !----------------------------------------------------
738       DO ji = kideb , kiut
739          zfrl_old(ji)  = frld_1d(ji)
740          zihic   = 1.0 - MAX( zzero , SIGN( zone , -h_ice_1d(ji) ) )
741          zihsn   = 1.0 - MAX( zzero , SIGN( zone , -h_snow_1d(ji) ) )
742          !--In the case of total ablation (all the ice ice has melted) frld = 1
743          frld_1d(ji)  = ( 1.0 - zihic ) + zihic * zfrl_old(ji)
744          !--Part of solar radiation absorbing inside the ice and going
745          !--through the ocean
746          fscbq_1d(ji) = ( 1.0 - zfrl_old(ji) ) * ( 1.0 - thcm_1d(ji) ) * fstbif_1d(ji)
747          !--Total remaining energy after bottom melting/growing
748          qfvbq_1d(ji) = zqsup(ji) + ( 1.0 - zihic ) * zqocea(ji)
749          !--Updating of total heat from the ocean
750          qldif_1d(ji)  = qldif_1d(ji) + qfvbq_1d(ji) + ( 1.0 - zihic ) * fscbq_1d(ji) * rdt_ice
751          !--Computation of total heat inside the snow/ice system
752          zqice  = h_snow_1d(ji) * xlsn + h_ice_1d(ji) * xlic
753          zqicetot  = ( 1.0 - frld_1d(ji) ) * zqice
754          !--The concentration of ice is reduced (frld increases) if the heat
755          !--exchange between ice and ocean is positive
756          ziqf = MAX( zzero , SIGN( zone ,  zqicetot - qldif_1d(ji) ) )
757          zdfrl = qldif_1d(ji) / MAX( epsi20 , zqice ) 
758          frld_1d(ji)  = ( 1.0 - ziqf )    &
759             &       +         ziqf * ( frld_1d(ji) + MAX( zzero , zdfrl ) ) 
760          fltbif_1d(ji) = ( ( 1.0 - zfrl_old(ji) ) * qstbif_1d(ji) - zqicetot  ) / rdt_ice
761          !--  Opening of leads: Hakkinen & Mellor, 1992.
762          zdfrl = - ( zdhictop(ji) + zdhicbot(ji) ) * hakspl * ( 1.0 - zfrl_old(ji) ) &
763             &  / MAX( epsi13 , h_ice_1d(ji) + h_snow_1d(ji) * rhosn/rhoic ) 
764          zfrld_1d(ji) =  frld_1d(ji) + MAX( zzero , zdfrl )
765          !--Limitation of sea-ice fraction <= 1
766          zfrld_1d(ji) = ziqf * MIN( 0.99 * zone , zfrld_1d(ji) ) + ( 1 - ziqf )
767          !---Update surface and internal temperature and snow/ice thicknesses.
768          sist_1d(ji)   = sist_1d(ji)   + ( 1.0 - ziqf ) * ( tfu_1d(ji) - sist_1d(ji)   )
769          tbif_1d(ji,1) = tbif_1d(ji,1) + ( 1.0 - ziqf ) * ( tfu_1d(ji) - tbif_1d(ji,1) )
770          tbif_1d(ji,2) = tbif_1d(ji,2) + ( 1.0 - ziqf ) * ( tfu_1d(ji) - tbif_1d(ji,2) )
771          tbif_1d(ji,3) = tbif_1d(ji,3) + ( 1.0 - ziqf ) * ( tfu_1d(ji) - tbif_1d(ji,3) )
772          !--variation of ice volume and ice mass
773          dvlbq_1d(ji)   = zihic * ( zfrl_old(ji) - frld_1d(ji) ) * h_ice_1d(ji)
774          ztmp = dvlbq_1d(ji) * rhoic
775          rdm_ice_1d(ji) = rdm_ice_1d(ji) + ztmp
776!!gm
777!!gm   This should be split in two parts:
778!!gm         1-  heat required to bring sea-ice to tfu  : this part should be added to the heat flux taken from the ocean
779!!gm                 cpic * ztmp * 0.5 * ( tbif_1d(ji,2) + tbif_1d(ji,3) - 2.* rt0_ice )
780!!gm         2-  heat content of lateral ablation referenced to rt0 : this part only put in rdq_ice_1d
781!!gm                 cpic * ztmp * ( rt0_ice - rt0 )
782!!gm   Currently we put all the heat in rdq_ice_1d
783          rdq_ice_1d(ji) = rdq_ice_1d(ji) + cpic * ztmp * 0.5 * ( tbif_1d(ji,2) + tbif_1d(ji,3) - 2.* rt0 )
784          !
785          !--variation of snow volume and snow mass
786          zdvsnvol = zihsn * ( zfrl_old(ji) - frld_1d(ji) ) * h_snow_1d(ji)
787          ztmp     = zdvsnvol * rhosn
788          rdm_snw_1d(ji) = rdm_snw_1d(ji) + ztmp
789!!gm
790!!gm   This should be split in two parts:
791!!gm         1-  heat required to bring snow to tfu  : this part should be added to the heat flux taken from the ocean
792!!gm                 cpic * ztmp * ( tbif_1d(ji,1) - rt0_snow )
793!!gm         2-  heat content of lateral ablation referenced to rt0 : this part only put in rdq_snw_1d
794!!gm                 cpic * ztmp * ( rt0_snow - rt0 )
795!!gm   Currently we put all the heat in rdq_snw_1d
796          rdq_snw_1d(ji) = rdq_snw_1d(ji) + cpic * ztmp * ( tbif_1d(ji,1) - rt0 )
797
798          h_snow_1d(ji)  = ziqf * h_snow_1d(ji)
799
800          zdrfrl1 = ziqf * ( 1.0 -  frld_1d(ji) ) / MAX( epsi20 , 1.0 - zfrld_1d(ji) )
801          zdrfrl2 = ziqf * ( 1.0 - zfrl_old(ji) ) / MAX( epsi20 , 1.0 - zfrld_1d(ji) )
802
803          h_snow_1d (ji) = zdrfrl1 * h_snow_1d(ji)
804          h_ice_1d  (ji) = zdrfrl1 * h_ice_1d(ji)
805          qstbif_1d(ji) = zdrfrl2 * qstbif_1d(ji)
806          frld_1d(ji)    = zfrld_1d(ji)
807          !
808       END DO
809       !
810       CALL wrk_dealloc( jpij, ztsmlt, ztbif  , zksn    , zkic    , zksndh , zfcsu  , zfcsudt , zi0      , z1mi0   , zqmax    )
811       CALL wrk_dealloc( jpij, zrcpdt, zts_old, zidsn   , z1midsn , zidsnic, zfnet  , zsprecip, zhsnw_old, zdhictop, zdhicbot )
812       CALL wrk_dealloc( jpij, zqsup , zqocea , zfrl_old, zfrld_1d, zep    , zqcmlts, zqcmltb                                 )
813       !
814    END SUBROUTINE lim_thd_zdf_2
815
816#else
817   !!----------------------------------------------------------------------
818   !!   Default Option                                     NO sea-ice model
819   !!----------------------------------------------------------------------
820CONTAINS
821   SUBROUTINE lim_thd_zdf_2          ! Empty routine
822   END SUBROUTINE lim_thd_zdf_2
823#endif
824
825   !!======================================================================
826END MODULE limthd_zdf_2
Note: See TracBrowser for help on using the repository browser.