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/DEV_r1837_mass_heat_salt_fluxes/NEMO/LIM_SRC_2 – NEMO

source: branches/DEV_r1837_mass_heat_salt_fluxes/NEMO/LIM_SRC_2/limthd_zdf_2.F90 @ 1858

Last change on this file since 1858 was 1858, checked in by gm, 14 years ago

ticket:#665 : step 1 - heat content of freezing-melting ice

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