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

source: trunk/NEMOGCM/NEMO/LIM_SRC_2/limthd_zdf_2.F90 @ 3319

Last change on this file since 3319 was 3294, checked in by rblod, 12 years ago

Merge of 3.4beta into the trunk

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