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

source: branches/2013/dev_r3853_CNRS9_ConfSetting/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90 @ 3875

Last change on this file since 3875 was 3875, checked in by clevy, 11 years ago

Configuration Setting/Step? 1, see ticket:#1074

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