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

source: trunk/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90 @ 2569

Last change on this file since 2569 was 2528, checked in by rblod, 13 years ago

Update NEMOGCM from branch nemo_v3_3_beta

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