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

Last change on this file since 1756 was 1755, checked in by rblod, 15 years ago

Suppress useless use, see ticket #611

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