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

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

finalizing LIM3 heat budget conservation + multiple minor bugs corrections

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