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 @ 1758

Last change on this file since 1758 was 1758, checked in by rblod, 14 years ago

Revert previous commit (ticket #611) which was only due to my astonishing stupidity, I'll have to find another guilty routine for AGRIF...

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