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.
icethd.F90 in branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icethd.F90 @ 8483

Last change on this file since 8483 was 8483, checked in by clem, 7 years ago

bug fix following #1937

File size: 35.4 KB
Line 
1MODULE icethd
2   !!======================================================================
3   !!                  ***  MODULE icethd   ***
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 ice_thd_glohec, ice_thd_con_dh and ice_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   !!   ice_thd       : thermodynamic of sea ice
20   !!   ice_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 ice            ! sea-ice variables
25   USE sbc_oce , ONLY : sss_m, sst_m, e3t_m, utau, vtau, ssu_m, ssv_m, frq_m, qns_tot, qsr_tot, sprecip, ln_cpl
26   USE sbc_ice , ONLY : qsr_oce, qns_oce, qemp_oce, qsr_ice, qns_ice, dqns_ice, evap_ice, qprec_ice, qevap_ice, &
27      &                 fr1_i0, fr2_i0, nn_limflx
28   USE ice1D          ! thermodynamic sea-ice variables
29   USE icethd_dif     ! vertical diffusion
30   USE icethd_dh      ! ice-snow growth and melt
31   USE icethd_da      ! lateral melting
32   USE icethd_sal     ! ice salinity
33   USE icethd_ent     ! ice enthalpy redistribution
34   USE icethd_lac     ! lateral accretion
35   USE iceitd         ! remapping thickness distribution
36   USE icetab         ! 1D <==> 2D transformation
37   USE icevar         !
38   USE icectl         ! control print
39   !
40   USE in_out_manager ! I/O manager
41   USE lbclnk         ! lateral boundary condition - MPP links
42   USE lib_mpp        ! MPP library
43   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
44   USE timing         ! Timing
45
46   IMPLICIT NONE
47   PRIVATE
48
49   PUBLIC   ice_thd         ! called by limstp module
50   PUBLIC   ice_thd_init    ! called by ice_init
51
52   !! * Substitutions
53#  include "vectopt_loop_substitute.h90"
54   !!----------------------------------------------------------------------
55   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2010)
56   !! $Id: icethd.F90 8420 2017-08-08 12:18:46Z clem $
57   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
58   !!----------------------------------------------------------------------
59CONTAINS
60
61   SUBROUTINE ice_thd( kt )
62      !!-------------------------------------------------------------------
63      !!                ***  ROUTINE ice_thd  ***       
64      !! 
65      !! ** Purpose : This routine manages ice thermodynamics
66      !!         
67      !! ** Action : - Initialisation of some variables
68      !!             - Some preliminary computation (oceanic heat flux
69      !!               at the ice base, snow acc.,heat budget of the leads)
70      !!             - selection of the icy points and put them in an array
71      !!             - call ice_thd_dif  for vertical heat diffusion
72      !!             - call ice_thd_dh   for vertical ice growth and melt
73      !!             - call ice_thd_ent  for enthalpy remapping
74      !!             - call ice_thd_sal  for ice desalination
75      !!             - call ice_thd_temp to  retrieve temperature from ice enthalpy
76      !!             - back to the geographic grid
77      !!     
78      !! ** References :
79      !!---------------------------------------------------------------------
80      INTEGER, INTENT(in) :: kt    ! number of iteration
81      !
82      INTEGER  :: ji, jj, jk, jl   ! dummy loop indices
83      REAL(wp) :: zfric_u, zqld, zqfr, zqfr_neg
84      REAL(wp) :: zvi_b, zsmv_b, zei_b, zfs_b, zfw_b, zft_b ! conservation check
85      REAL(wp), PARAMETER :: zfric_umin = 0._wp           ! lower bound for the friction velocity (cice value=5.e-04)
86      REAL(wp), PARAMETER :: zch        = 0.0057_wp       ! heat transfer coefficient
87      REAL(wp), DIMENSION(jpi,jpj) ::   zu_io, zv_io, zfric   ! ice-ocean velocity (m/s) and frictional velocity (m2/s2)
88      !
89      !!-------------------------------------------------------------------
90
91      IF( nn_timing == 1 )   CALL timing_start('icethd')
92
93      IF( kt == nit000 .AND. lwp ) THEN
94         WRITE(numout,*)
95         WRITE(numout,*)' icethd '
96         WRITE(numout,*)' ~~~~~~~'
97      ENDIF
98     
99      ! conservation test
100      IF( ln_limdiachk ) CALL ice_cons_hsm(0, 'icethd', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
101
102      CALL ice_var_glo2eqv
103
104      !---------------------------------------------!
105      ! computation of friction velocity at T points
106      !---------------------------------------------!
107      IF( ln_limdyn ) THEN
108         zu_io(:,:) = u_ice(:,:) - ssu_m(:,:)
109         zv_io(:,:) = v_ice(:,:) - ssv_m(:,:)
110         DO jj = 2, jpjm1 
111            DO ji = fs_2, fs_jpim1
112               zfric(ji,jj) = rn_cio * ( 0.5_wp *  &
113                  &                    (  zu_io(ji,jj) * zu_io(ji,jj) + zu_io(ji-1,jj) * zu_io(ji-1,jj)   &
114                  &                     + zv_io(ji,jj) * zv_io(ji,jj) + zv_io(ji,jj-1) * zv_io(ji,jj-1) ) ) * tmask(ji,jj,1)
115            END DO
116         END DO
117      ELSE      !  if no ice dynamics => transmit directly the atmospheric stress to the ocean
118         DO jj = 2, jpjm1
119            DO ji = fs_2, fs_jpim1
120               zfric(ji,jj) = r1_rau0 * SQRT( 0.5_wp *  &
121                  &                         (  utau(ji,jj) * utau(ji,jj) + utau(ji-1,jj) * utau(ji-1,jj)   &
122                  &                          + vtau(ji,jj) * vtau(ji,jj) + vtau(ji,jj-1) * vtau(ji,jj-1) ) ) * tmask(ji,jj,1)
123            END DO
124         END DO
125      ENDIF
126      CALL lbc_lnk( zfric, 'T',  1. )
127      !
128      ftr_ice(:,:,:) = 0._wp  ! initialization (part of solar radiation transmitted through the ice)
129
130      !--------------------------------------------------------------------!
131      ! Partial computation of forcing for the thermodynamic sea ice model
132      !--------------------------------------------------------------------!
133      DO jj = 1, jpj
134         DO ji = 1, jpi
135            rswitch  = tmask(ji,jj,1) * MAX( 0._wp , SIGN( 1._wp , at_i(ji,jj) - epsi10 ) ) ! 0 if no ice
136            !
137            !           !  solar irradiance transmission at the mixed layer bottom and used in the lead heat budget
138            !           !  practically no "direct lateral ablation"
139            !           
140            !           !  net downward heat flux from the ice to the ocean, expressed as a function of ocean
141            !           !  temperature and turbulent mixing (McPhee, 1992)
142            !
143            ! --- Energy received in the lead, zqld is defined everywhere (J.m-2) --- !
144            zqld =  tmask(ji,jj,1) * rdt_ice *  &
145               &    ( ( 1._wp - at_i_b(ji,jj) ) * qsr_oce(ji,jj) * frq_m(ji,jj) +  &
146               &      ( 1._wp - at_i_b(ji,jj) ) * qns_oce(ji,jj) + qemp_oce(ji,jj) )
147
148            ! --- Energy needed to bring ocean surface layer until its freezing (<0, J.m-2) --- !
149            ! includes supercooling potential energy (>0) or "above-freezing" energy (<0)
150            zqfr = tmask(ji,jj,1) * rau0 * rcp * e3t_m(ji,jj) * ( t_bo(ji,jj) - ( sst_m(ji,jj) + rt0 ) )
151
152            ! --- Above-freezing sensible heat content (J/m2 grid)
153            zqfr_neg = tmask(ji,jj,1) * rau0 * rcp * e3t_m(ji,jj) * MIN( ( t_bo(ji,jj) - ( sst_m(ji,jj) + rt0 ) ), 0._wp )
154
155            ! --- Sensible ocean-to-ice heat flux (W/m2)
156            zfric_u      = MAX( SQRT( zfric(ji,jj) ), zfric_umin ) 
157            fhtur(ji,jj) = rswitch * rau0 * rcp * zch  * zfric_u * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) ) ! W.m-2
158
159            fhtur(ji,jj) = rswitch * MIN( fhtur(ji,jj), - zqfr_neg * r1_rdtice / MAX( at_i(ji,jj), epsi10 ) )
160            ! upper bound for fhtur: the heat retrieved from the ocean must be smaller than the heat necessary to reach
161            !                        the freezing point, so that we do not have SST < T_freeze
162            !                        This implies: - ( fhtur(ji,jj) * at_i(ji,jj) * rtdice ) - zqfr >= 0
163
164            !-- Energy Budget of the leads (J.m-2), source of lateral accretion. Must be < 0 to form ice
165            qlead(ji,jj) = MIN( 0._wp , zqld - ( fhtur(ji,jj) * at_i(ji,jj) * rdt_ice ) - zqfr )
166
167            ! If there is ice and leads are warming, then transfer energy from the lead budget and use it for bottom melting
168            IF( zqld > 0._wp ) THEN
169               fhld (ji,jj) = rswitch * zqld * r1_rdtice / MAX( at_i(ji,jj), epsi10 ) ! divided by at_i since this is (re)multiplied by a_i in icethd_dh.F90
170               qlead(ji,jj) = 0._wp
171            ELSE
172               fhld (ji,jj) = 0._wp
173            ENDIF
174            !
175            ! Net heat flux on top of the ice-ocean [W.m-2]
176            ! ---------------------------------------------
177            hfx_in(ji,jj) = qns_tot(ji,jj) + qsr_tot(ji,jj) 
178         END DO
179      END DO
180     
181      ! In case we bypass open-water ice formation
182      IF( .NOT. ln_limdO )  qlead(:,:) = 0._wp
183      ! In case we bypass growing/melting from top and bottom: we suppose ice is impermeable => ocean is isolated from atmosphere
184      IF( .NOT. ln_limdH ) THEN
185         hfx_in(:,:) = ( 1._wp - at_i_b(:,:) ) * ( qns_oce(:,:) + qsr_oce(:,:) ) + qemp_oce(:,:)
186         fhtur (:,:) = 0._wp
187         fhld  (:,:) = 0._wp
188      ENDIF
189
190      ! ---------------------------------------------------------------------
191      ! Net heat flux on top of the ocean after ice thermo (1st step) [W.m-2]
192      ! ---------------------------------------------------------------------
193      !     First  step here              :  non solar + precip - qlead - qturb
194      !     Second step in icethd_dh      :  heat remaining if total melt (zq_rema)
195      !     Third  step in iceupdate.F90  :  heat from ice-ocean mass exchange (zf_mass) + solar
196      DO jj = 1, jpj
197         DO ji = 1, jpi
198            hfx_out(ji,jj) = ( 1._wp - at_i_b(ji,jj) ) * qns_oce(ji,jj) + qemp_oce(ji,jj)  &  ! Non solar heat flux received by the ocean               
199               &             - qlead(ji,jj) * r1_rdtice                                    &  ! heat flux taken from the ocean where there is open water ice formation
200               &             - at_i(ji,jj) * fhtur(ji,jj)                                  &  ! heat flux taken by turbulence
201               &             - at_i(ji,jj) *  fhld(ji,jj)                                     ! heat flux taken during bottom growth/melt
202                                                                                              !    (fhld should be 0 while bott growth)
203         END DO
204      END DO
205
206      !-------------------------------------------------------------------------------------------!
207      ! Thermodynamic computation (only on grid points covered by ice) => loop over ice categories
208      !-------------------------------------------------------------------------------------------!
209      DO jl = 1, jpl
210
211         ! select ice covered grid points
212         nidx = 0 ; idxice(:) = 0
213         DO jj = 1, jpj
214            DO ji = 1, jpi
215               IF ( a_i(ji,jj,jl) > epsi10 ) THEN     
216                  nidx         = nidx  + 1
217                  idxice(nidx) = (jj - 1) * jpi + ji
218               ENDIF
219            END DO
220         END DO
221
222         IF( lk_mpp )         CALL mpp_ini_ice( nidx , numout )
223
224         IF( nidx > 0 ) THEN  ! If there is no ice, do nothing.
225            !                                                               
226                              CALL ice_thd_1d2d( jl, 1 )            ! --- Move to 1D arrays --- !
227            !                                                       ! --- & Change units of e_i, e_s from J/m2 to J/m3 --- !
228            !
229            s_i_new   (1:nidx) = 0._wp ; dh_s_tot (1:nidx) = 0._wp  ! --- some init --- !  (important to have them here)
230            dh_i_surf (1:nidx) = 0._wp ; dh_i_bott(1:nidx) = 0._wp
231            dh_snowice(1:nidx) = 0._wp ; dh_i_sub (1:nidx) = 0._wp
232            !
233            IF( ln_limdH )    CALL ice_thd_dif                      ! --- Ice/Snow Temperature profile --- !
234            !
235            IF( ln_limdH )    CALL ice_thd_dh                       ! --- Ice/Snow thickness --- !   
236            !
237            IF( ln_limdH )    CALL ice_thd_ent( e_i_1d(1:nidx,:) )  ! --- Ice enthalpy remapping --- !
238            !
239                              CALL ice_thd_sal                      ! --- Ice salinity --- !   
240            !
241                              CALL ice_thd_temp                     ! --- temperature update --- !
242            !
243            IF( ln_limdH ) THEN
244               IF ( ( nn_monocat == 1 .OR. nn_monocat == 4 ) .AND. jpl == 1 ) THEN
245                              CALL ice_thd_lam                      ! --- extra lateral melting if monocat --- !
246               END IF
247            END IF
248            !
249            IF( ln_limdA )    CALL ice_thd_da                       ! --- lateral melting --- !
250            !
251                              CALL ice_thd_1d2d( jl, 2 )            ! --- Change units of e_i, e_s from J/m3 to J/m2 --- !
252            !                                                       ! --- & Move to 2D arrays --- !
253            !
254            IF( lk_mpp )      CALL mpp_comm_free( ncomm_ice ) !RB necessary ??
255         ENDIF
256         !
257      END DO
258      ! update ice age (in case a_i changed, i.e. becomes 0 or lateral melting)
259      oa_i(:,:,:) = o_i(:,:,:) * a_i(:,:,:)
260
261      IF( ln_limdiachk ) CALL ice_cons_hsm(1, 'icethd', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
262      !
263                         CALL ice_var_zapsmall           ! --- remove very small ice concentration (<1e-10) --- !
264      !                                                  !     & make sure at_i=SUM(a_i) & ato_i=1 where at_i=0
265      !                   
266      IF( jpl > 1 )      CALL ice_itd_rem( kt )          ! --- Transport ice between thickness categories --- !
267      !
268      IF( ln_limdO )     CALL ice_thd_lac                ! --- frazil ice growing in leads --- !
269      !
270      IF( ln_limctl )    CALL ice_prt( kt, iiceprt, jiceprt, 1, ' - ice thermodyn. - ' )   ! control print
271      IF( ln_ctl )       CALL ice_prt3D( 'icethd' )      ! Control print
272      !
273      IF( nn_timing == 1 )  CALL timing_stop('icethd')
274
275   END SUBROUTINE ice_thd 
276
277 
278   SUBROUTINE ice_thd_temp
279      !!-----------------------------------------------------------------------
280      !!                   ***  ROUTINE ice_thd_temp ***
281      !!                 
282      !! ** Purpose :   Computes sea ice temperature (Kelvin) from enthalpy
283      !!
284      !! ** Method  :   Formula (Bitz and Lipscomb, 1999)
285      !!-------------------------------------------------------------------
286      INTEGER  ::   ji, jk   ! dummy loop indices
287      REAL(wp) ::   ztmelts, zaaa, zbbb, zccc, zdiscrim  ! local scalar
288      !!-------------------------------------------------------------------
289      ! Recover ice temperature
290      DO jk = 1, nlay_i
291         DO ji = 1, nidx
292            ztmelts       =  -tmut * s_i_1d(ji,jk) + rt0
293            ! Conversion q(S,T) -> T (second order equation)
294            zaaa          =  cpic
295            zbbb          =  ( rcp - cpic ) * ( ztmelts - rt0 ) + e_i_1d(ji,jk) * r1_rhoic - lfus
296            zccc          =  lfus * ( ztmelts - rt0 )
297            zdiscrim      =  SQRT( MAX( zbbb * zbbb - 4._wp * zaaa * zccc, 0._wp ) )
298            t_i_1d(ji,jk) =  rt0 - ( zbbb + zdiscrim ) / ( 2._wp * zaaa )
299           
300            ! mask temperature
301            rswitch       =  1._wp - MAX( 0._wp , SIGN( 1._wp , - ht_i_1d(ji) ) ) 
302            t_i_1d(ji,jk) =  rswitch * t_i_1d(ji,jk) + ( 1._wp - rswitch ) * rt0
303         END DO
304      END DO 
305      !
306   END SUBROUTINE ice_thd_temp
307
308
309   SUBROUTINE ice_thd_lam
310      !!-----------------------------------------------------------------------
311      !!                   ***  ROUTINE ice_thd_lam ***
312      !!                 
313      !! ** Purpose :   Lateral melting in case monocategory
314      !!                          ( dA = A/2h dh )
315      !!-----------------------------------------------------------------------
316      INTEGER  ::   ji                 ! dummy loop indices
317      REAL(wp) ::   zhi_bef            ! ice thickness before thermo
318      REAL(wp) ::   zdh_mel, zda_mel   ! net melting
319      REAL(wp) ::   zvi, zvs           ! ice/snow volumes
320      !!-----------------------------------------------------------------------
321      !
322      DO ji = 1, nidx
323         zdh_mel = MIN( 0._wp, dh_i_surf(ji) + dh_i_bott(ji) + dh_snowice(ji) + dh_i_sub(ji) )
324         IF( zdh_mel < 0._wp .AND. a_i_1d(ji) > 0._wp )  THEN
325            zvi          = a_i_1d(ji) * ht_i_1d(ji)
326            zvs          = a_i_1d(ji) * ht_s_1d(ji)
327            ! lateral melting = concentration change
328            zhi_bef     = ht_i_1d(ji) - zdh_mel
329            rswitch     = MAX( 0._wp , SIGN( 1._wp , zhi_bef - epsi20 ) )
330            zda_mel     = rswitch * a_i_1d(ji) * zdh_mel / ( 2._wp * MAX( zhi_bef, epsi20 ) )
331            a_i_1d(ji)  = MAX( epsi20, a_i_1d(ji) + zda_mel ) 
332            ! adjust thickness
333            ht_i_1d(ji) = zvi / a_i_1d(ji)           
334            ht_s_1d(ji) = zvs / a_i_1d(ji)           
335            ! retrieve total concentration
336            at_i_1d(ji) = a_i_1d(ji)
337         END IF
338      END DO
339      !
340   END SUBROUTINE ice_thd_lam
341
342
343   SUBROUTINE ice_thd_1d2d( jl, kn )
344      !!-----------------------------------------------------------------------
345      !!                   ***  ROUTINE ice_thd_1d2d ***
346      !!                 
347      !! ** Purpose :   move arrays from 1d to 2d and the reverse
348      !!-----------------------------------------------------------------------
349      INTEGER, INTENT(in) ::   jl       ! ice cat
350      INTEGER, INTENT(in) ::   kn       ! 1= from 2D to 1D   ;   2= from 1D to 2D
351      !
352      INTEGER             ::   jk       ! dummy loop indices
353      !!-----------------------------------------------------------------------
354      !
355      SELECT CASE( kn )
356      !
357      CASE( 1 )            ! from 2D to 1D
358         !
359         CALL tab_2d_1d( nidx, idxice(1:nidx), at_i_1d(1:nidx), at_i             )
360         CALL tab_2d_1d( nidx, idxice(1:nidx), a_i_1d (1:nidx), a_i(:,:,jl)      )
361         CALL tab_2d_1d( nidx, idxice(1:nidx), ht_i_1d(1:nidx), ht_i(:,:,jl)     )
362         CALL tab_2d_1d( nidx, idxice(1:nidx), ht_s_1d(1:nidx), ht_s(:,:,jl)     )
363         CALL tab_2d_1d( nidx, idxice(1:nidx), t_su_1d(1:nidx), t_su(:,:,jl)     )
364         CALL tab_2d_1d( nidx, idxice(1:nidx), sm_i_1d(1:nidx), sm_i(:,:,jl)     )
365         DO jk = 1, nlay_s
366            CALL tab_2d_1d( nidx, idxice(1:nidx), t_s_1d(1:nidx,jk), t_s(:,:,jk,jl)   )
367            CALL tab_2d_1d( nidx, idxice(1:nidx), e_s_1d(1:nidx,jk), e_s(:,:,jk,jl)   )
368         END DO
369         DO jk = 1, nlay_i
370            CALL tab_2d_1d( nidx, idxice(1:nidx), t_i_1d(1:nidx,jk), t_i(:,:,jk,jl)   )
371            CALL tab_2d_1d( nidx, idxice(1:nidx), e_i_1d(1:nidx,jk), e_i(:,:,jk,jl)   )
372            CALL tab_2d_1d( nidx, idxice(1:nidx), s_i_1d(1:nidx,jk), s_i(:,:,jk,jl)   )
373         END DO
374         !
375         CALL tab_2d_1d( nidx, idxice(1:nidx), qprec_ice_1d(1:nidx), qprec_ice        )
376         CALL tab_2d_1d( nidx, idxice(1:nidx), qsr_ice_1d  (1:nidx), qsr_ice(:,:,jl)  )
377         CALL tab_2d_1d( nidx, idxice(1:nidx), fr1_i0_1d   (1:nidx), fr1_i0           )
378         CALL tab_2d_1d( nidx, idxice(1:nidx), fr2_i0_1d   (1:nidx), fr2_i0           )
379         CALL tab_2d_1d( nidx, idxice(1:nidx), qns_ice_1d  (1:nidx), qns_ice(:,:,jl)  )
380         CALL tab_2d_1d( nidx, idxice(1:nidx), ftr_ice_1d  (1:nidx), ftr_ice(:,:,jl)  )
381         CALL tab_2d_1d( nidx, idxice(1:nidx), evap_ice_1d (1:nidx), evap_ice(:,:,jl) )
382         CALL tab_2d_1d( nidx, idxice(1:nidx), dqns_ice_1d (1:nidx), dqns_ice(:,:,jl) )
383         CALL tab_2d_1d( nidx, idxice(1:nidx), t_bo_1d     (1:nidx), t_bo             )
384         CALL tab_2d_1d( nidx, idxice(1:nidx), sprecip_1d  (1:nidx), sprecip          ) 
385         CALL tab_2d_1d( nidx, idxice(1:nidx), fhtur_1d    (1:nidx), fhtur            )
386         CALL tab_2d_1d( nidx, idxice(1:nidx), fhld_1d     (1:nidx), fhld             )
387         !
388         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_snw_sni_1d(1:nidx), wfx_snw_sni   )
389         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_snw_sum_1d(1:nidx), wfx_snw_sum   )
390         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_sub_1d    (1:nidx), wfx_sub       )
391         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_snw_sub_1d(1:nidx), wfx_snw_sub   )
392         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_ice_sub_1d(1:nidx), wfx_ice_sub   )
393         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_err_sub_1d(1:nidx), wfx_err_sub   )
394         !
395         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_bog_1d (1:nidx), wfx_bog          )
396         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_bom_1d (1:nidx), wfx_bom          )
397         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_sum_1d (1:nidx), wfx_sum          )
398         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_sni_1d (1:nidx), wfx_sni          )
399         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_res_1d (1:nidx), wfx_res          )
400         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_spr_1d (1:nidx), wfx_spr          )
401         CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_lam_1d (1:nidx), wfx_lam          )
402         !
403         CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_bog_1d (1:nidx), sfx_bog          )
404         CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_bom_1d (1:nidx), sfx_bom          )
405         CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_sum_1d (1:nidx), sfx_sum          )
406         CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_sni_1d (1:nidx), sfx_sni          )
407         CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_bri_1d (1:nidx), sfx_bri          )
408         CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_res_1d (1:nidx), sfx_res          )
409         CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_sub_1d (1:nidx), sfx_sub          )
410         CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_lam_1d (1:nidx), sfx_lam          )
411         !
412         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_thd_1d (1:nidx), hfx_thd          )
413         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_spr_1d (1:nidx), hfx_spr          )
414         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_sum_1d (1:nidx), hfx_sum          )
415         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_bom_1d (1:nidx), hfx_bom          )
416         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_bog_1d (1:nidx), hfx_bog          )
417         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_dif_1d (1:nidx), hfx_dif          )
418         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_opw_1d (1:nidx), hfx_opw          )
419         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_snw_1d (1:nidx), hfx_snw          )
420         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_sub_1d (1:nidx), hfx_sub          )
421         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_err_1d (1:nidx), hfx_err          )
422         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_res_1d (1:nidx), hfx_res          )
423         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_err_dif_1d(1:nidx), hfx_err_dif   )
424         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_err_rem_1d(1:nidx), hfx_err_rem   )
425         CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_out_1d (1:nidx), hfx_out          )
426         !
427         ! SIMIP diagnostics
428         CALL tab_2d_1d( nidx, idxice(1:nidx), diag_fc_bo_1d(1:nidx), diag_fc_bo   )
429         CALL tab_2d_1d( nidx, idxice(1:nidx), diag_fc_su_1d(1:nidx), diag_fc_su   )
430         ! ocean surface fields
431         CALL tab_2d_1d( nidx, idxice(1:nidx), sst_1d(1:nidx), sst_m )
432         CALL tab_2d_1d( nidx, idxice(1:nidx), sss_1d(1:nidx), sss_m )
433
434         ! --- Change units of e_i, e_s from J/m2 to J/m3 --- !
435         DO jk = 1, nlay_i
436            WHERE( ht_i_1d(1:nidx)>0._wp ) e_i_1d(1:nidx,jk) = e_i_1d(1:nidx,jk) / (ht_i_1d(1:nidx) * a_i_1d(1:nidx)) * nlay_i
437         ENDDO
438         DO jk = 1, nlay_s
439            WHERE( ht_s_1d(1:nidx)>0._wp ) e_s_1d(1:nidx,jk) = e_s_1d(1:nidx,jk) / (ht_s_1d(1:nidx) * a_i_1d(1:nidx)) * nlay_s
440         ENDDO
441         !
442      CASE( 2 )            ! from 1D to 2D
443         !
444         ! --- Change units of e_i, e_s from J/m3 to J/m2 --- !
445         DO jk = 1, nlay_i
446            e_i_1d(1:nidx,jk) = e_i_1d(1:nidx,jk) * ht_i_1d(1:nidx) * a_i_1d(1:nidx) * r1_nlay_i
447         ENDDO
448         DO jk = 1, nlay_s
449            e_s_1d(1:nidx,jk) = e_s_1d(1:nidx,jk) * ht_s_1d(1:nidx) * a_i_1d(1:nidx) * r1_nlay_s
450         ENDDO
451         !
452         ! Change thickness to volume
453         v_i_1d(1:nidx)   = ht_i_1d(1:nidx) * a_i_1d(1:nidx)
454         v_s_1d(1:nidx)   = ht_s_1d(1:nidx) * a_i_1d(1:nidx)
455         smv_i_1d(1:nidx) = sm_i_1d(1:nidx) * v_i_1d(1:nidx)
456         
457         CALL tab_1d_2d( nidx, idxice(1:nidx), at_i_1d(1:nidx), at_i             )
458         CALL tab_1d_2d( nidx, idxice(1:nidx), a_i_1d (1:nidx), a_i(:,:,jl)      )
459         CALL tab_1d_2d( nidx, idxice(1:nidx), ht_i_1d(1:nidx), ht_i(:,:,jl)     )
460         CALL tab_1d_2d( nidx, idxice(1:nidx), ht_s_1d(1:nidx), ht_s(:,:,jl)     )
461         CALL tab_1d_2d( nidx, idxice(1:nidx), t_su_1d(1:nidx), t_su(:,:,jl)     )
462         CALL tab_1d_2d( nidx, idxice(1:nidx), sm_i_1d(1:nidx), sm_i(:,:,jl)     )
463         DO jk = 1, nlay_s
464            CALL tab_1d_2d( nidx, idxice(1:nidx), t_s_1d(1:nidx,jk), t_s(:,:,jk,jl)   )
465            CALL tab_1d_2d( nidx, idxice(1:nidx), e_s_1d(1:nidx,jk), e_s(:,:,jk,jl)   )
466         END DO
467         DO jk = 1, nlay_i
468            CALL tab_1d_2d( nidx, idxice(1:nidx), t_i_1d(1:nidx,jk), t_i(:,:,jk,jl)   )
469            CALL tab_1d_2d( nidx, idxice(1:nidx), e_i_1d(1:nidx,jk), e_i(:,:,jk,jl)   )
470            CALL tab_1d_2d( nidx, idxice(1:nidx), s_i_1d(1:nidx,jk), s_i(:,:,jk,jl)   )
471         END DO
472         !
473         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_snw_sni_1d(1:nidx), wfx_snw_sni   )
474         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_snw_sum_1d(1:nidx), wfx_snw_sum   )
475         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_sub_1d    (1:nidx), wfx_sub       )
476         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_snw_sub_1d(1:nidx), wfx_snw_sub   )
477         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_ice_sub_1d(1:nidx), wfx_ice_sub   )
478         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_err_sub_1d(1:nidx), wfx_err_sub   )
479         !
480         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_bog_1d (1:nidx), wfx_bog          )
481         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_bom_1d (1:nidx), wfx_bom          )
482         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_sum_1d (1:nidx), wfx_sum          )
483         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_sni_1d (1:nidx), wfx_sni          )
484         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_res_1d (1:nidx), wfx_res          )
485         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_spr_1d (1:nidx), wfx_spr          )
486         CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_lam_1d (1:nidx), wfx_lam          )
487         !
488         CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_bog_1d (1:nidx), sfx_bog          )
489         CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_bom_1d (1:nidx), sfx_bom          )
490         CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_sum_1d (1:nidx), sfx_sum          )
491         CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_sni_1d (1:nidx), sfx_sni          )
492         CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_bri_1d (1:nidx), sfx_bri          )
493         CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_res_1d (1:nidx), sfx_res          )
494         CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_sub_1d (1:nidx), sfx_sub          )
495         CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_lam_1d (1:nidx), sfx_lam          )
496         !
497         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_thd_1d (1:nidx), hfx_thd          )
498         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_spr_1d (1:nidx), hfx_spr          )
499         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_sum_1d (1:nidx), hfx_sum          )
500         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_bom_1d (1:nidx), hfx_bom          )
501         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_bog_1d (1:nidx), hfx_bog          )
502         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_dif_1d (1:nidx), hfx_dif          )
503         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_opw_1d (1:nidx), hfx_opw          )
504         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_snw_1d (1:nidx), hfx_snw          )
505         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_sub_1d (1:nidx), hfx_sub          )
506         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_err_1d (1:nidx), hfx_err          )
507         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_res_1d (1:nidx), hfx_res          )
508         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_err_dif_1d(1:nidx), hfx_err_dif   )
509         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_err_rem_1d(1:nidx), hfx_err_rem   )
510         CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_out_1d (1:nidx), hfx_out          )
511         !
512         CALL tab_1d_2d( nidx, idxice(1:nidx), qns_ice_1d  (1:nidx), qns_ice(:,:,jl)  )
513         CALL tab_1d_2d( nidx, idxice(1:nidx), ftr_ice_1d  (1:nidx), ftr_ice(:,:,jl)  )
514         !
515         ! SIMIP diagnostics         
516         CALL tab_1d_2d( nidx, idxice(1:nidx), t_si_1d      (1:nidx), t_si(:,:,jl)      )
517         CALL tab_1d_2d( nidx, idxice(1:nidx), diag_fc_bo_1d(1:nidx), diag_fc_bo        )
518         CALL tab_1d_2d( nidx, idxice(1:nidx), diag_fc_su_1d(1:nidx), diag_fc_su        )
519         ! extensive variables
520         CALL tab_1d_2d( nidx, idxice(1:nidx), v_i_1d  (1:nidx), v_i  (:,:,jl) )
521         CALL tab_1d_2d( nidx, idxice(1:nidx), v_s_1d  (1:nidx), v_s  (:,:,jl) )
522         CALL tab_1d_2d( nidx, idxice(1:nidx), smv_i_1d(1:nidx), smv_i(:,:,jl) )
523      END SELECT
524      !
525   END SUBROUTINE ice_thd_1d2d
526
527
528   SUBROUTINE ice_thd_init
529      !!-----------------------------------------------------------------------
530      !!                   ***  ROUTINE ice_thd_init ***
531      !!                 
532      !! ** Purpose :   Physical constants and parameters linked to the ice
533      !!              thermodynamics
534      !!
535      !! ** Method  :   Read the namicethd namelist and check the ice-thermo
536      !!              parameter values called at the first timestep (nit000)
537      !!
538      !! ** input   :   Namelist namicether
539      !!-------------------------------------------------------------------
540      INTEGER  ::   ios                 ! Local integer output status for namelist read
541      NAMELIST/namicethd/ rn_kappa_i, nn_ice_thcon, ln_dqnsice, rn_cdsn,                                  &
542         &                ln_limdH, rn_betas,                                                             &
543         &                ln_limdA, rn_beta, rn_dmin,                                                     &
544         &                ln_limdO, rn_hnewice, ln_frazil, rn_maxfrazb, rn_vfrazb, rn_Cfrazb, rn_himin,   &
545         &                nn_limflx
546      !!-------------------------------------------------------------------
547      !
548      REWIND( numnam_ice_ref )              ! Namelist namicethd in reference namelist : Ice thermodynamics
549      READ  ( numnam_ice_ref, namicethd, IOSTAT = ios, ERR = 901)
550901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicethd in reference namelist', lwp )
551
552      REWIND( numnam_ice_cfg )              ! Namelist namicethd in configuration namelist : Ice thermodynamics
553      READ  ( numnam_ice_cfg, namicethd, IOSTAT = ios, ERR = 902 )
554902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicethd in configuration namelist', lwp )
555      IF(lwm) WRITE ( numoni, namicethd )
556      !
557      !
558      IF(lwp) THEN                          ! control print
559         WRITE(numout,*) 'ice_thd_init : Ice Thermodynamics'
560         WRITE(numout,*) '~~~~~~~~~~~~~'
561         WRITE(numout,*)'   -- icethd_dif --'
562         WRITE(numout,*)'      extinction radiation parameter in sea ice               rn_kappa_i   = ', rn_kappa_i
563         WRITE(numout,*)'      switch for comp. of thermal conductivity in the ice     nn_ice_thcon = ', nn_ice_thcon
564         WRITE(numout,*)'      change the surface non-solar flux with Tsu or not       ln_dqnsice   = ', ln_dqnsice
565         WRITE(numout,*)'      thermal conductivity of the snow                        rn_cdsn      = ', rn_cdsn
566         WRITE(numout,*)'   -- icethd_dh --'
567         WRITE(numout,*)'      activate ice thick change from top/bot (T) or not (F)   ln_limdH     = ', ln_limdH
568         WRITE(numout,*)'      coefficient for ice-lead partition of snowfall          rn_betas     = ', rn_betas
569         WRITE(numout,*)'   -- icethd_da --'
570         WRITE(numout,*)'      activate lateral melting (T) or not (F)                 ln_limdA     = ', ln_limdA
571         WRITE(numout,*)'      Coef. beta for lateral melting param.                   rn_beta      = ', rn_beta
572         WRITE(numout,*)'      Minimum floe diameter for lateral melting param.        rn_dmin      = ', rn_dmin
573         WRITE(numout,*)'   -- icethd_lac --'
574         WRITE(numout,*)'      activate ice growth in open-water (T) or not (F)        ln_limdO     = ', ln_limdO
575         WRITE(numout,*)'      ice thick. for lateral accretion                        rn_hnewice   = ', rn_hnewice
576         WRITE(numout,*)'      Frazil ice thickness as a function of wind or not       ln_frazil    = ', ln_frazil
577         WRITE(numout,*)'      Maximum proportion of frazil ice collecting at bottom   rn_maxfrazb  = ', rn_maxfrazb
578         WRITE(numout,*)'      Thresold relative drift speed for collection of frazil  rn_vfrazb    = ', rn_vfrazb
579         WRITE(numout,*)'      Squeezing coefficient for collection of frazil          rn_Cfrazb    = ', rn_Cfrazb
580         WRITE(numout,*)'   -- iceitd --'
581         WRITE(numout,*)'      minimum ice thickness                                   rn_himin     = ', rn_himin 
582         WRITE(numout,*)'   -- icestp --'
583         WRITE(numout,*)'      Multicategory heat flux formulation                     nn_limflx    = ', nn_limflx
584      ENDIF
585      !
586      IF ( rn_hnewice < rn_himin )   CALL ctl_stop( 'STOP', 'ice_thd_init : rn_hnewice should be >= rn_himin' )
587      !
588      IF(lwp) WRITE(numout,*)
589      SELECT CASE( nn_limflx )         ! LIM3 Multi-category heat flux formulation
590      CASE ( -1 )
591         IF(lwp) WRITE(numout,*) '   LIM3: use per-category fluxes (nn_limflx = -1) '
592         IF( ln_cpl )   CALL ctl_stop( 'sbc_init : the chosen nn_limflx for LIM3 in coupled mode must be 0 or 2' )
593      CASE ( 0  )
594         IF(lwp) WRITE(numout,*) '   LIM3: use average per-category fluxes (nn_limflx = 0) '
595      CASE ( 1  )
596         IF(lwp) WRITE(numout,*) '   LIM3: use average then redistribute per-category fluxes (nn_limflx = 1) '
597         IF( ln_cpl )   CALL ctl_stop( 'sbc_init : the chosen nn_limflx for LIM3 in coupled mode must be 0 or 2' )
598      CASE ( 2  )
599         IF(lwp) WRITE(numout,*) '   LIM3: Redistribute a single flux over categories (nn_limflx = 2) '
600         IF( .NOT. ln_cpl )   CALL ctl_stop( 'sbc_init : the chosen nn_limflx for LIM3 in forced mode cannot be 2' )
601      CASE DEFAULT
602         CALL ctl_stop( 'sbcmod: LIM3 option, nn_limflx, should be between -1 and 2' )
603      END SELECT
604      !
605   END SUBROUTINE ice_thd_init
606
607#else
608   !!----------------------------------------------------------------------
609   !!   Default option         Dummy module          NO  LIM3 sea-ice model
610   !!----------------------------------------------------------------------
611#endif
612
613   !!======================================================================
614END MODULE icethd
Note: See TracBrowser for help on using the repository browser.