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

source: branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90 @ 4634

Last change on this file since 4634 was 4634, checked in by clem, 10 years ago

major changes in heat budget

  • Property svn:keywords set to Id
File size: 38.0 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 wfx_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   !!             -   ! 2012-05 (C. Rousset) add penetration solar flux
14   !!----------------------------------------------------------------------
15#if defined key_lim3
16   !!----------------------------------------------------------------------
17   !!   'key_lim3'                                      LIM3 sea-ice model
18   !!----------------------------------------------------------------------
19   !!   lim_thd       : thermodynamic of sea ice
20   !!   lim_thd_init  : initialisation of sea-ice thermodynamic
21   !!----------------------------------------------------------------------
22   USE phycst         ! physical constants
23   USE dom_oce        ! ocean space and time domain variables
24   USE oce     , ONLY :  iatte, oatte
25   USE ice            ! LIM: sea-ice variables
26   USE par_ice        ! LIM: sea-ice parameters
27   USE sbc_oce        ! Surface boundary condition: ocean fields
28   USE sbc_ice        ! Surface boundary condition: ice fields
29   USE thd_ice        ! LIM thermodynamic sea-ice variables
30   USE dom_ice        ! LIM sea-ice domain
31   USE domvvl         ! domain: variable volume level
32   USE limthd_dif     ! LIM: thermodynamics, vertical diffusion
33   USE limthd_dh      ! LIM: thermodynamics, ice and snow thickness variation
34   USE limthd_sal     ! LIM: thermodynamics, ice salinity
35   USE limthd_ent     ! LIM: thermodynamics, ice enthalpy redistribution
36   USE limtab         ! LIM: 1D <==> 2D transformation
37   USE limvar         ! LIM: sea-ice variables
38   USE lbclnk         ! lateral boundary condition - MPP links
39   USE lib_mpp        ! MPP library
40   USE wrk_nemo       ! work arrays
41   USE in_out_manager ! I/O manager
42   USE prtctl         ! Print control
43   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
44   USE timing         ! Timing
45   USE cpl_oasis3, ONLY : lk_cpl
46
47   IMPLICIT NONE
48   PRIVATE
49
50   PUBLIC   lim_thd        ! called by limstp module
51   PUBLIC   lim_thd_init   ! called by iceini module
52
53   REAL(wp) ::   epsi10 = 1.e-10_wp   !
54
55   !! * Substitutions
56#  include "domzgr_substitute.h90"
57#  include "vectopt_loop_substitute.h90"
58   !!----------------------------------------------------------------------
59   !! NEMO/LIM3 3.3 , UCL - NEMO Consortium (2010)
60   !! $Id$
61   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
62   !!----------------------------------------------------------------------
63CONTAINS
64
65   SUBROUTINE lim_thd( kt )
66      !!-------------------------------------------------------------------
67      !!                ***  ROUTINE lim_thd  ***       
68      !! 
69      !! ** Purpose : This routine manages the ice thermodynamic.
70      !!         
71      !! ** Action : - Initialisation of some variables
72      !!             - Some preliminary computation (oceanic heat flux
73      !!               at the ice base, snow acc.,heat budget of the leads)
74      !!             - selection of the icy points and put them in an array
75      !!             - call lim_vert_ther for vert ice thermodynamic
76      !!             - back to the geographic grid
77      !!             - selection of points for lateral accretion
78      !!             - call lim_lat_acc  for the ice accretion
79      !!             - back to the geographic grid
80      !!     
81      !! ** References : H. Goosse et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90
82      !!---------------------------------------------------------------------
83      INTEGER, INTENT(in) ::   kt    ! number of iteration
84      !!
85      INTEGER  :: ji, jj, jk, jl   ! dummy loop indices
86      INTEGER  :: nbpb             ! nb of icy pts for thermo. cal.
87      INTEGER  :: ii, ij           ! temporary dummy loop index
88      REAL(wp) :: zfric_umin = 5e-03_wp    ! lower bound for the friction velocity
89      REAL(wp) :: zfric_umax = 2e-02_wp    ! upper bound for the friction velocity
90      REAL(wp) :: zinda, zindb, zfric_u     ! local scalar
91      REAL(wp) :: zareamin  !    -         -
92      REAL(wp) :: zchk_v_i, zchk_smv, zchk_e_i, zchk_fs, zchk_fw, zchk_ft, zchk_v_i_b, zchk_smv_b, zchk_e_i_b, zchk_fs_b, zchk_fw_b, zchk_ft_b 
93      REAL(wp) :: zchk_vmin, zchk_amin, zchk_amax ! Check errors (C Rousset)
94      REAL(wp) :: zqld, zqfr
95      REAL(wp), POINTER, DIMENSION(:) :: zdq, zq_ini, zhfx, zqfx
96      REAL(wp)                        :: zhfx_err, ztest
97      !!-------------------------------------------------------------------
98      IF( nn_timing == 1 )  CALL timing_start('limthd')
99
100      CALL wrk_alloc( jpij, zdq, zq_ini, zhfx, zqfx )
101   
102      ! init debug
103      zdq(:) = 0._wp ; zq_ini(:) = 0._wp ; zhfx(:) = 0._wp ; zqfx(:) = 0._wp     
104
105      ! -------------------------------
106      !- check conservation (C Rousset)
107      IF (ln_limdiahsb) THEN
108         zchk_v_i_b = glob_sum( SUM(   v_i(:,:,:)*rhoic + v_s(:,:,:)*rhosn, dim=3 ) * area(:,:) * tms(:,:) )
109         zchk_smv_b = glob_sum( SUM( smv_i(:,:,:), dim=3 ) * area(:,:) * tms(:,:) )
110         zchk_e_i_b = glob_sum( SUM(   e_i(:,:,1:nlay_i,:), dim=3 ) + SUM( e_s(:,:,1:nlay_s,:), dim=3 ) )
111         zchk_fw_b  = glob_sum( ( wfx_bog(:,:) + wfx_bom(:,:) + wfx_sum(:,:) + wfx_sni(:,:) + wfx_opw(:,:) + wfx_res(:,:) + wfx_dyn(:,:) + wfx_snw(:,:) ) * area(:,:) * tms(:,:) )
112         zchk_fs_b  = glob_sum( ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) + sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) ) * area(:,:) * tms(:,:) )
113         zchk_ft_b  = glob_sum( ( hfx_tot(:,:) - hfx_thd(:,:) - hfx_dyn(:,:) - hfx_res(:,:) ) * area(:,:) / unit_fac * tms(:,:) )
114      ENDIF
115      !- check conservation (C Rousset)
116      ! -------------------------------
117
118      !------------------------------------------------------------------------------!
119      ! 1) Initialization of diagnostic variables                                    !
120      !------------------------------------------------------------------------------!
121
122      !--------------------
123      ! 1.2) Heat content   
124      !--------------------
125      ! Change the units of heat content; from global units to J.m3
126      DO jl = 1, jpl
127         DO jk = 1, nlay_i
128            DO jj = 1, jpj
129               DO ji = 1, jpi
130                  !0 if no ice and 1 if yes
131                  zindb = 1.0 - MAX(  0.0 , SIGN( 1.0 , - v_i(ji,jj,jl) + epsi10 )  )
132                  !Energy of melting q(S,T) [J.m-3]
133                  e_i(ji,jj,jk,jl) = zindb * e_i(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_i(ji,jj,jl) , epsi10 ) ) * REAL( nlay_i )
134                  !convert units ! very important that this line is here       
135                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * unit_fac 
136               END DO
137            END DO
138         END DO
139         DO jk = 1, nlay_s
140            DO jj = 1, jpj
141               DO ji = 1, jpi
142                  !0 if no ice and 1 if yes
143                  zindb = 1.0 - MAX(  0.0 , SIGN( 1.0 , - v_s(ji,jj,jl) + epsi10 )  )
144                  !Energy of melting q(S,T) [J.m-3]
145                  e_s(ji,jj,jk,jl) = zindb * e_s(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_s(ji,jj,jl) , epsi10 ) ) * REAL( nlay_s )
146                  !convert units ! very important that this line is here
147                  e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * unit_fac 
148               END DO
149            END DO
150         END DO
151      END DO
152
153      ! 2) Partial computation of forcing for the thermodynamic sea ice model.      !
154      !-----------------------------------------------------------------------------!
155
156!CDIR NOVERRCHK
157      DO jj = 1, jpj
158!CDIR NOVERRCHK
159         DO ji = 1, jpi
160            zinda          = tms(ji,jj) * ( 1.0 - MAX( 0._wp , SIGN( 1._wp , - at_i(ji,jj) + epsi10 ) ) ) ! 0 if no ice
161            !
162            !           !  solar irradiance transmission at the mixed layer bottom and used in the lead heat budget
163            !           !  practically no "direct lateral ablation"
164            !           
165            !           !  net downward heat flux from the ice to the ocean, expressed as a function of ocean
166            !           !  temperature and turbulent mixing (McPhee, 1992)
167
168            ! friction velocity
169            zfric_u        = MAX ( MIN( SQRT( ust2s(ji,jj) ) , zfric_umax ) , zfric_umin ) 
170
171            !-- Energy from the turbulent oceanic heat flux. here the drag will depend on ice thickness and type (0.006)
172            fhtur(ji,jj)  = zinda * rau0 * rcp * 0.006  * zfric_u * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) ) ! W.m-2
173            ! clem: why not the following?
174            !fhtur(ji,jj)  = zinda * rau0 * rcp * 0.006  * SQRT( ust2s(ji,jj) ) * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) )
175
176            !-- Energy received in the lead, zqld is defined everywhere (J.m-2)
177            !   It includes turbulent ocean heat flux (only in the leads, the rest is used for bottom melting)
178            zqld =  tms(ji,jj) * rdt_ice *                               &
179               &  ( pfrld(ji,jj)        * ( qsr(ji,jj) * oatte(ji,jj)           &   ! solar heat + clem modif
180               &                          + qns(ji,jj)                          &   ! non solar heat
181               &                          + fhtur(ji,jj) )                      &   ! turbulent ice-ocean heat (0 if no ice)
182               ! latent heat of precip (note that precip is included in qns but not in qns_ice)
183               &    + ( pfrld(ji,jj)**betas - pfrld(ji,jj) ) * sprecip(ji,jj) * ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rtt ) - lfus )  &
184               &    + ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rtt ) )
185
186            !-- Energy needed to bring ocean surface layer until its freezing (<0, J.m-2)
187            zqfr = tms(ji,jj) * rau0 * rcp * fse3t_m(ji,jj,1) * ( t_bo(ji,jj) - ( sst_m(ji,jj) + rt0 ) )
188
189            !-- Energy Budget of the leads (J.m-2). Must be < 0 to form ice
190            qlead(ji,jj) = MIN( 0._wp , zqld - zqfr ) 
191
192            ! If there is ice and leads are warming, then transfer energy from the lead budget and use it for bottom melting
193            IF( at_i(ji,jj) > epsi10 .AND. zqld > 0._wp ) THEN
194               fhld (ji,jj) = zqld * r1_rdtice / at_i(ji,jj) ! divided by a_i since this is (re)multiplied by a_i in limthd_dh.F90
195               qlead(ji,jj) = 0._wp
196            ENDIF
197            !
198            IF( qlead(ji,jj) == 0._wp )  zqld = 0._wp ; zqfr = 0._wp
199            !
200            ! -----------------------------------------
201            ! Net heat flux on top of ice-ocean [W.m-2]
202            ! -----------------------------------------
203            !     First  step here      : heat flux at the ocean surface + precip
204            !     Second step below     : heat flux at the ice   surface (after limthd_dif)
205            hfx_in(ji,jj) = hfx_in(ji,jj)                                                                                         & 
206               ! heat flux above the ocean
207               &    +             pfrld(ji,jj)   * ( qns(ji,jj) + qsr(ji,jj) )                                                    &
208               ! latent heat of precip (note that precip is included in qns but not in qns_ice)
209               &    +   ( 1._wp - pfrld(ji,jj) ) * sprecip(ji,jj) * ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rtt ) - lfus )  &
210               &    +   ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rtt )
211
212            ! -----------------------------------------------------------------------------
213            ! Net heat flux that is retroceded to the ocean or taken from the ocean [W.m-2]
214            ! -----------------------------------------------------------------------------
215            !     First  step here              :  non solar + precip - qlead - qturb
216            !     Second step in limthd_dh      :  heat remaining if total melt (zq_rema)
217            !     Third  step in limsbc         :  heat from ice-ocean mass exchange (zf_mass) + solar
218            hfx_out(ji,jj) = hfx_out(ji,jj)                                                                                                        & 
219               ! Non solar heat flux received by the ocean
220               &    +        pfrld(ji,jj) * qns(ji,jj)                                                                                             &
221               ! latent heat of precip (note that precip is included in qns but not in qns_ice)
222               &    +      ( pfrld(ji,jj)**betas - pfrld(ji,jj) ) * sprecip(ji,jj) * ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rtt ) - lfus )  &
223               &    +      ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rtt )                        &
224               ! heat flux taken from the ocean where there is open water ice formation
225               &    -      qlead(ji,jj) * r1_rdtice                                                                                                &
226               ! heat flux taken from the ocean during bottom growth/melt (fhld should be 0 while bott growth)
227               &    -      at_i(ji,jj) * fhtur(ji,jj)                                                                                              &
228               &    -      at_i(ji,jj) *  fhld(ji,jj)
229
230         END DO
231      END DO
232
233      !------------------------------------------------------------------------------!
234      ! 3) Select icy points and fulfill arrays for the vectorial grid.           
235      !------------------------------------------------------------------------------!
236
237      DO jl = 1, jpl      !loop over ice categories
238
239         IF( kt == nit000 .AND. lwp ) THEN
240            WRITE(numout,*) ' lim_thd : transfer to 1D vectors. Category no : ', jl 
241            WRITE(numout,*) ' ~~~~~~~~'
242         ENDIF
243
244         zareamin = epsi10
245         nbpb = 0
246         DO jj = 1, jpj
247            DO ji = 1, jpi
248               IF ( a_i(ji,jj,jl) .gt. zareamin ) THEN     
249                  nbpb      = nbpb  + 1
250                  npb(nbpb) = (jj - 1) * jpi + ji
251               ENDIF
252            END DO
253         END DO
254
255         ! debug point to follow
256         jiindex_1d = 0
257         IF( ln_nicep ) THEN
258            DO ji = mi0(jiindx), mi1(jiindx)
259               DO jj = mj0(jjindx), mj1(jjindx)
260                  jiindex_1d = (jj - 1) * jpi + ji
261                  WRITE(numout,*) ' lim_thd : Category no : ', jl 
262               END DO
263            END DO
264         ENDIF
265
266         !------------------------------------------------------------------------------!
267         ! 4) Thermodynamic computation
268         !------------------------------------------------------------------------------!
269
270         IF( lk_mpp )   CALL mpp_ini_ice( nbpb , numout )
271
272         IF( nbpb > 0 ) THEN  ! If there is no ice, do nothing.
273
274            !-------------------------
275            ! 4.1 Move to 1D arrays
276            !-------------------------
277
278            CALL tab_2d_1d( nbpb, at_i_b     (1:nbpb), at_i            , jpi, jpj, npb(1:nbpb) )
279            CALL tab_2d_1d( nbpb, a_i_b      (1:nbpb), a_i(:,:,jl)     , jpi, jpj, npb(1:nbpb) )
280            CALL tab_2d_1d( nbpb, ht_i_b     (1:nbpb), ht_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
281            CALL tab_2d_1d( nbpb, ht_s_b     (1:nbpb), ht_s(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
282
283            CALL tab_2d_1d( nbpb, t_su_b     (1:nbpb), t_su(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
284            CALL tab_2d_1d( nbpb, sm_i_b     (1:nbpb), sm_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
285            DO jk = 1, nlay_s
286               CALL tab_2d_1d( nbpb, t_s_b(1:nbpb,jk), t_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
287               CALL tab_2d_1d( nbpb, q_s_b(1:nbpb,jk), e_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
288            END DO
289            DO jk = 1, nlay_i
290               CALL tab_2d_1d( nbpb, t_i_b(1:nbpb,jk), t_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
291               CALL tab_2d_1d( nbpb, q_i_b(1:nbpb,jk), e_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
292               CALL tab_2d_1d( nbpb, s_i_b(1:nbpb,jk), s_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
293            END DO
294
295            CALL tab_2d_1d( nbpb, tatm_ice_1d(1:nbpb), tatm_ice(:,:)   , jpi, jpj, npb(1:nbpb) )
296            CALL tab_2d_1d( nbpb, qsr_ice_1d (1:nbpb), qsr_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
297            CALL tab_2d_1d( nbpb, fr1_i0_1d  (1:nbpb), fr1_i0          , jpi, jpj, npb(1:nbpb) )
298            CALL tab_2d_1d( nbpb, fr2_i0_1d  (1:nbpb), fr2_i0          , jpi, jpj, npb(1:nbpb) )
299            CALL tab_2d_1d( nbpb, qns_ice_1d (1:nbpb), qns_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
300            CALL tab_2d_1d( nbpb, ftr_ice_1d (1:nbpb), ftr_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
301            IF( .NOT. lk_cpl ) THEN
302               CALL tab_2d_1d( nbpb, qla_ice_1d (1:nbpb), qla_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
303               CALL tab_2d_1d( nbpb, dqla_ice_1d(1:nbpb), dqla_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
304            ENDIF
305            CALL tab_2d_1d( nbpb, dqns_ice_1d(1:nbpb), dqns_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
306            CALL tab_2d_1d( nbpb, t_bo_b     (1:nbpb), t_bo            , jpi, jpj, npb(1:nbpb) )
307            CALL tab_2d_1d( nbpb, sprecip_1d (1:nbpb), sprecip         , jpi, jpj, npb(1:nbpb) ) 
308            CALL tab_2d_1d( nbpb, fhtur_1d   (1:nbpb), fhtur           , jpi, jpj, npb(1:nbpb) )
309            CALL tab_2d_1d( nbpb, qlead_1d   (1:nbpb), qlead           , jpi, jpj, npb(1:nbpb) )
310            CALL tab_2d_1d( nbpb, fhld_1d    (1:nbpb), fhld            , jpi, jpj, npb(1:nbpb) )
311
312            CALL tab_2d_1d( nbpb, wfx_snw_1d (1:nbpb), wfx_snw         , jpi, jpj, npb(1:nbpb) )
313            CALL tab_2d_1d( nbpb, wfx_sub_1d (1:nbpb), wfx_sub         , jpi, jpj, npb(1:nbpb) )
314
315            CALL tab_2d_1d( nbpb, wfx_bog_1d (1:nbpb), wfx_bog         , jpi, jpj, npb(1:nbpb) )
316            CALL tab_2d_1d( nbpb, wfx_bom_1d (1:nbpb), wfx_bom         , jpi, jpj, npb(1:nbpb) )
317            CALL tab_2d_1d( nbpb, wfx_sum_1d (1:nbpb), wfx_sum         , jpi, jpj, npb(1:nbpb) )
318            CALL tab_2d_1d( nbpb, wfx_sni_1d (1:nbpb), wfx_sni         , jpi, jpj, npb(1:nbpb) )
319
320            CALL tab_2d_1d( nbpb, sfx_bog_1d (1:nbpb), sfx_bog         , jpi, jpj, npb(1:nbpb) )
321            CALL tab_2d_1d( nbpb, sfx_bom_1d (1:nbpb), sfx_bom         , jpi, jpj, npb(1:nbpb) )
322            CALL tab_2d_1d( nbpb, sfx_sum_1d (1:nbpb), sfx_sum         , jpi, jpj, npb(1:nbpb) )
323            CALL tab_2d_1d( nbpb, sfx_sni_1d (1:nbpb), sfx_sni         , jpi, jpj, npb(1:nbpb) )
324            CALL tab_2d_1d( nbpb, sfx_bri_1d (1:nbpb), sfx_bri         , jpi, jpj, npb(1:nbpb) )
325
326            CALL tab_2d_1d( nbpb, iatte_1d   (1:nbpb), iatte           , jpi, jpj, npb(1:nbpb) ) 
327            CALL tab_2d_1d( nbpb, oatte_1d   (1:nbpb), oatte           , jpi, jpj, npb(1:nbpb) ) 
328
329            CALL tab_2d_1d( nbpb, hfx_thd_1d (1:nbpb), hfx_thd         , jpi, jpj, npb(1:nbpb) )
330            CALL tab_2d_1d( nbpb, hfx_spr_1d (1:nbpb), hfx_spr         , jpi, jpj, npb(1:nbpb) )
331            CALL tab_2d_1d( nbpb, hfx_tot_1d (1:nbpb), hfx_tot         , jpi, jpj, npb(1:nbpb) )
332            CALL tab_2d_1d( nbpb, hfx_snw_1d (1:nbpb), hfx_snw         , jpi, jpj, npb(1:nbpb) )
333            CALL tab_2d_1d( nbpb, hfx_sub_1d (1:nbpb), hfx_sub         , jpi, jpj, npb(1:nbpb) )
334            CALL tab_2d_1d( nbpb, hfx_err_1d (1:nbpb), hfx_err         , jpi, jpj, npb(1:nbpb) )
335            CALL tab_2d_1d( nbpb, hfx_res_1d (1:nbpb), hfx_res         , jpi, jpj, npb(1:nbpb) )
336            CALL tab_2d_1d( nbpb, hfx_err_rem_1d (1:nbpb), hfx_err_rem , jpi, jpj, npb(1:nbpb) )
337
338            !--------------------------------
339            ! 4.3) Thermodynamic processes
340            !--------------------------------
341            ! --- diag error on heat diffusion - PART 1 --- !
342            DO ji = 1, nbpb
343               zq_ini(ji) = ( SUM( q_i_b(ji,1:nlay_i) ) * ht_i_b(ji) / REAL( nlay_i ) +  &
344                  &           SUM( q_s_b(ji,1:nlay_s) ) * ht_s_b(ji) / REAL( nlay_s ) ) 
345            END DO
346
347            !---------------------------------!
348            ! Ice/Snow Temperature profile    !
349            !---------------------------------!
350            CALL lim_thd_dif( 1, nbpb, jl )
351
352            ! --- computes sea ice energy of melting compulsory for limthd_dh --- !
353            CALL lim_thd_enmelt( 1, nbpb )
354
355            DO ji = 1, nbpb
356              ! --- diag error on heat diffusion - PART 2 --- !
357               zdq(ji)        = - zq_ini(ji) + ( SUM( q_i_b(ji,1:nlay_i) ) * ht_i_b(ji) / REAL( nlay_i ) +  &
358                  &                              SUM( q_s_b(ji,1:nlay_s) ) * ht_s_b(ji) / REAL( nlay_s ) )
359               zhfx_err       = ( fc_su(ji) + i0(ji) * qsr_ice_1d(ji) - ftr_ice_1d(ji) - fc_bo_i(ji) + zdq(ji) * r1_rdtice ) 
360               hfx_err_1d(ji) = hfx_err_1d(ji) + zhfx_err * a_i_b(ji)
361               ! --- correction of qns_ice and surface conduction flux --- !
362               qns_ice_1d(ji) = qns_ice_1d(ji) - zhfx_err 
363               fc_su     (ji) = fc_su     (ji) - zhfx_err 
364               ! --- Heat flux at the ice surface in W.m-2 --- !
365               ii = MOD( npb(ji) - 1, jpi ) + 1 ; ij = ( npb(ji) - 1 ) / jpi + 1
366               hfx_in (ii,ij) = hfx_in (ii,ij) + a_i_b(ji) * ( qsr_ice_1d(ji) + qns_ice_1d(ji) )
367
368            END DO
369
370            !---------------------------------!
371            ! Ice/Snow thicnkess              !
372            !---------------------------------!
373            ! --- diag error on heat remapping - PART 1 --- !
374            DO ji = 1, nbpb
375               zq_ini(ji) = ( SUM( q_i_b(ji,1:nlay_i) ) * ht_i_b(ji) / REAL( nlay_i ) + &
376                  &           SUM( q_s_b(ji,1:nlay_s) ) * ht_s_b(ji) / REAL( nlay_s ) ) 
377            END DO
378
379            CALL lim_thd_dh( 1, nbpb, jl )   
380
381            ! --- Ice/Snow enthalpy remapping --- !
382            CALL lim_thd_ent( 1, nbpb, jl ) 
383            !                               
384            ! --- diag error on heat remapping - PART 2 --- !
385            DO ji = 1, nbpb
386               zdq(ji)        = - ( zq_ini(ji) + dq_i(ji) + dq_s(ji) )   &
387                  &             + ( SUM( q_i_b(ji,1:nlay_i) ) * ht_i_b(ji) / REAL( nlay_i ) +  &
388                  &                 SUM( q_s_b(ji,1:nlay_s) ) * ht_s_b(ji) / REAL( nlay_s ) )
389               hfx_err_rem_1d(ji) = hfx_err_rem_1d(ji) + zdq(ji) * a_i_b(ji) * r1_rdtice
390            END DO
391
392            !---------------------------------!
393            ! Ice salinity                    !
394            !---------------------------------!
395            CALL lim_thd_sal( 1, nbpb )   
396
397            !           CALL lim_thd_enmelt(1,nbpb)   ! computes sea ice energy of melting
398            !--------------------------------
399            ! 4.4) Move 1D to 2D vectors
400            !--------------------------------
401
402               CALL tab_1d_2d( nbpb, at_i          , npb, at_i_b    (1:nbpb)   , jpi, jpj )
403               CALL tab_1d_2d( nbpb, ht_i(:,:,jl)  , npb, ht_i_b    (1:nbpb)   , jpi, jpj )
404               CALL tab_1d_2d( nbpb, ht_s(:,:,jl)  , npb, ht_s_b    (1:nbpb)   , jpi, jpj )
405               CALL tab_1d_2d( nbpb, a_i (:,:,jl)  , npb, a_i_b     (1:nbpb)   , jpi, jpj )
406               CALL tab_1d_2d( nbpb, t_su(:,:,jl)  , npb, t_su_b    (1:nbpb)   , jpi, jpj )
407               CALL tab_1d_2d( nbpb, sm_i(:,:,jl)  , npb, sm_i_b    (1:nbpb)   , jpi, jpj )
408            DO jk = 1, nlay_s
409               CALL tab_1d_2d( nbpb, t_s(:,:,jk,jl), npb, t_s_b     (1:nbpb,jk), jpi, jpj)
410               CALL tab_1d_2d( nbpb, e_s(:,:,jk,jl), npb, q_s_b     (1:nbpb,jk), jpi, jpj)
411            END DO
412            DO jk = 1, nlay_i
413               CALL tab_1d_2d( nbpb, t_i(:,:,jk,jl), npb, t_i_b     (1:nbpb,jk), jpi, jpj)
414               CALL tab_1d_2d( nbpb, e_i(:,:,jk,jl), npb, q_i_b     (1:nbpb,jk), jpi, jpj)
415               CALL tab_1d_2d( nbpb, s_i(:,:,jk,jl), npb, s_i_b     (1:nbpb,jk), jpi, jpj)
416            END DO
417               CALL tab_1d_2d( nbpb, qlead         , npb, qlead_1d  (1:nbpb)   , jpi, jpj )
418
419               CALL tab_1d_2d( nbpb, wfx_snw       , npb, wfx_snw_1d(1:nbpb)   , jpi, jpj )
420               CALL tab_1d_2d( nbpb, wfx_sub       , npb, wfx_sub_1d(1:nbpb)   , jpi, jpj )
421
422               CALL tab_1d_2d( nbpb, wfx_bog       , npb, wfx_bog_1d(1:nbpb)   , jpi, jpj )
423               CALL tab_1d_2d( nbpb, wfx_bom       , npb, wfx_bom_1d(1:nbpb)   , jpi, jpj )
424               CALL tab_1d_2d( nbpb, wfx_sum       , npb, wfx_sum_1d(1:nbpb)   , jpi, jpj )
425               CALL tab_1d_2d( nbpb, wfx_sni       , npb, wfx_sni_1d(1:nbpb)   , jpi, jpj )
426
427               CALL tab_1d_2d( nbpb, sfx_bog       , npb, sfx_bog_1d(1:nbpb)   , jpi, jpj )
428               CALL tab_1d_2d( nbpb, sfx_bom       , npb, sfx_bom_1d(1:nbpb)   , jpi, jpj )
429               CALL tab_1d_2d( nbpb, sfx_sum       , npb, sfx_sum_1d(1:nbpb)   , jpi, jpj )
430               CALL tab_1d_2d( nbpb, sfx_sni       , npb, sfx_sni_1d(1:nbpb)   , jpi, jpj )
431            !
432            IF( num_sal == 2 ) THEN
433               CALL tab_1d_2d( nbpb, sfx_bri       , npb, sfx_bri_1d(1:nbpb)   , jpi, jpj )
434            ENDIF
435
436              CALL tab_1d_2d( nbpb, hfx_thd       , npb, hfx_thd_1d(1:nbpb)   , jpi, jpj )
437              CALL tab_1d_2d( nbpb, hfx_spr       , npb, hfx_spr_1d(1:nbpb)   , jpi, jpj )
438              CALL tab_1d_2d( nbpb, hfx_tot       , npb, hfx_tot_1d(1:nbpb)   , jpi, jpj )
439              CALL tab_1d_2d( nbpb, hfx_snw       , npb, hfx_snw_1d(1:nbpb)   , jpi, jpj )
440              CALL tab_1d_2d( nbpb, hfx_sub       , npb, hfx_sub_1d(1:nbpb)   , jpi, jpj )
441              CALL tab_1d_2d( nbpb, hfx_err       , npb, hfx_err_1d(1:nbpb)   , jpi, jpj )
442              CALL tab_1d_2d( nbpb, hfx_res       , npb, hfx_res_1d(1:nbpb)   , jpi, jpj )
443              CALL tab_1d_2d( nbpb, hfx_err_rem   , npb, hfx_err_rem_1d(1:nbpb)   , jpi, jpj )
444            !
445            !+++++       temporary stuff for a dummy version
446              CALL tab_1d_2d( nbpb, dh_i_surf2D, npb, dh_i_surf(1:nbpb)      , jpi, jpj )
447              CALL tab_1d_2d( nbpb, dh_i_bott2D, npb, dh_i_bott(1:nbpb)      , jpi, jpj )
448              CALL tab_1d_2d( nbpb, s_i_newice , npb, s_i_new  (1:nbpb)      , jpi, jpj )
449              CALL tab_1d_2d( nbpb, izero(:,:,jl) , npb, i0    (1:nbpb)      , jpi, jpj )
450            !+++++
451              CALL tab_1d_2d( nbpb, qns_ice(:,:,jl), npb, qns_ice_1d(1:nbpb) , jpi, jpj)
452              CALL tab_1d_2d( nbpb, ftr_ice(:,:,jl), npb, ftr_ice_1d(1:nbpb) , jpi, jpj )
453            !
454            IF( lk_mpp )   CALL mpp_comm_free( ncomm_ice ) !RB necessary ??
455         ENDIF
456         !
457      END DO
458
459      !------------------------------------------------------------------------------!
460      ! 5) Global variables, diagnostics
461      !------------------------------------------------------------------------------!
462
463      !------------------------
464      ! 5.1) Ice heat content             
465      !------------------------
466      ! Enthalpies are global variables we have to readjust the units (heat content in Joules)
467      DO jl = 1, jpl
468         DO jk = 1, nlay_i
469            e_i(:,:,jk,jl) = e_i(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_i(:,:,jl) / ( unit_fac * REAL( nlay_i ) )
470         END DO
471      END DO
472
473      !------------------------
474      ! 5.2) Snow heat content             
475      !------------------------
476      ! Enthalpies are global variables we have to readjust the units (heat content in Joules)
477      DO jl = 1, jpl
478         DO jk = 1, nlay_s
479            e_s(:,:,jk,jl) = e_s(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_s(:,:,jl) / ( unit_fac * REAL( nlay_s ) )
480         END DO
481      END DO
482
483      !----------------------------------
484      ! 5.3) Change thickness to volume
485      !----------------------------------
486      CALL lim_var_eqv2glo
487
488      !--------------------------------------------
489      ! 5.4) Diagnostic thermodynamic growth rates
490      !--------------------------------------------
491      IF(ln_ctl) THEN            ! Control print
492         CALL prt_ctl_info(' ')
493         CALL prt_ctl_info(' - Cell values : ')
494         CALL prt_ctl_info('   ~~~~~~~~~~~~~ ')
495         CALL prt_ctl(tab2d_1=area , clinfo1=' lim_thd  : cell area :')
496         CALL prt_ctl(tab2d_1=at_i , clinfo1=' lim_thd  : at_i      :')
497         CALL prt_ctl(tab2d_1=vt_i , clinfo1=' lim_thd  : vt_i      :')
498         CALL prt_ctl(tab2d_1=vt_s , clinfo1=' lim_thd  : vt_s      :')
499         DO jl = 1, jpl
500            CALL prt_ctl_info(' ')
501            CALL prt_ctl_info(' - Category : ', ivar1=jl)
502            CALL prt_ctl_info('   ~~~~~~~~~~')
503            CALL prt_ctl(tab2d_1=a_i   (:,:,jl)   , clinfo1= ' lim_thd  : a_i      : ')
504            CALL prt_ctl(tab2d_1=ht_i  (:,:,jl)   , clinfo1= ' lim_thd  : ht_i     : ')
505            CALL prt_ctl(tab2d_1=ht_s  (:,:,jl)   , clinfo1= ' lim_thd  : ht_s     : ')
506            CALL prt_ctl(tab2d_1=v_i   (:,:,jl)   , clinfo1= ' lim_thd  : v_i      : ')
507            CALL prt_ctl(tab2d_1=v_s   (:,:,jl)   , clinfo1= ' lim_thd  : v_s      : ')
508            CALL prt_ctl(tab2d_1=e_s   (:,:,1,jl) , clinfo1= ' lim_thd  : e_s      : ')
509            CALL prt_ctl(tab2d_1=t_su  (:,:,jl)   , clinfo1= ' lim_thd  : t_su     : ')
510            CALL prt_ctl(tab2d_1=t_s   (:,:,1,jl) , clinfo1= ' lim_thd  : t_snow   : ')
511            CALL prt_ctl(tab2d_1=sm_i  (:,:,jl)   , clinfo1= ' lim_thd  : sm_i     : ')
512            CALL prt_ctl(tab2d_1=smv_i (:,:,jl)   , clinfo1= ' lim_thd  : smv_i    : ')
513            DO jk = 1, nlay_i
514               CALL prt_ctl_info(' ')
515               CALL prt_ctl_info(' - Layer : ', ivar1=jk)
516               CALL prt_ctl_info('   ~~~~~~~')
517               CALL prt_ctl(tab2d_1=t_i(:,:,jk,jl) , clinfo1= ' lim_thd  : t_i      : ')
518               CALL prt_ctl(tab2d_1=e_i(:,:,jk,jl) , clinfo1= ' lim_thd  : e_i      : ')
519            END DO
520         END DO
521      ENDIF
522      !
523      ! -------------------------------
524      !- check conservation (C Rousset)
525      IF (ln_limdiahsb) THEN
526         zchk_fs  = glob_sum( ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) + sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) ) * area(:,:) * tms(:,:) ) - zchk_fs_b
527         zchk_fw  = glob_sum( ( wfx_bog(:,:) + wfx_bom(:,:) + wfx_sum(:,:) + wfx_sni(:,:) + wfx_opw(:,:) + wfx_res(:,:) + wfx_dyn(:,:) + wfx_snw(:,:) ) * area(:,:) * tms(:,:) ) - zchk_fw_b
528         zchk_ft  = glob_sum( ( hfx_tot(:,:) - hfx_thd(:,:) - hfx_dyn(:,:) - hfx_res(:,:) ) * area(:,:) / unit_fac * tms(:,:) ) - zchk_ft_b
529 
530         zchk_v_i = ( glob_sum( SUM(   v_i(:,:,:)*rhoic + v_s(:,:,:)*rhosn, dim=3 ) * area(:,:) * tms(:,:) ) - zchk_v_i_b ) * r1_rdtice - zchk_fw 
531         zchk_smv = ( glob_sum( SUM( smv_i(:,:,:), dim=3 ) * area(:,:) * tms(:,:) ) - zchk_smv_b ) * r1_rdtice + ( zchk_fs / rhoic )
532         zchk_e_i =   glob_sum( SUM( e_i(:,:,1:nlay_i,:), dim=3 ) + SUM( e_s(:,:,1:nlay_s,:), dim=3 ) ) * r1_rdtice - zchk_e_i_b * r1_rdtice + zchk_ft
533
534         zchk_vmin = glob_min(v_i)
535         zchk_amax = glob_max(SUM(a_i,dim=3))
536         zchk_amin = glob_min(a_i)
537       
538         IF(lwp) THEN
539            IF ( ABS( zchk_v_i   ) >  1.e-4 ) WRITE(numout,*) 'violation volume [kg/day]     (limthd) = ',(zchk_v_i * rday)
540            IF ( ABS( zchk_smv   ) >  1.e-4 ) WRITE(numout,*) 'violation saline [psu*m3/day] (limthd) = ',(zchk_smv * rday)
541            IF ( ABS( zchk_e_i   ) >  1.e-2 ) WRITE(numout,*) 'violation enthalpy [1e9 J]    (limthd) = ',(zchk_e_i)
542            IF ( zchk_vmin <  0.            ) WRITE(numout,*) 'violation v_i<0  [mm]         (limthd) = ',(zchk_vmin * 1.e-3)
543            IF ( zchk_amax >  amax+epsi10   ) WRITE(numout,*) 'violation a_i>amax            (limthd) = ',zchk_amax
544            IF ( zchk_amin <  0.            ) WRITE(numout,*) 'violation a_i<0               (limthd) = ',zchk_amin
545         ENDIF
546      ENDIF
547      !- check conservation (C Rousset)
548      ! -------------------------------
549      !
550      CALL wrk_dealloc( jpij, zdq, zq_ini, zhfx, zqfx )
551
552      IF( nn_timing == 1 )  CALL timing_stop('limthd')
553   END SUBROUTINE lim_thd
554
555 
556   SUBROUTINE lim_thd_enmelt( kideb, kiut )
557      !!-----------------------------------------------------------------------
558      !!                   ***  ROUTINE lim_thd_enmelt ***
559      !!                 
560      !! ** Purpose :   Computes sea ice energy of melting q_i (J.m-3)
561      !!
562      !! ** Method  :   Formula (Bitz and Lipscomb, 1999)
563      !!-------------------------------------------------------------------
564      INTEGER, INTENT(in) ::   kideb, kiut   ! bounds for the spatial loop
565      !!
566      INTEGER  ::   ji, jk   ! dummy loop indices
567      REAL(wp) ::   ztmelts  ! local scalar
568      !!-------------------------------------------------------------------
569      !
570      DO jk = 1, nlay_i             ! Sea ice energy of melting
571         DO ji = kideb, kiut
572            ztmelts      =  - tmut  * s_i_b(ji,jk) + rtt 
573            q_i_b(ji,jk) =    rhoic * ( cpic * ( ztmelts - t_i_b(ji,jk) )                                 &
574               &                      + lfus * ( 1.0 - (ztmelts-rtt) / MIN( t_i_b(ji,jk)-rtt, -epsi10 ) )   &
575               &                      - rcp  * ( ztmelts-rtt  )  ) 
576         END DO
577      END DO
578      DO jk = 1, nlay_s             ! Snow energy of melting
579         DO ji = kideb, kiut
580            q_s_b(ji,jk) = rhosn * ( cpic * ( rtt - t_s_b(ji,jk) ) + lfus )
581         END DO
582      END DO
583      !
584   END SUBROUTINE lim_thd_enmelt
585
586
587   SUBROUTINE lim_thd_init
588      !!-----------------------------------------------------------------------
589      !!                   ***  ROUTINE lim_thd_init ***
590      !!                 
591      !! ** Purpose :   Physical constants and parameters linked to the ice
592      !!              thermodynamics
593      !!
594      !! ** Method  :   Read the namicethd namelist and check the ice-thermo
595      !!              parameter values called at the first timestep (nit000)
596      !!
597      !! ** input   :   Namelist namicether
598      !!-------------------------------------------------------------------
599      NAMELIST/namicethd/ hmelt , hiccrit, fraz_swi, maxfrazb, vfrazb, Cfrazb,   &
600         &                hicmin, hiclim,                                        &
601         &                sbeta  , parlat, hakspl, hibspl, exld,                 &
602         &                hakdif, hnzst  , thth  , parsub, alphs, betas,         & 
603         &                kappa_i, nconv_i_thd, maxer_i_thd, thcon_i_swi
604      !!-------------------------------------------------------------------
605      !
606      IF(lwp) THEN
607         WRITE(numout,*)
608         WRITE(numout,*) 'lim_thd : Ice Thermodynamics'
609         WRITE(numout,*) '~~~~~~~'
610      ENDIF
611      !
612      REWIND( numnam_ice )                  ! read Namelist numnam_ice
613      READ  ( numnam_ice , namicethd )
614      !
615      IF(lwp) THEN                          ! control print
616         WRITE(numout,*)
617         WRITE(numout,*)'   Namelist of ice parameters for ice thermodynamic computation '
618         WRITE(numout,*)'      maximum melting at the bottom                           hmelt        = ', hmelt
619         WRITE(numout,*)'      ice thick. for lateral accretion in NH (SH)             hiccrit(1/2) = ', hiccrit
620         WRITE(numout,*)'      Frazil ice thickness as a function of wind or not       fraz_swi     = ', fraz_swi
621         WRITE(numout,*)'      Maximum proportion of frazil ice collecting at bottom   maxfrazb     = ', maxfrazb
622         WRITE(numout,*)'      Thresold relative drift speed for collection of frazil  vfrazb       = ', vfrazb
623         WRITE(numout,*)'      Squeezing coefficient for collection of frazil          Cfrazb       = ', Cfrazb
624         WRITE(numout,*)'      ice thick. corr. to max. energy stored in brine pocket  hicmin       = ', hicmin 
625         WRITE(numout,*)'      minimum ice thickness                                   hiclim       = ', hiclim 
626         WRITE(numout,*)'      numerical carac. of the scheme for diffusion in ice '
627         WRITE(numout,*)'      Cranck-Nicholson (=0.5), implicit (=1), explicit (=0)   sbeta        = ', sbeta
628         WRITE(numout,*)'      percentage of energy used for lateral ablation          parlat       = ', parlat
629         WRITE(numout,*)'      slope of distr. for Hakkinen-Mellor lateral melting     hakspl       = ', hakspl 
630         WRITE(numout,*)'      slope of distribution for Hibler lateral melting        hibspl       = ', hibspl
631         WRITE(numout,*)'      exponent for leads-closure rate                         exld         = ', exld
632         WRITE(numout,*)'      coefficient for diffusions of ice and snow              hakdif       = ', hakdif
633         WRITE(numout,*)'      threshold thick. for comp. of eq. thermal conductivity  zhth         = ', thth 
634         WRITE(numout,*)'      thickness of the surf. layer in temp. computation       hnzst        = ', hnzst
635         WRITE(numout,*)'      switch for snow sublimation  (=1) or not (=0)           parsub       = ', parsub 
636         WRITE(numout,*)'      coefficient for snow density when snow ice formation    alphs        = ', alphs
637         WRITE(numout,*)'      coefficient for ice-lead partition of snowfall          betas        = ', betas
638         WRITE(numout,*)'      extinction radiation parameter in sea ice (1.0)         kappa_i      = ', kappa_i
639         WRITE(numout,*)'      maximal n. of iter. for heat diffusion computation      nconv_i_thd  = ', nconv_i_thd
640         WRITE(numout,*)'      maximal err. on T for heat diffusion computation        maxer_i_thd  = ', maxer_i_thd
641         WRITE(numout,*)'      switch for comp. of thermal conductivity in the ice     thcon_i_swi  = ', thcon_i_swi
642         WRITE(numout,*)'      check heat conservation in the ice/snow                 con_i        = ', con_i
643      ENDIF
644      !
645      rcdsn = hakdif * rcdsn 
646      rcdic = hakdif * rcdic
647      !
648   END SUBROUTINE lim_thd_init
649
650#else
651   !!----------------------------------------------------------------------
652   !!   Default option         Dummy module          NO  LIM3 sea-ice model
653   !!----------------------------------------------------------------------
654#endif
655
656   !!======================================================================
657END MODULE limthd
Note: See TracBrowser for help on using the repository browser.