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.F90 in trunk/NEMO/LIM_SRC_3 – NEMO

source: trunk/NEMO/LIM_SRC_3/limthd.F90 @ 2477

Last change on this file since 2477 was 2477, checked in by cetlod, 13 years ago

v3.2:remove hardcoded value of num_sal in limrst.F90, see ticket #633

  • Property svn:keywords set to Id
File size: 43.8 KB
Line 
1MODULE limthd
2   !!======================================================================
3   !!                  ***  MODULE limthd   ***
4   !!  LIM-3 :   ice thermodynamic
5   !!======================================================================
6   !! History :  LIM  ! 2000-01 (M.A. Morales Maqueda, H. Goosse, T. Fichefet) LIM-1
7   !!            2.0  ! 2002-07 (C. Ethe, G. Madec)  LIM-2 (F90 rewriting)
8   !!            3.0  ! 2005-11 (M. Vancoppenolle)  LIM-3 : Multi-layer thermodynamics + salinity variations
9   !!             -   ! 2007-04 (M. Vancoppenolle) add lim_thd_glohec and lim_thd_con_dif
10   !!            3.2  ! 2009-07 (M. Vancoppenolle, Y. Aksenov, G. Madec) bug correction in rdmsnif
11   !!----------------------------------------------------------------------
12#if defined key_lim3
13   !!----------------------------------------------------------------------
14   !!   'key_lim3'                                      LIM3 sea-ice model
15   !!----------------------------------------------------------------------
16   !!   lim_thd      : thermodynamic of sea ice
17   !!----------------------------------------------------------------------
18   USE phycst          ! physical constants
19   USE dom_oce         ! ocean space and time domain variables
20   USE ice             ! LIM sea-ice variables
21   USE par_ice
22   USE sbc_oce         ! Surface boundary condition: ocean fields
23   USE sbc_ice         ! Surface boundary condition: ice fields
24   USE thd_ice         ! LIM thermodynamic sea-ice variables
25   USE dom_ice         ! LIM sea-ice domain
26   USE domvvl
27   USE limthd_dif
28   USE limthd_dh
29   USE limthd_sal
30   USE limthd_ent
31   USE limtab
32   USE limvar
33   USE in_out_manager  ! I/O manager
34   USE prtctl          ! Print control
35   USE lbclnk
36   USE lib_mpp
37
38   IMPLICIT NONE
39   PRIVATE
40
41   PUBLIC   lim_thd    ! called by lim_step
42
43   REAL(wp) ::   epsi20 = 1e-20   ! constant values
44   REAL(wp) ::   epsi16 = 1e-16   !
45   REAL(wp) ::   epsi06 = 1e-06   !
46   REAL(wp) ::   epsi04 = 1e-04   !
47   REAL(wp) ::   zzero  = 0.e0    !
48   REAL(wp) ::   zone   = 1.e0    !
49
50   !! * Substitutions
51#  include "domzgr_substitute.h90"
52#  include "vectopt_loop_substitute.h90"
53   !!----------------------------------------------------------------------
54   !! NEMO/LIM  3.2 ,  UCL-LOCEAN-IPSL (2009)
55   !! $Id$
56   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
57   !!----------------------------------------------------------------------
58
59CONTAINS
60
61   SUBROUTINE lim_thd( kt )
62      !!-------------------------------------------------------------------
63      !!                ***  ROUTINE lim_thd  ***       
64      !! 
65      !! ** Purpose : This routine manages the ice thermodynamic.
66      !!         
67      !! ** Action : - Initialisation of some variables
68      !!             - Some preliminary computation (oceanic heat flux
69      !!               at the ice base, snow acc.,heat budget of the leads)
70      !!             - selection of the icy points and put them in an array
71      !!             - call lim_vert_ther for vert ice thermodynamic
72      !!             - back to the geographic grid
73      !!             - selection of points for lateral accretion
74      !!             - call lim_lat_acc  for the ice accretion
75      !!             - back to the geographic grid
76      !!     
77      !! ** References : H. Goosse et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90
78      !!---------------------------------------------------------------------
79      INTEGER, INTENT(in) ::   kt    ! number of iteration
80      !!
81      INTEGER  ::   ji, jj, jk, jl   ! dummy loop indices
82      INTEGER  ::   nbpb             ! nb of icy pts for thermo. cal.
83      REAL(wp) ::   zfric_umin = 5e-03    ! lower bound for the friction velocity
84      REAL(wp) ::   zfric_umax = 2e-02    ! upper bound for the friction velocity
85      REAL(wp) ::   zinda, zindb, zthsnice, zfric_u    ! temporary scalar
86      REAL(wp) ::   zfntlat, zpareff                   !    -         -
87      REAL(wp) ::   zeps, zareamin, zcoef
88      REAL(wp), DIMENSION(jpi,jpj) ::   zqlbsbq   ! link with lead energy budget qldif
89      !!-------------------------------------------------------------------
90
91     
92      !------------------------------------------------------------------------------!
93      ! 1) Initialization of diagnostic variables                                    !
94      !------------------------------------------------------------------------------!
95      zeps = 1.e-10
96
97      !--------------------
98      ! 1.2) Heat content   
99      !--------------------
100      ! Change the units of heat content; from global units to J.m3
101
102      DO jl = 1, jpl
103         DO jk = 1, nlay_i
104            DO jj = 1, jpj
105               DO ji = 1, jpi
106                  !Energy of melting q(S,T) [J.m-3]
107                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_i(ji,jj,jl) , epsi06 ) ) * nlay_i
108                  !0 if no ice and 1 if yes
109                  zindb = 1.0 - MAX ( 0.0 , SIGN ( 1.0 , - ht_i(ji,jj,jl) ) ) 
110                  !convert units ! very important that this line is here
111                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * unit_fac * zindb 
112               END DO
113            END DO
114         END DO
115         DO jk = 1, nlay_s
116            DO jj = 1, jpj
117               DO ji = 1, jpi
118                  !Energy of melting q(S,T) [J.m-3]
119                  e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_s(ji,jj,jl) , epsi06 ) ) * nlay_s
120                  !0 if no ice and 1 if yes
121                  zindb = 1.0 - MAX ( 0.0 , SIGN ( 1.0 , - ht_s(ji,jj,jl) ) ) 
122                  !convert units ! very important that this line is here
123                  e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * unit_fac * zindb 
124               END DO
125            END DO
126         END DO
127      END DO
128
129      !-----------------------------
130      ! 1.3) Set some dummies to 0
131      !-----------------------------
132      rdvosif(:,:) = 0.e0   ! variation of ice volume at surface
133      rdvobif(:,:) = 0.e0   ! variation of ice volume at bottom
134      fdvolif(:,:) = 0.e0   ! total variation of ice volume
135      rdvonif(:,:) = 0.e0   ! lateral variation of ice volume
136      fstric (:,:) = 0.e0   ! part of solar radiation transmitted through the ice
137      ffltbif(:,:) = 0.e0   ! linked with fstric
138      qfvbq  (:,:) = 0.e0   ! linked with fstric
139      rdmsnif(:,:) = 0.e0   ! variation of snow mass per unit area
140      rdmicif(:,:) = 0.e0   ! variation of ice mass per unit area
141      hicifp (:,:) = 0.e0   ! daily thermodynamic ice production.
142      fsbri  (:,:) = 0.e0   ! brine flux contribution to salt flux to the ocean
143      fhbri  (:,:) = 0.e0   ! brine flux contribution to heat flux to the ocean
144      fseqv  (:,:) = 0.e0   ! equivalent salt flux to the ocean due to ice/growth decay
145
146      !-----------------------------------
147      ! 1.4) Compute global heat content
148      !-----------------------------------
149      qt_i_in  (:,:) = 0.e0
150      qt_s_in  (:,:) = 0.e0
151      qt_i_fin (:,:) = 0.e0
152      qt_s_fin (:,:) = 0.e0
153      sum_fluxq(:,:) = 0.e0
154      fatm     (:,:) = 0.e0
155
156      ! 2) Partial computation of forcing for the thermodynamic sea ice model.      !
157      !-----------------------------------------------------------------------------!
158
159!CDIR NOVERRCHK
160      DO jj = 1, jpj
161!CDIR NOVERRCHK
162         DO ji = 1, jpi
163            zthsnice       = SUM( ht_s(ji,jj,1:jpl) ) + SUM( ht_i(ji,jj,1:jpl) )
164            zindb          = tms(ji,jj) * ( 1.0 - MAX( zzero , SIGN( zone , - zthsnice ) ) ) 
165            phicif(ji,jj)  = vt_i(ji,jj)
166            pfrld(ji,jj)   = 1.0 - at_i(ji,jj)
167            zinda          = 1.0 - MAX( zzero , SIGN( zone , - ( 1.0 - pfrld(ji,jj) ) ) )
168
169            !           !  solar irradiance transmission at the mixed layer bottom and used in the lead heat budget
170            !           !  practically no "direct lateral ablation"
171            !           
172            !           !  net downward heat flux from the ice to the ocean, expressed as a function of ocean
173            !           !  temperature and turbulent mixing (McPhee, 1992)
174            ! friction velocity
175            zfric_u        = MAX ( MIN( SQRT( ust2s(ji,jj) ) , zfric_umax ) , zfric_umin ) 
176
177            ! here the drag will depend on ice thickness and type (0.006)
178            fdtcn(ji,jj)  = zindb * rau0 * rcp * 0.006  * zfric_u * ( (sst_m(ji,jj) + rt0) - t_bo(ji,jj) ) 
179            ! also category dependent
180            !           !-- Energy from the turbulent oceanic heat flux heat flux coming in the lead
181            qdtcn(ji,jj)  = zindb * fdtcn(ji,jj) * (1.0 - at_i(ji,jj)) * rdt_ice
182            !                       
183
184            ! still need to be updated : fdtcn !!!!
185            !           !-- Lead heat budget (part 1, next one is in limthd_dh
186            !           !-- qldif -- (or qldif_1d in 1d routines)
187            qldif(ji,jj) =  tms(ji,jj) * rdt_ice  * (                             & 
188               &   pfrld(ji,jj)        * (  qsr(ji,jj)                            &   ! solar heat
189               &                            + qns(ji,jj)                          &   ! non solar heat
190               &                            + fdtcn(ji,jj)                        &   ! turbulent ice-ocean heat
191               &                            + fsbbq(ji,jj) * ( 1.0 - zindb )  )   &   ! residual heat from previous step
192               & - pfrld(ji,jj)**betas * sprecip(ji,jj) * lfus                    )   ! latent heat of sprecip melting
193           
194            ! Positive heat budget is used for bottom ablation
195            zfntlat        = 1.0 - MAX( zzero , SIGN( zone ,  - qldif(ji,jj) ) )
196            != 1 if positive heat budget
197            zpareff        = 1.0 - zinda * zfntlat
198            != 0 if ice and positive heat budget and 1 if one of those two is false
199            zqlbsbq(ji,jj) = qldif(ji,jj) * ( 1.0 - zpareff ) / MAX( at_i(ji,jj) * rdt_ice , epsi16 )
200
201            ! Heat budget of the lead, energy transferred from ice to ocean
202            qldif  (ji,jj) = zpareff * qldif(ji,jj)
203            qdtcn  (ji,jj) = zpareff * qdtcn(ji,jj)
204
205            ! Energy needed to bring ocean surface layer until its freezing (qcmif, limflx)
206            qcmif  (ji,jj) =  rau0 * rcp * fse3t(ji,jj,1) * ( t_bo(ji,jj) - (sst_m(ji,jj) + rt0) ) * ( 1. - zinda )
207
208            ! oceanic heat flux (limthd_dh)
209            fbif   (ji,jj) = zindb * (  fsbbq(ji,jj) / MAX( at_i(ji,jj) , epsi20 ) + fdtcn(ji,jj) )
210            !
211         END DO
212      END DO
213
214      !------------------------------------------------------------------------------!
215      ! 3) Select icy points and fulfill arrays for the vectorial grid.           
216      !------------------------------------------------------------------------------!
217
218      DO jl = 1, jpl      !loop over ice categories
219
220         IF( kt == nit000 .AND. lwp ) THEN
221            WRITE(numout,*) ' lim_thd : transfer to 1D vectors. Category no : ', jl 
222            WRITE(numout,*) ' ~~~~~~~~'
223         ENDIF
224
225         zareamin = 1.0e-10
226         nbpb = 0
227         DO jj = 1, jpj
228            DO ji = 1, jpi
229               IF ( a_i(ji,jj,jl) .gt. zareamin ) THEN     
230                  nbpb      = nbpb  + 1
231                  npb(nbpb) = (jj - 1) * jpi + ji
232               ENDIF
233               ! debug point to follow
234               IF ( (ji.eq.jiindx).AND.(jj.eq.jjindx) ) THEN
235                  jiindex_1d = nbpb
236               ENDIF
237            END DO
238         END DO
239
240         !------------------------------------------------------------------------------!
241         ! 4) Thermodynamic computation
242         !------------------------------------------------------------------------------!
243
244         IF( lk_mpp )   CALL mpp_ini_ice( nbpb )
245
246         IF( nbpb > 0 ) THEN  ! If there is no ice, do nothing.
247
248            !-------------------------
249            ! 4.1 Move to 1D arrays
250            !-------------------------
251
252            CALL tab_2d_1d( nbpb, at_i_b     (1:nbpb), at_i            , jpi, jpj, npb(1:nbpb) )
253            CALL tab_2d_1d( nbpb, a_i_b      (1:nbpb), a_i(:,:,jl)     , jpi, jpj, npb(1:nbpb) )
254            CALL tab_2d_1d( nbpb, ht_i_b     (1:nbpb), ht_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
255            CALL tab_2d_1d( nbpb, ht_s_b     (1:nbpb), ht_s(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
256
257            CALL tab_2d_1d( nbpb, t_su_b     (1:nbpb), t_su(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
258            CALL tab_2d_1d( nbpb, sm_i_b     (1:nbpb), sm_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
259            DO jk = 1, nlay_s
260               CALL tab_2d_1d( nbpb, t_s_b(1:nbpb,jk), t_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
261               CALL tab_2d_1d( nbpb, q_s_b(1:nbpb,jk), e_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
262            END DO
263            DO jk = 1, nlay_i
264               CALL tab_2d_1d( nbpb, t_i_b(1:nbpb,jk), t_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
265               CALL tab_2d_1d( nbpb, q_i_b(1:nbpb,jk), e_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
266               CALL tab_2d_1d( nbpb, s_i_b(1:nbpb,jk), s_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
267            END DO
268
269            CALL tab_2d_1d( nbpb, tatm_ice_1d(1:nbpb), tatm_ice(:,:)   , jpi, jpj, npb(1:nbpb) )
270            CALL tab_2d_1d( nbpb, qsr_ice_1d (1:nbpb), qsr_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
271            CALL tab_2d_1d( nbpb, fr1_i0_1d  (1:nbpb), fr1_i0          , jpi, jpj, npb(1:nbpb) )
272            CALL tab_2d_1d( nbpb, fr2_i0_1d  (1:nbpb), fr2_i0          , jpi, jpj, npb(1:nbpb) )
273            CALL tab_2d_1d( nbpb, qnsr_ice_1d(1:nbpb), qns_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
274
275#if ! defined key_coupled
276            CALL tab_2d_1d( nbpb, qla_ice_1d (1:nbpb), qla_ice(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
277            CALL tab_2d_1d( nbpb, dqla_ice_1d(1:nbpb), dqla_ice(:,:,jl)   , jpi, jpj, npb(1:nbpb) )
278#endif
279
280            CALL tab_2d_1d( nbpb, dqns_ice_1d(1:nbpb), dqns_ice(:,:,jl)   , jpi, jpj, npb(1:nbpb) )
281            CALL tab_2d_1d( nbpb, t_bo_b     (1:nbpb), t_bo       , jpi, jpj, npb(1:nbpb) )
282            CALL tab_2d_1d( nbpb, sprecip_1d (1:nbpb), sprecip    , jpi, jpj, npb(1:nbpb) ) 
283            CALL tab_2d_1d( nbpb, fbif_1d    (1:nbpb), fbif       , jpi, jpj, npb(1:nbpb) )
284            CALL tab_2d_1d( nbpb, qldif_1d   (1:nbpb), qldif      , jpi, jpj, npb(1:nbpb) )
285            CALL tab_2d_1d( nbpb, rdmicif_1d (1:nbpb), rdmicif    , jpi, jpj, npb(1:nbpb) )
286            CALL tab_2d_1d( nbpb, rdmsnif_1d (1:nbpb), rdmsnif    , jpi, jpj, npb(1:nbpb) )
287            CALL tab_2d_1d( nbpb, dmgwi_1d   (1:nbpb), dmgwi      , jpi, jpj, npb(1:nbpb) )
288            CALL tab_2d_1d( nbpb, qlbbq_1d   (1:nbpb), zqlbsbq    , jpi, jpj, npb(1:nbpb) )
289
290            CALL tab_2d_1d( nbpb, fseqv_1d   (1:nbpb), fseqv      , jpi, jpj, npb(1:nbpb) )
291            CALL tab_2d_1d( nbpb, fsbri_1d   (1:nbpb), fsbri      , jpi, jpj, npb(1:nbpb) )
292            CALL tab_2d_1d( nbpb, fhbri_1d   (1:nbpb), fhbri      , jpi, jpj, npb(1:nbpb) )
293            CALL tab_2d_1d( nbpb, fstbif_1d  (1:nbpb), fstric     , jpi, jpj, npb(1:nbpb) )
294            CALL tab_2d_1d( nbpb, qfvbq_1d   (1:nbpb), qfvbq      , jpi, jpj, npb(1:nbpb) )
295
296            !--------------------------------
297            ! 4.3) Thermodynamic processes
298            !--------------------------------
299
300            IF( con_i )   CALL lim_thd_enmelt( 1, nbpb )   ! computes sea ice energy of melting
301            IF( con_i )   CALL lim_thd_glohec( qt_i_in, qt_s_in, q_i_layer_in, 1, nbpb, jl )
302
303            !                                 !---------------------------------!
304            CALL lim_thd_dif( 1, nbpb, jl )   ! Ice/Snow Temperature profile    !
305            !                                 !---------------------------------!
306
307            CALL lim_thd_enmelt( 1, nbpb )    ! computes sea ice energy of melting compulsory for limthd_dh
308
309            IF( con_i )   CALL lim_thd_glohec ( qt_i_fin, qt_s_fin, q_i_layer_fin, 1, nbpb, jl ) 
310            IF( con_i )   CALL lim_thd_con_dif( 1 , nbpb , jl )
311
312            !                                 !---------------------------------!
313            CALL lim_thd_dh( 1, nbpb, jl )    ! Ice/Snow thickness              !
314            !                                 !---------------------------------!
315
316            !                                 !---------------------------------!
317            CALL lim_thd_ent( 1, nbpb, jl )   ! Ice/Snow enthalpy remapping     !
318            !                                 !---------------------------------!
319
320            !                                 !---------------------------------!
321            CALL lim_thd_sal( 1, nbpb )       ! Ice salinity computation        !
322            !                                 !---------------------------------!
323
324            !           CALL lim_thd_enmelt(1,nbpb)   ! computes sea ice energy of melting
325            IF( con_i )   CALL lim_thd_glohec( qt_i_fin, qt_s_fin, q_i_layer_fin, 1, nbpb, jl ) 
326            IF( con_i )   CALL lim_thd_con_dh ( 1 , nbpb , jl )
327
328            !--------------------------------
329            ! 4.4) Move 1D to 2D vectors
330            !--------------------------------
331
332            CALL tab_1d_2d( nbpb, at_i        , npb, at_i_b(1:nbpb), jpi, jpj )
333            CALL tab_1d_2d( nbpb, ht_i(:,:,jl), npb, ht_i_b(1:nbpb), jpi, jpj )
334            CALL tab_1d_2d( nbpb, ht_s(:,:,jl), npb, ht_s_b(1:nbpb), jpi, jpj )
335            CALL tab_1d_2d( nbpb, a_i (:,:,jl), npb, a_i_b(1:nbpb) , jpi, jpj )
336            CALL tab_1d_2d( nbpb, t_su(:,:,jl), npb, t_su_b(1:nbpb), jpi, jpj )
337            CALL tab_1d_2d( nbpb, sm_i(:,:,jl), npb, sm_i_b(1:nbpb), jpi, jpj )
338
339            DO jk = 1, nlay_s
340               CALL tab_1d_2d( nbpb, t_s(:,:,jk,jl), npb, t_s_b(1:nbpb,jk), jpi, jpj)
341               CALL tab_1d_2d( nbpb, e_s(:,:,jk,jl), npb, q_s_b(1:nbpb,jk), jpi, jpj)
342            END DO
343
344            DO jk = 1, nlay_i
345               CALL tab_1d_2d( nbpb, t_i(:,:,jk,jl), npb, t_i_b(1:nbpb,jk), jpi, jpj)
346               CALL tab_1d_2d( nbpb, e_i(:,:,jk,jl), npb, q_i_b(1:nbpb,jk), jpi, jpj)
347               CALL tab_1d_2d( nbpb, s_i(:,:,jk,jl), npb, s_i_b(1:nbpb,jk), jpi, jpj)
348            END DO
349
350            CALL tab_1d_2d( nbpb, fstric , npb, fstbif_1d (1:nbpb), jpi, jpj )
351            CALL tab_1d_2d( nbpb, qldif  , npb, qldif_1d  (1:nbpb), jpi, jpj )
352            CALL tab_1d_2d( nbpb, qfvbq  , npb, qfvbq_1d  (1:nbpb), jpi, jpj )
353            CALL tab_1d_2d( nbpb, rdmicif, npb, rdmicif_1d(1:nbpb), jpi, jpj )
354            CALL tab_1d_2d( nbpb, rdmsnif, npb, rdmsnif_1d(1:nbpb), jpi, jpj )
355            CALL tab_1d_2d( nbpb, dmgwi  , npb, dmgwi_1d  (1:nbpb), jpi, jpj )
356            CALL tab_1d_2d( nbpb, rdvosif, npb, dvsbq_1d  (1:nbpb), jpi, jpj )
357            CALL tab_1d_2d( nbpb, rdvobif, npb, dvbbq_1d  (1:nbpb), jpi, jpj )
358            CALL tab_1d_2d( nbpb, fdvolif, npb, dvlbq_1d  (1:nbpb), jpi, jpj )
359            CALL tab_1d_2d( nbpb, rdvonif, npb, dvnbq_1d  (1:nbpb), jpi, jpj ) 
360            CALL tab_1d_2d( nbpb, fseqv  , npb, fseqv_1d  (1:nbpb), jpi, jpj )
361
362            IF( num_sal == 2 ) THEN
363               CALL tab_1d_2d( nbpb, fsbri, npb, fsbri_1d(1:nbpb), jpi, jpj )
364               CALL tab_1d_2d( nbpb, fhbri, npb, fhbri_1d(1:nbpb), jpi, jpj )
365            ENDIF
366
367            !+++++
368            !temporary stuff for a dummy version
369            CALL tab_1d_2d( nbpb, dh_i_surf2D, npb, dh_i_surf(1:nbpb)      , jpi, jpj )
370            CALL tab_1d_2d( nbpb, dh_i_bott2D, npb, dh_i_bott(1:nbpb)      , jpi, jpj )
371            CALL tab_1d_2d( nbpb, fsup2D     , npb, fsup     (1:nbpb)      , jpi, jpj )
372            CALL tab_1d_2d( nbpb, focea2D    , npb, focea    (1:nbpb)      , jpi, jpj )
373            CALL tab_1d_2d( nbpb, s_i_newice , npb, s_i_new  (1:nbpb)      , jpi, jpj )
374            CALL tab_1d_2d( nbpb, izero(:,:,jl) , npb, i0    (1:nbpb)      , jpi, jpj )
375            CALL tab_1d_2d( nbpb, qns_ice(:,:,jl), npb, qnsr_ice_1d(1:nbpb), jpi, jpj)
376            !+++++
377
378            IF( lk_mpp )   CALL mpp_comm_free( ncomm_ice ) !RB necessary ??
379         ENDIF
380         !
381      END DO
382
383      !------------------------------------------------------------------------------!
384      ! 5) Global variables, diagnostics
385      !------------------------------------------------------------------------------!
386
387      !------------------------
388      ! 5.1) Ice heat content             
389      !------------------------
390
391      ! Enthalpies are global variables we have to readjust the units
392      zcoef = 1.e0 / ( unit_fac * REAL(nlay_i) )
393      DO jl = 1, jpl
394         DO jk = 1, nlay_i
395            ! Multiply by volume, divide by nlayers so that heat content in 10^9 Joules
396            e_i(:,:,jk,jl) = e_i(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_i(:,:,jl) * zcoef
397         END DO
398      END DO
399
400      !------------------------
401      ! 5.2) Snow heat content             
402      !------------------------
403
404      ! Enthalpies are global variables we have to readjust the units
405      zcoef = 1.e0 / ( unit_fac * REAL(nlay_s) )
406      DO jl = 1, jpl
407         DO jk = 1, nlay_s
408            ! Multiply by volume, so that heat content in 10^9 Joules
409            e_s(:,:,jk,jl) = e_s(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_s(:,:,jl) * zcoef
410         END DO
411      END DO
412
413      !----------------------------------
414      ! 5.3) Change thickness to volume
415      !----------------------------------
416      CALL lim_var_eqv2glo
417
418      !--------------------------------------------
419      ! 5.4) Diagnostic thermodynamic growth rates
420      !--------------------------------------------
421      d_v_i_thd(:,:,:) = v_i      (:,:,:) - old_v_i(:,:,:)    ! ice volumes
422      dv_dt_thd(:,:,:) = d_v_i_thd(:,:,:) / rdt_ice * 86400.0
423
424      IF( con_i )   fbif(:,:) = fbif(:,:) + zqlbsbq(:,:)
425
426      IF(ln_ctl) THEN   ! Control print
427         CALL prt_ctl_info(' ')
428         CALL prt_ctl_info(' - Cell values : ')
429         CALL prt_ctl_info('   ~~~~~~~~~~~~~ ')
430         CALL prt_ctl(tab2d_1=area , clinfo1=' lim_thd  : cell area :')
431         CALL prt_ctl(tab2d_1=at_i , clinfo1=' lim_thd  : at_i      :')
432         CALL prt_ctl(tab2d_1=vt_i , clinfo1=' lim_thd  : vt_i      :')
433         CALL prt_ctl(tab2d_1=vt_s , clinfo1=' lim_thd  : vt_s      :')
434         DO jl = 1, jpl
435            CALL prt_ctl_info(' ')
436            CALL prt_ctl_info(' - Category : ', ivar1=jl)
437            CALL prt_ctl_info('   ~~~~~~~~~~')
438            CALL prt_ctl(tab2d_1=a_i   (:,:,jl)   , clinfo1= ' lim_thd  : a_i      : ')
439            CALL prt_ctl(tab2d_1=ht_i  (:,:,jl)   , clinfo1= ' lim_thd  : ht_i     : ')
440            CALL prt_ctl(tab2d_1=ht_s  (:,:,jl)   , clinfo1= ' lim_thd  : ht_s     : ')
441            CALL prt_ctl(tab2d_1=v_i   (:,:,jl)   , clinfo1= ' lim_thd  : v_i      : ')
442            CALL prt_ctl(tab2d_1=v_s   (:,:,jl)   , clinfo1= ' lim_thd  : v_s      : ')
443            CALL prt_ctl(tab2d_1=e_s   (:,:,1,jl) , clinfo1= ' lim_thd  : e_s      : ')
444            CALL prt_ctl(tab2d_1=t_su  (:,:,jl)   , clinfo1= ' lim_thd  : t_su     : ')
445            CALL prt_ctl(tab2d_1=t_s   (:,:,1,jl) , clinfo1= ' lim_thd  : t_snow   : ')
446            CALL prt_ctl(tab2d_1=sm_i  (:,:,jl)   , clinfo1= ' lim_thd  : sm_i     : ')
447            CALL prt_ctl(tab2d_1=smv_i (:,:,jl)   , clinfo1= ' lim_thd  : smv_i    : ')
448            DO jk = 1, nlay_i
449               CALL prt_ctl_info(' ')
450               CALL prt_ctl_info(' - Layer : ', ivar1=jk)
451               CALL prt_ctl_info('   ~~~~~~~')
452               CALL prt_ctl(tab2d_1=t_i(:,:,jk,jl) , clinfo1= ' lim_thd  : t_i      : ')
453               CALL prt_ctl(tab2d_1=e_i(:,:,jk,jl) , clinfo1= ' lim_thd  : e_i      : ')
454            END DO
455         END DO
456
457      ENDIF
458
459   END SUBROUTINE lim_thd
460
461
462   SUBROUTINE lim_thd_glohec( eti, ets, etilayer, kideb, kiut, jl )
463      !!-----------------------------------------------------------------------
464      !!                   ***  ROUTINE lim_thd_glohec ***
465      !!                 
466      !! ** Purpose :  Compute total heat content for each category
467      !!               Works with 1d vectors only
468      !!-----------------------------------------------------------------------
469      INTEGER , INTENT(in   )                         ::   kideb, kiut   ! bounds for the spatial loop
470      INTEGER , INTENT(in   )                         ::   jl            ! category number
471      REAL(wp), INTENT(  out), DIMENSION (jpij,jpl  ) ::   eti, ets      ! vertically-summed heat content for ice & snow
472      REAL(wp), INTENT(  out), DIMENSION (jpij,jkmax) ::   etilayer      ! heat content for ice layers
473      !!
474      INTEGER  ::   ji,jk   ! loop indices
475      REAL(wp) ::   zeps    ! very small value (1.e-10)
476      !!-----------------------------------------------------------------------
477      eti(:,:) = 0.e0
478      ets(:,:) = 0.e0
479      zeps     = 1.e-10
480
481      DO jk = 1, nlay_i                ! total q over all layers, ice [J.m-2]
482         DO ji = kideb, kiut
483            etilayer(ji,jk) = q_i_b(ji,jk) * ht_i_b(ji) / nlay_i
484            eti     (ji,jl) = eti(ji,jl) + etilayer(ji,jk) 
485         END DO
486      END DO
487      DO ji = kideb, kiut              ! total q over all layers, snow [J.m-2]
488         ets(ji,jl) = ets(ji,jl) + q_s_b(ji,1) * ht_s_b(ji) / nlay_s
489      END DO
490
491      IF(lwp) WRITE(numout,*) ' lim_thd_glohec '
492      IF(lwp) WRITE(numout,*) ' qt_i_in : ', eti(jiindex_1d,jl) / rdt_ice
493      IF(lwp) WRITE(numout,*) ' qt_s_in : ', ets(jiindex_1d,jl) / rdt_ice
494      IF(lwp) WRITE(numout,*) ' qt_in   : ', ( eti(jiindex_1d,jl) + ets(jiindex_1d,jl) ) / rdt_ice
495      !
496   END SUBROUTINE lim_thd_glohec
497
498
499   SUBROUTINE lim_thd_con_dif( kideb, kiut, jl )
500      !!-----------------------------------------------------------------------
501      !!                   ***  ROUTINE lim_thd_con_dif ***
502      !!                 
503      !! ** Purpose :   Test energy conservation after heat diffusion
504      !!-------------------------------------------------------------------
505      INTEGER , INTENT(in   ) ::   kideb, kiut   ! bounds for the spatial loop
506      INTEGER , INTENT(in   ) ::   jl            ! category number
507
508      INTEGER  ::   ji, jk         ! loop indices
509      INTEGER  ::   zji, zjj
510      INTEGER  ::   numce          ! number of points for which conservation is violated
511      REAL(wp) ::   meance         ! mean conservation error
512      REAL(wp) ::   max_cons_err, max_surf_err
513      !!---------------------------------------------------------------------
514
515      max_cons_err =  1.0          ! maximum tolerated conservation error
516      max_surf_err =  0.001        ! maximum tolerated surface error
517
518      !--------------------------
519      ! Increment of energy
520      !--------------------------
521      ! global
522      DO ji = kideb, kiut
523         dq_i(ji,jl) = qt_i_fin(ji,jl) - qt_i_in(ji,jl) + qt_s_fin(ji,jl) - qt_s_in(ji,jl)
524      END DO
525      ! layer by layer
526      dq_i_layer(:,:)    = q_i_layer_fin(:,:) - q_i_layer_in(:,:)
527
528      !----------------------------------------
529      ! Atmospheric heat flux, ice heat budget
530      !----------------------------------------
531
532      DO ji = kideb, kiut
533         zji = MOD( npb(ji) - 1, jpi ) + 1
534         zjj = ( npb(ji) - 1 ) / jpi + 1
535
536         fatm(ji,jl) = qnsr_ice_1d(ji) + (1.0-i0(ji))*qsr_ice_1d(ji)
537
538         sum_fluxq(ji,jl) = fc_su(ji) - fc_bo_i(ji) + qsr_ice_1d(ji)*i0(ji) - fstroc(zji,zjj,jl)
539      END DO
540
541      !--------------------
542      ! Conservation error
543      !--------------------
544
545      DO ji = kideb, kiut
546         cons_error(ji,jl) = ABS( dq_i(ji,jl) / rdt_ice + sum_fluxq(ji,jl) )
547      END DO
548
549      numce = 0
550      meance = 0.0
551      DO ji = kideb, kiut
552         IF ( cons_error(ji,jl) .GT. max_cons_err ) THEN
553            numce = numce + 1
554            meance = meance + cons_error(ji,jl)
555         ENDIF
556      ENDDO
557      IF (numce .GT. 0 ) meance = meance / numce
558
559      WRITE(numout,*) ' Maximum tolerated conservation error : ', max_cons_err
560      WRITE(numout,*) ' After lim_thd_dif, category : ', jl
561      WRITE(numout,*) ' Mean conservation error on big error points ', meance, numit
562      WRITE(numout,*) ' Number of points where there is a cons err gt than c.e. : ', numce, numit
563
564      !-------------------------------------------------------
565      ! Surface error due to imbalance between Fatm and Fcsu
566      !-------------------------------------------------------
567      numce  = 0.0
568      meance = 0.0
569
570      DO ji = kideb, kiut
571         surf_error(ji,jl) = ABS ( fatm(ji,jl) - fc_su(ji) )
572         IF ( ( t_su_b(ji) .LT. rtt ) .AND. ( surf_error(ji,jl) .GT. &
573            max_surf_err ) ) THEN
574            numce = numce + 1 
575            meance = meance + surf_error(ji,jl)
576         ENDIF
577      ENDDO
578      IF (numce .GT. 0 ) meance = meance / numce
579
580      WRITE(numout,*) ' Maximum tolerated surface error : ', max_surf_err
581      WRITE(numout,*) ' After lim_thd_dif, category : ', jl
582      WRITE(numout,*) ' Mean surface error on big error points ', meance, numit
583      WRITE(numout,*) ' Number of points where there is a surf err gt than surf_err : ', numce, numit
584
585      IF (jiindex_1D.GT.0) WRITE(numout,*) ' fc_su      : ', fc_su(jiindex_1d)
586      IF (jiindex_1D.GT.0) WRITE(numout,*) ' fatm       : ', fatm(jiindex_1d,jl)
587      IF (jiindex_1D.GT.0) WRITE(numout,*) ' t_su       : ', t_su_b(jiindex_1d)
588
589      !---------------------------------------
590      ! Write ice state in case of big errors
591      !---------------------------------------
592
593      DO ji = kideb, kiut
594         IF ( ( ( t_su_b(ji) .LT. rtt ) .AND. ( surf_error(ji,jl) .GT. max_surf_err ) ) .OR. &
595            ( cons_error(ji,jl) .GT. max_cons_err  ) ) THEN
596            zji                 = MOD( npb(ji) - 1, jpi ) + 1
597            zjj                 = ( npb(ji) - 1 ) / jpi + 1
598
599            WRITE(numout,*) ' alerte 1     '
600            WRITE(numout,*) ' Untolerated conservation / surface error after '
601            WRITE(numout,*) ' heat diffusion in the ice '
602            WRITE(numout,*) ' Category   : ', jl
603            WRITE(numout,*) ' zji , zjj  : ', zji, zjj
604            WRITE(numout,*) ' lat, lon   : ', gphit(zji,zjj), glamt(zji,zjj)
605            WRITE(numout,*) ' cons_error : ', cons_error(ji,jl)
606            WRITE(numout,*) ' surf_error : ', surf_error(ji,jl)
607            WRITE(numout,*) ' dq_i       : ', - dq_i(ji,jl) / rdt_ice
608            WRITE(numout,*) ' Fdt        : ', sum_fluxq(ji,jl)
609            WRITE(numout,*)
610            !        WRITE(numout,*) ' qt_i_in   : ', qt_i_in(ji,jl)
611            !        WRITE(numout,*) ' qt_s_in   : ', qt_s_in(ji,jl)
612            !        WRITE(numout,*) ' qt_i_fin  : ', qt_i_fin(ji,jl)
613            !        WRITE(numout,*) ' qt_s_fin  : ', qt_s_fin(ji,jl)
614            !        WRITE(numout,*) ' qt        : ', qt_i_fin(ji,jl) + &
615            !                                         qt_s_fin(ji,jl)
616            WRITE(numout,*) ' ht_i       : ', ht_i_b(ji)
617            WRITE(numout,*) ' ht_s       : ', ht_s_b(ji)
618            WRITE(numout,*) ' t_su       : ', t_su_b(ji)
619            WRITE(numout,*) ' t_s        : ', t_s_b(ji,1)
620            WRITE(numout,*) ' t_i        : ', t_i_b(ji,1:nlay_i)
621            WRITE(numout,*) ' t_bo       : ', t_bo_b(ji)
622            WRITE(numout,*) ' q_i        : ', q_i_b(ji,1:nlay_i)
623            WRITE(numout,*) ' s_i        : ', s_i_b(ji,1:nlay_i)
624            WRITE(numout,*) ' tmelts     : ', rtt - tmut*s_i_b(ji,1:nlay_i)
625            WRITE(numout,*)
626            WRITE(numout,*) ' Fluxes '
627            WRITE(numout,*) ' ~~~~~~ '
628            WRITE(numout,*) ' fatm       : ', fatm(ji,jl)
629            WRITE(numout,*) ' fc_su      : ', fc_su    (ji)
630            WRITE(numout,*) ' fstr_inice : ', qsr_ice_1d(ji)*i0(ji)
631            WRITE(numout,*) ' fc_bo      : ', - fc_bo_i  (ji)
632            WRITE(numout,*) ' foc        : ', fbif_1d(ji)
633            WRITE(numout,*) ' fstroc     : ', fstroc   (zji,zjj,jl)
634            WRITE(numout,*) ' i0         : ', i0(ji)
635            WRITE(numout,*) ' qsr_ice    : ', (1.0-i0(ji))*qsr_ice_1d(ji)
636            WRITE(numout,*) ' qns_ice    : ', qnsr_ice_1d(ji)
637            WRITE(numout,*) ' Conduction fluxes : '
638            WRITE(numout,*) ' fc_s      : ', fc_s(ji,0:nlay_s)
639            WRITE(numout,*) ' fc_i      : ', fc_i(ji,0:nlay_i)
640            WRITE(numout,*)
641            WRITE(numout,*) ' Layer by layer ... '
642            WRITE(numout,*) ' dq_snow : ', ( qt_s_fin(ji,jl) - &
643               qt_s_in(ji,jl) )  & 
644               / rdt_ice
645            WRITE(numout,*) ' dfc_snow  : ', fc_s(ji,1) -      &
646               fc_s(ji,0)
647            DO jk = 1, nlay_i
648               WRITE(numout,*) ' layer  : ', jk
649               WRITE(numout,*) ' dq_ice : ', dq_i_layer(ji,jk) / rdt_ice 
650               WRITE(numout,*) ' radab  : ', radab(ji,jk)
651               WRITE(numout,*) ' dfc_i  : ', fc_i(ji,jk) -               &
652                  fc_i(ji,jk-1)
653               WRITE(numout,*) ' tot f  : ', fc_i(ji,jk) -               &
654                  fc_i(ji,jk-1) - radab(ji,jk)
655            END DO
656
657         ENDIF
658
659      END DO
660      !
661   END SUBROUTINE lim_thd_con_dif
662
663
664   SUBROUTINE lim_thd_con_dh(kideb,kiut,jl)
665      !!-----------------------------------------------------------------------
666      !!                   ***  ROUTINE lim_thd_con_dh  ***
667      !!                 
668      !! ** Purpose :   Test energy conservation after enthalpy redistr.
669      !!
670      !! history :
671      !!  9.9  ! 07-04 (M.Vancoppenolle) original code
672      !!-----------------------------------------------------------------------
673      INTEGER, INTENT(in) ::        &
674         kideb, kiut,               &  !: bounds for the spatial loop
675         jl                            !: category number
676
677      REAL(wp)                 ::   &  !: ! goes to trash
678         meance,                    &  !: mean conservation error
679         max_cons_err                  !: maximum tolerated conservation error
680
681      INTEGER ::                    &
682         numce                         !: number of points for which conservation
683      !  is violated
684      INTEGER  ::  ji, zji, zjj        ! loop indices
685      !!---------------------------------------------------------------------
686
687      max_cons_err = 1.0
688
689      !--------------------------
690      ! Increment of energy
691      !--------------------------
692      ! global
693      DO ji = kideb, kiut
694         dq_i(ji,jl) = qt_i_fin(ji,jl) - qt_i_in(ji,jl)  &
695            + qt_s_fin(ji,jl) - qt_s_in(ji,jl)
696      END DO
697      ! layer by layer
698      dq_i_layer(:,:)    = q_i_layer_fin(:,:) - q_i_layer_in(:,:)
699
700      !----------------------------------------
701      ! Atmospheric heat flux, ice heat budget
702      !----------------------------------------
703
704      DO ji = kideb, kiut
705         zji                 = MOD( npb(ji) - 1, jpi ) + 1
706         zjj                 = ( npb(ji) - 1 ) / jpi + 1
707
708         fatm(ji,jl) = &
709            qnsr_ice_1d(ji)                  + & ! atm non solar
710            !         (1.0-i0(ji))*qsr_ice_1d(ji)          ! atm solar
711            qsr_ice_1d(ji)                       ! atm solar
712
713         sum_fluxq(ji,jl)     = fatm(ji,jl) + fbif_1d(ji) - ftotal_fin(ji) & 
714            - fstroc(zji,zjj,jl) 
715         cons_error(ji,jl)   = ABS( dq_i(ji,jl) / rdt_ice + sum_fluxq(ji,jl) )
716      END DO
717
718      !--------------------
719      ! Conservation error
720      !--------------------
721
722      DO ji = kideb, kiut
723         cons_error(ji,jl) = ABS( dq_i(ji,jl) / rdt_ice + sum_fluxq(ji,jl) )
724      END DO
725
726      numce = 0
727      meance = 0.0
728      DO ji = kideb, kiut
729         IF ( cons_error(ji,jl) .GT. max_cons_err ) THEN
730            numce = numce + 1
731            meance = meance + cons_error(ji,jl)
732         ENDIF
733      ENDDO
734      IF (numce .GT. 0 ) meance = meance / numce
735
736      WRITE(numout,*) ' Error report - Category : ', jl
737      WRITE(numout,*) ' ~~~~~~~~~~~~ '
738      WRITE(numout,*) ' Maximum tolerated conservation error : ', max_cons_err
739      WRITE(numout,*) ' After lim_thd_ent, category : ', jl
740      WRITE(numout,*) ' Mean conservation error on big error points ', meance, &
741         numit
742      WRITE(numout,*) ' Number of points where there is a cons err gt than 0.1 W/m2 : ', numce, numit
743
744      !---------------------------------------
745      ! Write ice state in case of big errors
746      !---------------------------------------
747
748      DO ji = kideb, kiut
749         IF ( cons_error(ji,jl) .GT. max_cons_err  ) THEN
750            zji                 = MOD( npb(ji) - 1, jpi ) + 1
751            zjj                 = ( npb(ji) - 1 ) / jpi + 1
752
753            WRITE(numout,*) ' alerte 1 - category : ', jl
754            WRITE(numout,*) ' Untolerated conservation error after limthd_ent '
755            WRITE(numout,*) ' zji , zjj  : ', zji, zjj
756            WRITE(numout,*) ' lat, lon   : ', gphit(zji,zjj), glamt(zji,zjj)
757            WRITE(numout,*) ' * '
758            WRITE(numout,*) ' Ftotal     : ', sum_fluxq(ji,jl)
759            WRITE(numout,*) ' dq_t       : ', - dq_i(ji,jl) / rdt_ice
760            WRITE(numout,*) ' dq_i       : ', - ( qt_i_fin(ji,jl) - qt_i_in(ji,jl) ) / rdt_ice
761            WRITE(numout,*) ' dq_s       : ', - ( qt_s_fin(ji,jl) - qt_s_in(ji,jl) ) / rdt_ice
762            WRITE(numout,*) ' cons_error : ', cons_error(ji,jl)
763            WRITE(numout,*) ' * '
764            WRITE(numout,*) ' Fluxes        --- : '
765            WRITE(numout,*) ' fatm       : ', fatm(ji,jl)
766            WRITE(numout,*) ' foce       : ', fbif_1d(ji)
767            WRITE(numout,*) ' fres       : ', ftotal_fin(ji)
768            WRITE(numout,*) ' fhbri      : ', fhbricat(zji,zjj,jl)
769            WRITE(numout,*) ' * '
770            WRITE(numout,*) ' Heat contents --- : '
771            WRITE(numout,*) ' qt_s_in    : ', qt_s_in(ji,jl) / rdt_ice
772            WRITE(numout,*) ' qt_i_in    : ', qt_i_in(ji,jl) / rdt_ice
773            WRITE(numout,*) ' qt_in      : ', ( qt_i_in(ji,jl) + &
774               qt_s_in(ji,jl) ) / rdt_ice
775            WRITE(numout,*) ' qt_s_fin   : ', qt_s_fin(ji,jl) / rdt_ice
776            WRITE(numout,*) ' qt_i_fin   : ', qt_i_fin(ji,jl) / rdt_ice
777            WRITE(numout,*) ' qt_fin     : ', ( qt_i_fin(ji,jl) + &
778               qt_s_fin(ji,jl) ) / rdt_ice
779            WRITE(numout,*) ' * '
780            WRITE(numout,*) ' Ice variables --- : '
781            WRITE(numout,*) ' ht_i       : ', ht_i_b(ji)
782            WRITE(numout,*) ' ht_s       : ', ht_s_b(ji)
783            WRITE(numout,*) ' dh_s_tot  : ', dh_s_tot(ji)
784            WRITE(numout,*) ' dh_snowice: ', dh_snowice(ji)
785            WRITE(numout,*) ' dh_i_surf : ', dh_i_surf(ji)
786            WRITE(numout,*) ' dh_i_bott : ', dh_i_bott(ji)
787
788         ENDIF
789         !
790      END DO
791      !
792   END SUBROUTINE lim_thd_con_dh
793
794
795   SUBROUTINE lim_thd_enmelt( kideb, kiut )
796      !!-----------------------------------------------------------------------
797      !!                   ***  ROUTINE lim_thd_enmelt ***
798      !!                 
799      !! ** Purpose :   Computes sea ice energy of melting q_i (J.m-3)
800      !!
801      !! ** Method  :   Formula (Bitz and Lipscomb, 1999)
802      !!
803      !!-------------------------------------------------------------------
804      INTEGER, INTENT(in) ::   kideb, kiut   ! bounds for the spatial loop
805      !!
806      INTEGER  ::   ji, jk   !dummy loop indices
807      REAL(wp) ::   ztmelts, zeps   ! temporary scalar
808      !!-------------------------------------------------------------------
809      zeps = 1.e-10
810      !
811      DO jk = 1, nlay_i             ! Sea ice energy of melting
812         DO ji = kideb, kiut
813            ztmelts      =  - tmut  * s_i_b(ji,jk) + rtt 
814            q_i_b(ji,jk) =    rhoic * ( cpic * ( ztmelts - t_i_b(ji,jk) )                                 &
815               &                      + lfus * ( 1.0 - (ztmelts-rtt) / MIN( t_i_b(ji,jk)-rtt, -zeps ) )   &
816               &                      - rcp  * ( ztmelts-rtt  )  ) 
817         END DO
818      END DO
819      DO jk = 1, nlay_s             ! Snow energy of melting
820         DO ji = kideb,kiut
821            q_s_b(ji,jk) = rhosn * ( cpic * ( rtt - t_s_b(ji,jk) ) + lfus )
822         END DO
823      END DO
824      !
825   END SUBROUTINE lim_thd_enmelt
826
827
828   SUBROUTINE lim_thd_init
829
830      !!-----------------------------------------------------------------------
831      !!                   ***  ROUTINE lim_thd_init ***
832      !!                 
833      !! ** Purpose :   Physical constants and parameters linked to the ice
834      !!              thermodynamics
835      !!
836      !! ** Method  :   Read the namicethd namelist and check the ice-thermo
837      !!              parameter values called at the first timestep (nit000)
838      !!
839      !! ** input   :   Namelist namicether
840       !!-------------------------------------------------------------------
841      NAMELIST/namicethd/ hmelt , hiccrit, fraz_swi, maxfrazb, vfrazb, Cfrazb,   &
842         &                hicmin, hiclim, amax  ,                                &
843         &                sbeta  , parlat, hakspl, hibspl, exld,                 &
844         &                hakdif, hnzst  , thth  , parsub, alphs, betas,         & 
845         &                kappa_i, nconv_i_thd, maxer_i_thd, thcon_i_swi
846      !!-------------------------------------------------------------------
847
848      IF(lwp) THEN
849         WRITE(numout,*)
850         WRITE(numout,*) 'lim_thd : Ice Thermodynamics'
851         WRITE(numout,*) '~~~~~~~'
852      ENDIF
853
854      REWIND( numnam_ice )                  ! read Namelist numnam_ice
855      READ  ( numnam_ice , namicethd )
856     
857      IF(lwp) THEN                          ! control print
858         WRITE(numout,*)
859         WRITE(numout,*)'   Namelist of ice parameters for ice thermodynamic computation '
860         WRITE(numout,*)'      maximum melting at the bottom                           hmelt        = ', hmelt
861         WRITE(numout,*)'      ice thick. for lateral accretion in NH (SH)             hiccrit(1/2) = ', hiccrit
862         WRITE(numout,*)'      Frazil ice thickness as a function of wind or not       fraz_swi     = ', fraz_swi
863         WRITE(numout,*)'      Maximum proportion of frazil ice collecting at bottom   maxfrazb     = ', maxfrazb
864         WRITE(numout,*)'      Thresold relative drift speed for collection of frazil  vfrazb       = ', vfrazb
865         WRITE(numout,*)'      Squeezing coefficient for collection of frazil          Cfrazb       = ', Cfrazb
866         WRITE(numout,*)'      ice thick. corr. to max. energy stored in brine pocket  hicmin       = ', hicmin 
867         WRITE(numout,*)'      minimum ice thickness                                   hiclim       = ', hiclim 
868         WRITE(numout,*)'      maximum lead fraction                                   amax         = ', amax
869         WRITE(numout,*)'      numerical carac. of the scheme for diffusion in ice '
870         WRITE(numout,*)'      Cranck-Nicholson (=0.5), implicit (=1), explicit (=0)   sbeta        = ', sbeta
871         WRITE(numout,*)'      percentage of energy used for lateral ablation          parlat       = ', parlat
872         WRITE(numout,*)'      slope of distr. for Hakkinen-Mellor lateral melting     hakspl       = ', hakspl 
873         WRITE(numout,*)'      slope of distribution for Hibler lateral melting        hibspl       = ', hibspl
874         WRITE(numout,*)'      exponent for leads-closure rate                         exld         = ', exld
875         WRITE(numout,*)'      coefficient for diffusions of ice and snow              hakdif       = ', hakdif
876         WRITE(numout,*)'      threshold thick. for comp. of eq. thermal conductivity  zhth         = ', thth 
877         WRITE(numout,*)'      thickness of the surf. layer in temp. computation       hnzst        = ', hnzst
878         WRITE(numout,*)'      switch for snow sublimation  (=1) or not (=0)           parsub       = ', parsub 
879         WRITE(numout,*)'      coefficient for snow density when snow ice formation    alphs        = ', alphs
880         WRITE(numout,*)'      coefficient for ice-lead partition of snowfall          betas        = ', betas
881         WRITE(numout,*)'      extinction radiation parameter in sea ice (1.0)         kappa_i      = ', kappa_i
882         WRITE(numout,*)'      maximal n. of iter. for heat diffusion computation      nconv_i_thd  = ', nconv_i_thd
883         WRITE(numout,*)'      maximal err. on T for heat diffusion computation        maxer_i_thd  = ', maxer_i_thd
884         WRITE(numout,*)'      switch for comp. of thermal conductivity in the ice     thcon_i_swi  = ', thcon_i_swi
885      ENDIF
886      !
887      rcdsn = hakdif * rcdsn 
888      rcdic = hakdif * rcdic
889      !
890   END SUBROUTINE lim_thd_init
891
892#else
893   !!----------------------------------------------------------------------
894   !!   Default option                               NO  LIM3 sea-ice model
895   !!----------------------------------------------------------------------
896CONTAINS
897   SUBROUTINE lim_thd         ! Empty routine
898   END SUBROUTINE lim_thd
899   SUBROUTINE lim_thd_con_dif
900   END SUBROUTINE lim_thd_con_dif
901#endif
902
903   !!======================================================================
904END MODULE limthd
Note: See TracBrowser for help on using the repository browser.