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 NEMO/trunk/src/ICE – NEMO

source: NEMO/trunk/src/ICE/icethd.F90 @ 13612

Last change on this file since 13612 was 13601, checked in by clem, 4 years ago

trunk: rewrite heat budget of sea ice to make it perfectly conservative by construction. Also, activating ln_icediachk now gives an ascii file (icedrift_diagnostics.ascii) containing mass, salt and heat global conservation issues (if any). In addition, 2D drift files can be outputed (icedrift_mass…) and field_def is changed accordingly. Note that advection schemes are not yet commited since there is still a restartability issue that I do not understand.

  • Property svn:keywords set to Id
File size: 35.0 KB
Line 
1MODULE icethd
2   !!======================================================================
3   !!                  ***  MODULE icethd   ***
4   !!   sea-ice : master routine for thermodynamics
5   !!======================================================================
6   !! History :  1.0  !  2000-01  (M.A. Morales Maqueda, H. Goosse, T. Fichefet) original code 1D
7   !!            4.0  !  2018     (many people)       SI3 [aka Sea Ice cube]
8   !!----------------------------------------------------------------------
9#if defined key_si3
10   !!----------------------------------------------------------------------
11   !!   'key_si3'                                       SI3 sea-ice model
12   !!----------------------------------------------------------------------
13   !!   ice_thd       : thermodynamics of sea ice
14   !!   ice_thd_init  : initialisation of sea-ice thermodynamics
15   !!----------------------------------------------------------------------
16   USE phycst         ! physical constants
17   USE dom_oce        ! ocean space and time domain variables
18   USE ice            ! sea-ice: variables
19!!gm list trop longue ==>>> why not passage en argument d'appel ?
20   USE sbc_oce , ONLY : sss_m, sst_m, e3t_m, utau, vtau, ssu_m, ssv_m, frq_m, sprecip, ln_cpl
21   USE sbc_ice , ONLY : qsr_oce, qns_oce, qemp_oce, qsr_ice, qns_ice, dqns_ice, evap_ice, qprec_ice, qevap_ice, &
22      &                 qml_ice, qcn_ice, qtr_ice_top
23   USE ice1D          ! sea-ice: thermodynamics variables
24   USE icethd_zdf     ! sea-ice: vertical heat diffusion
25   USE icethd_dh      ! sea-ice: ice-snow growth and melt
26   USE icethd_da      ! sea-ice: lateral melting
27   USE icethd_sal     ! sea-ice: salinity
28   USE icethd_ent     ! sea-ice: enthalpy redistribution
29   USE icethd_do      ! sea-ice: growth in open water
30   USE icethd_pnd     ! sea-ice: melt ponds
31   USE iceitd         ! sea-ice: remapping thickness distribution
32   USE icetab         ! sea-ice: 1D <==> 2D transformation
33   USE icevar         ! sea-ice: operations
34   USE icectl         ! sea-ice: control print
35   !
36   USE in_out_manager ! I/O manager
37   USE iom            ! I/O manager library
38   USE lib_mpp        ! MPP library
39   USE lib_fortran    ! fortran utilities (glob_sum + no signed zero)
40   USE lbclnk         ! lateral boundary conditions (or mpp links)
41   USE timing         ! Timing
42
43   IMPLICIT NONE
44   PRIVATE
45
46   PUBLIC   ice_thd         ! called by limstp module
47   PUBLIC   ice_thd_init    ! called by ice_init
48
49   !!** namelist (namthd) **
50   LOGICAL ::   ln_icedH         ! activate ice thickness change from growing/melting (T) or not (F)
51   LOGICAL ::   ln_icedA         ! activate lateral melting param. (T) or not (F)
52   LOGICAL ::   ln_icedO         ! activate ice growth in open-water (T) or not (F)
53   LOGICAL ::   ln_icedS         ! activate gravity drainage and flushing (T) or not (F)
54   LOGICAL ::   ln_leadhfx       ! heat in the leads is used to melt sea-ice before warming the ocean
55
56   !! for convergence tests
57   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztice_cvgerr, ztice_cvgstp
58
59   !! * Substitutions
60#  include "do_loop_substitute.h90"
61   !!----------------------------------------------------------------------
62   !! NEMO/ICE 4.0 , NEMO Consortium (2018)
63   !! $Id$
64   !! Software governed by the CeCILL license (see ./LICENSE)
65   !!----------------------------------------------------------------------
66CONTAINS
67
68   SUBROUTINE ice_thd( kt )
69      !!-------------------------------------------------------------------
70      !!                ***  ROUTINE ice_thd  ***       
71      !! 
72      !! ** Purpose : This routine manages ice thermodynamics
73      !!         
74      !! ** Action : - computation of oceanic sensible heat flux at the ice base
75      !!                              energy budget in the leads
76      !!                              net fluxes on top of ice and of ocean
77      !!             - selection of grid cells with ice
78      !!                - call ice_thd_zdf  for vertical heat diffusion
79      !!                - call ice_thd_dh   for vertical ice growth and melt
80      !!                - call ice_thd_pnd  for melt ponds
81      !!                - call ice_thd_ent  for enthalpy remapping
82      !!                - call ice_thd_sal  for ice desalination
83      !!                - call ice_thd_temp to  retrieve temperature from ice enthalpy
84      !!                - call ice_thd_mono for extra lateral ice melt if active virtual thickness distribution
85      !!                - call ice_thd_da   for lateral ice melt
86      !!             - back to the geographic grid
87      !!                - call ice_thd_rem  for remapping thickness distribution
88      !!                - call ice_thd_do   for ice growth in leads
89      !!-------------------------------------------------------------------
90      INTEGER, INTENT(in) :: kt    ! number of iteration
91      !
92      INTEGER  :: ji, jj, jk, jl   ! dummy loop indices
93      REAL(wp) :: zfric_u, zqld, zqfr, zqfr_neg, zqfr_pos
94      REAL(wp), PARAMETER :: zfric_umin = 0._wp       ! lower bound for the friction velocity (cice value=5.e-04)
95      REAL(wp), PARAMETER :: zch        = 0.0057_wp   ! heat transfer coefficient
96      REAL(wp), DIMENSION(jpi,jpj) ::   zu_io, zv_io, zfric, zvel   ! ice-ocean velocity (m/s) and frictional velocity (m2/s2)
97      !
98      !!-------------------------------------------------------------------
99      ! controls
100      IF( ln_timing    )   CALL timing_start('icethd')                                                             ! timing
101      IF( ln_icediachk )   CALL ice_cons_hsm(0, 'icethd', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft) ! conservation
102      IF( ln_icediachk )   CALL ice_cons2D  (0, 'icethd',  diag_v,  diag_s,  diag_t,  diag_fv,  diag_fs,  diag_ft) ! conservation
103
104      IF( kt == nit000 .AND. lwp ) THEN
105         WRITE(numout,*)
106         WRITE(numout,*) 'ice_thd: sea-ice thermodynamics'
107         WRITE(numout,*) '~~~~~~~'
108      ENDIF
109
110      ! convergence tests
111      IF( ln_zdf_chkcvg ) THEN
112         ALLOCATE( ztice_cvgerr(jpi,jpj,jpl) , ztice_cvgstp(jpi,jpj,jpl) )
113         ztice_cvgerr = 0._wp ; ztice_cvgstp = 0._wp
114      ENDIF
115     
116      !---------------------------------------------!
117      ! computation of friction velocity at T points
118      !---------------------------------------------!
119      IF( ln_icedyn ) THEN
120         zu_io(:,:) = u_ice(:,:) - ssu_m(:,:)
121         zv_io(:,:) = v_ice(:,:) - ssv_m(:,:)
122         DO_2D( 0, 0, 0, 0 )
123            zfric(ji,jj) = rn_cio * ( 0.5_wp *  &
124               &                    (  zu_io(ji,jj) * zu_io(ji,jj) + zu_io(ji-1,jj) * zu_io(ji-1,jj)   &
125               &                     + zv_io(ji,jj) * zv_io(ji,jj) + zv_io(ji,jj-1) * zv_io(ji,jj-1) ) ) * tmask(ji,jj,1)
126            zvel(ji,jj) = 0.5_wp * SQRT( ( u_ice(ji-1,jj) + u_ice(ji,jj) ) * ( u_ice(ji-1,jj) + u_ice(ji,jj) ) + &
127               &                         ( v_ice(ji,jj-1) + v_ice(ji,jj) ) * ( v_ice(ji,jj-1) + v_ice(ji,jj) ) )
128         END_2D
129      ELSE      !  if no ice dynamics => transmit directly the atmospheric stress to the ocean
130         DO_2D( 0, 0, 0, 0 )
131            zfric(ji,jj) = r1_rho0 * SQRT( 0.5_wp *  &
132               &                         (  utau(ji,jj) * utau(ji,jj) + utau(ji-1,jj) * utau(ji-1,jj)   &
133               &                          + vtau(ji,jj) * vtau(ji,jj) + vtau(ji,jj-1) * vtau(ji,jj-1) ) ) * tmask(ji,jj,1)
134            zvel(ji,jj) = 0._wp
135         END_2D
136      ENDIF
137      CALL lbc_lnk_multi( 'icethd', zfric, 'T',  1.0_wp, zvel, 'T', 1.0_wp )
138      !
139      !--------------------------------------------------------------------!
140      ! Partial computation of forcing for the thermodynamic sea ice model
141      !--------------------------------------------------------------------!
142      DO_2D( 1, 1, 1, 1 )
143         rswitch  = tmask(ji,jj,1) * MAX( 0._wp , SIGN( 1._wp , at_i(ji,jj) - epsi10 ) ) ! 0 if no ice
144         !
145         ! --- Energy received in the lead from atm-oce exchanges, zqld is defined everywhere (J.m-2) --- !
146         zqld =  tmask(ji,jj,1) * rDt_ice *  &
147            &    ( ( 1._wp - at_i_b(ji,jj) ) * qsr_oce(ji,jj) * frq_m(ji,jj) +  &
148            &      ( 1._wp - at_i_b(ji,jj) ) * qns_oce(ji,jj) + qemp_oce(ji,jj) )
149
150         ! --- Energy needed to bring ocean surface layer until its freezing, zqfr is defined everywhere (J.m-2) --- !
151         !     (mostly<0 but >0 if supercooling)
152         zqfr     = rho0 * rcp * e3t_m(ji,jj) * ( t_bo(ji,jj) - ( sst_m(ji,jj) + rt0 ) ) * tmask(ji,jj,1)  ! both < 0 (t_bo < sst) and > 0 (t_bo > sst)
153         zqfr_neg = MIN( zqfr , 0._wp )                                                                    ! only < 0
154         zqfr_pos = MAX( zqfr , 0._wp )                                                                    ! only > 0
155
156         ! --- Sensible ocean-to-ice heat flux (W/m2) --- !
157         !     (mostly>0 but <0 if supercooling)
158         zfric_u            = MAX( SQRT( zfric(ji,jj) ), zfric_umin ) 
159         qsb_ice_bot(ji,jj) = rswitch * rho0 * rcp * zch * zfric_u * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) )
160         
161         ! upper bound for qsb_ice_bot: the heat retrieved from the ocean must be smaller than the heat necessary to reach
162         !                              the freezing point, so that we do not have SST < T_freeze
163         !                              This implies: qsb_ice_bot(ji,jj) * at_i(ji,jj) * rtdice <= - zqfr_neg
164         !                              The following formulation is ok for both normal conditions and supercooling
165         qsb_ice_bot(ji,jj) = rswitch * MIN( qsb_ice_bot(ji,jj), - zqfr_neg * r1_Dt_ice / MAX( at_i(ji,jj), epsi10 ) )
166
167         ! --- Energy Budget of the leads (qlead, J.m-2) --- !
168         !     qlead is the energy received from the atm. in the leads.
169         !     If warming (zqld >= 0), then the energy in the leads is used to melt ice (bottom melting) => fhld  (W/m2)
170         !     If cooling (zqld <  0), then the energy in the leads is used to grow ice in open water    => qlead (J.m-2)
171         IF( zqld >= 0._wp .AND. at_i(ji,jj) > 0._wp ) THEN
172            ! upper bound for fhld: fhld should be equal to zqld
173            !                        but we have to make sure that this heat will not make the sst drop below the freezing point
174            !                        so the max heat that can be pulled out of the ocean is zqld - qsb - zqfr_pos
175            !                        The following formulation is ok for both normal conditions and supercooling
176            fhld (ji,jj) = rswitch * MAX( 0._wp, ( zqld - zqfr_pos ) * r1_Dt_ice / MAX( at_i(ji,jj), epsi10 ) &  ! divided by at_i since this is (re)multiplied by a_i in icethd_dh.F90
177               &                                 - qsb_ice_bot(ji,jj) )
178            qlead(ji,jj) = 0._wp
179         ELSE
180            fhld (ji,jj) = 0._wp
181            ! upper bound for qlead: qlead should be equal to zqld
182            !                        but before using this heat for ice formation, we suppose that the ocean cools down till the freezing point.
183            !                        The energy for this cooling down is zqfr. Also some heat will be removed from the ocean from turbulent fluxes (qsb)
184            !                        and freezing point is reached if zqfr = zqld - qsb*a/dt
185            !                        so the max heat that can be pulled out of the ocean is zqld - qsb - zqfr
186            !                        The following formulation is ok for both normal conditions and supercooling
187            qlead(ji,jj) = MIN( 0._wp , zqld - ( qsb_ice_bot(ji,jj) * at_i(ji,jj) * rDt_ice ) - zqfr )
188         ENDIF
189         !
190         ! If ice is landfast and ice concentration reaches its max
191         ! => stop ice formation in open water
192         IF(  zvel(ji,jj) <= 5.e-04_wp .AND. at_i(ji,jj) >= rn_amax_2d(ji,jj)-epsi06 )   qlead(ji,jj) = 0._wp
193         !
194         ! If the grid cell is almost fully covered by ice (no leads)
195         ! => stop ice formation in open water
196         IF( at_i(ji,jj) >= (1._wp - epsi10) )   qlead(ji,jj) = 0._wp
197         !
198         ! If ln_leadhfx is false
199         ! => do not use energy of the leads to melt sea-ice
200         IF( .NOT.ln_leadhfx )   fhld(ji,jj) = 0._wp
201         !
202      END_2D
203     
204      ! In case we bypass open-water ice formation
205      IF( .NOT. ln_icedO )  qlead(:,:) = 0._wp
206      ! In case we bypass growing/melting from top and bottom
207      IF( .NOT. ln_icedH ) THEN
208         qsb_ice_bot(:,:) = 0._wp
209         fhld       (:,:) = 0._wp
210      ENDIF
211
212      !-------------------------------------------------------------------------------------------!
213      ! Thermodynamic computation (only on grid points covered by ice) => loop over ice categories
214      !-------------------------------------------------------------------------------------------!
215      DO jl = 1, jpl
216
217         ! select ice covered grid points
218         npti = 0 ; nptidx(:) = 0
219         DO_2D( 1, 1, 1, 1 )
220            IF ( a_i(ji,jj,jl) > epsi10 ) THEN     
221               npti         = npti  + 1
222               nptidx(npti) = (jj - 1) * jpi + ji
223            ENDIF
224         END_2D
225
226         IF( npti > 0 ) THEN  ! If there is no ice, do nothing.
227            !                                                               
228                              CALL ice_thd_1d2d( jl, 1 )            ! --- Move to 1D arrays --- !
229            !                                                       ! --- & Change units of e_i, e_s from J/m2 to J/m3 --- !
230            !
231            s_i_new   (1:npti) = 0._wp ; dh_s_tot(1:npti) = 0._wp   ! --- some init --- !  (important to have them here)
232            dh_i_sum  (1:npti) = 0._wp ; dh_i_bom(1:npti) = 0._wp ; dh_i_itm  (1:npti) = 0._wp 
233            dh_i_sub  (1:npti) = 0._wp ; dh_i_bog(1:npti) = 0._wp
234            dh_snowice(1:npti) = 0._wp ; dh_s_mlt(1:npti) = 0._wp
235            !                                     
236                              CALL ice_thd_zdf                      ! --- Ice-Snow temperature --- !
237            !
238            IF( ln_icedH ) THEN                                     ! --- Growing/Melting --- !
239                              CALL ice_thd_dh                           ! Ice-Snow thickness   
240                              CALL ice_thd_pnd                          ! Melt ponds formation
241                              CALL ice_thd_ent( e_i_1d(1:npti,:) )      ! Ice enthalpy remapping
242            ENDIF
243                              CALL ice_thd_sal( ln_icedS )          ! --- Ice salinity --- !   
244            !
245                              CALL ice_thd_temp                     ! --- Temperature update --- !
246            !
247            IF( ln_icedH .AND. ln_virtual_itd ) &
248               &              CALL ice_thd_mono                     ! --- Extra lateral melting if virtual_itd --- !
249            !
250            IF( ln_icedA )    CALL ice_thd_da                       ! --- Lateral melting --- !
251            !
252                              CALL ice_thd_1d2d( jl, 2 )            ! --- Change units of e_i, e_s from J/m3 to J/m2 --- !
253            !                                                       ! --- & Move to 2D arrays --- !
254         ENDIF
255         !
256      END DO
257      !
258      IF( ln_icediachk )   CALL ice_cons_hsm(1, 'icethd', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft)
259      IF( ln_icediachk )   CALL ice_cons2D  (1, 'icethd',  diag_v,  diag_s,  diag_t,  diag_fv,  diag_fs,  diag_ft)
260      !                   
261      IF( jpl > 1  )          CALL ice_itd_rem( kt )                ! --- Transport ice between thickness categories --- !
262      !
263      IF( ln_icedO )          CALL ice_thd_do                       ! --- Frazil ice growth in leads --- !
264      !
265      ! convergence tests
266      IF( ln_zdf_chkcvg ) THEN
267         CALL iom_put( 'tice_cvgerr', ztice_cvgerr ) ; DEALLOCATE( ztice_cvgerr )
268         CALL iom_put( 'tice_cvgstp', ztice_cvgstp ) ; DEALLOCATE( ztice_cvgstp )
269      ENDIF
270      !
271      ! controls
272      IF( ln_icectl )   CALL ice_prt    (kt, iiceprt, jiceprt, 1, ' - ice thermodyn. - ') ! prints
273      IF( sn_cfctl%l_prtctl )   &
274        &               CALL ice_prt3D  ('icethd')                                        ! prints
275      IF( ln_timing )   CALL timing_stop('icethd')                                        ! timing
276      !
277   END SUBROUTINE ice_thd 
278
279 
280   SUBROUTINE ice_thd_temp
281      !!-----------------------------------------------------------------------
282      !!                   ***  ROUTINE ice_thd_temp ***
283      !!                 
284      !! ** Purpose :   Computes sea ice temperature (Kelvin) from enthalpy
285      !!
286      !! ** Method  :   Formula (Bitz and Lipscomb, 1999)
287      !!-------------------------------------------------------------------
288      INTEGER  ::   ji, jk   ! dummy loop indices
289      REAL(wp) ::   ztmelts, zbbb, zccc  ! local scalar
290      !!-------------------------------------------------------------------
291      ! Recover ice temperature
292      DO jk = 1, nlay_i
293         DO ji = 1, npti
294            ztmelts       = -rTmlt * sz_i_1d(ji,jk)
295            ! Conversion q(S,T) -> T (second order equation)
296            zbbb          = ( rcp - rcpi ) * ztmelts + e_i_1d(ji,jk) * r1_rhoi - rLfus
297            zccc          = SQRT( MAX( zbbb * zbbb - 4._wp * rcpi * rLfus * ztmelts, 0._wp ) )
298            t_i_1d(ji,jk) = rt0 - ( zbbb + zccc ) * 0.5_wp * r1_rcpi
299           
300            ! mask temperature
301            rswitch       = 1._wp - MAX( 0._wp , SIGN( 1._wp , - h_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_mono
310      !!-----------------------------------------------------------------------
311      !!                   ***  ROUTINE ice_thd_mono ***
312      !!                 
313      !! ** Purpose :   Lateral melting in case virtual_itd
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, npti
323         zdh_mel = MIN( 0._wp, dh_i_itm(ji) + dh_i_sum(ji) + dh_i_bom(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) * h_i_1d(ji)
326            zvs          = a_i_1d(ji) * h_s_1d(ji)
327            ! lateral melting = concentration change
328            zhi_bef     = h_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            h_i_1d(ji) = zvi / a_i_1d(ji)           
334            h_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_mono
341
342
343   SUBROUTINE ice_thd_1d2d( kl, kn )
344      !!-----------------------------------------------------------------------
345      !!                   ***  ROUTINE ice_thd_1d2d ***
346      !!                 
347      !! ** Purpose :   move arrays from 1d to 2d and the reverse
348      !!-----------------------------------------------------------------------
349      INTEGER, INTENT(in) ::   kl   ! index of the ice category
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( npti, nptidx(1:npti), at_i_1d(1:npti), at_i             )
360         CALL tab_2d_1d( npti, nptidx(1:npti), a_i_1d (1:npti), a_i (:,:,kl)     )
361         CALL tab_2d_1d( npti, nptidx(1:npti), h_i_1d (1:npti), h_i (:,:,kl)     )
362         CALL tab_2d_1d( npti, nptidx(1:npti), h_s_1d (1:npti), h_s (:,:,kl)     )
363         CALL tab_2d_1d( npti, nptidx(1:npti), t_su_1d(1:npti), t_su(:,:,kl)     )
364         CALL tab_2d_1d( npti, nptidx(1:npti), s_i_1d (1:npti), s_i (:,:,kl)     )
365         DO jk = 1, nlay_s
366            CALL tab_2d_1d( npti, nptidx(1:npti), t_s_1d(1:npti,jk), t_s(:,:,jk,kl)    )
367            CALL tab_2d_1d( npti, nptidx(1:npti), e_s_1d(1:npti,jk), e_s(:,:,jk,kl)    )
368         END DO
369         DO jk = 1, nlay_i
370            CALL tab_2d_1d( npti, nptidx(1:npti), t_i_1d (1:npti,jk), t_i (:,:,jk,kl)  )
371            CALL tab_2d_1d( npti, nptidx(1:npti), e_i_1d (1:npti,jk), e_i (:,:,jk,kl)  )
372            CALL tab_2d_1d( npti, nptidx(1:npti), sz_i_1d(1:npti,jk), sz_i(:,:,jk,kl)  )
373         END DO
374         CALL tab_2d_1d( npti, nptidx(1:npti), a_ip_1d     (1:npti), a_ip     (:,:,kl) )
375         CALL tab_2d_1d( npti, nptidx(1:npti), h_ip_1d     (1:npti), h_ip     (:,:,kl) )
376         CALL tab_2d_1d( npti, nptidx(1:npti), h_il_1d     (1:npti), h_il     (:,:,kl) )
377         !
378         CALL tab_2d_1d( npti, nptidx(1:npti), qprec_ice_1d  (1:npti), qprec_ice            )
379         CALL tab_2d_1d( npti, nptidx(1:npti), qsr_ice_1d    (1:npti), qsr_ice (:,:,kl)     )
380         CALL tab_2d_1d( npti, nptidx(1:npti), qns_ice_1d    (1:npti), qns_ice (:,:,kl)     )
381         CALL tab_2d_1d( npti, nptidx(1:npti), evap_ice_1d   (1:npti), evap_ice(:,:,kl)     )
382         CALL tab_2d_1d( npti, nptidx(1:npti), dqns_ice_1d   (1:npti), dqns_ice(:,:,kl)     )
383         CALL tab_2d_1d( npti, nptidx(1:npti), t_bo_1d       (1:npti), t_bo                 )
384         CALL tab_2d_1d( npti, nptidx(1:npti), sprecip_1d    (1:npti), sprecip              ) 
385         CALL tab_2d_1d( npti, nptidx(1:npti), qsb_ice_bot_1d(1:npti), qsb_ice_bot          )
386         CALL tab_2d_1d( npti, nptidx(1:npti), fhld_1d       (1:npti), fhld                 )
387         
388         CALL tab_2d_1d( npti, nptidx(1:npti), qml_ice_1d    (1:npti), qml_ice    (:,:,kl) )
389         CALL tab_2d_1d( npti, nptidx(1:npti), qcn_ice_1d    (1:npti), qcn_ice    (:,:,kl) )
390         CALL tab_2d_1d( npti, nptidx(1:npti), qtr_ice_top_1d(1:npti), qtr_ice_top(:,:,kl) )
391         !
392         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_snw_sni_1d(1:npti), wfx_snw_sni   )
393         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_snw_sum_1d(1:npti), wfx_snw_sum   )
394         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_sub_1d    (1:npti), wfx_sub       )
395         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_snw_sub_1d(1:npti), wfx_snw_sub   )
396         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_ice_sub_1d(1:npti), wfx_ice_sub   )
397         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_err_sub_1d(1:npti), wfx_err_sub   )
398         !
399         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_bog_1d (1:npti), wfx_bog          )
400         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_bom_1d (1:npti), wfx_bom          )
401         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_sum_1d (1:npti), wfx_sum          )
402         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_sni_1d (1:npti), wfx_sni          )
403         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_res_1d (1:npti), wfx_res          )
404         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_spr_1d (1:npti), wfx_spr          )
405         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_lam_1d (1:npti), wfx_lam          )
406         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_pnd_1d (1:npti), wfx_pnd          )
407         !
408         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_bog_1d (1:npti), sfx_bog          )
409         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_bom_1d (1:npti), sfx_bom          )
410         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_sum_1d (1:npti), sfx_sum          )
411         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_sni_1d (1:npti), sfx_sni          )
412         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_bri_1d (1:npti), sfx_bri          )
413         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_res_1d (1:npti), sfx_res          )
414         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_sub_1d (1:npti), sfx_sub          )
415         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_lam_1d (1:npti), sfx_lam          )
416         !
417         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_thd_1d    (1:npti), hfx_thd       )
418         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_spr_1d    (1:npti), hfx_spr       )
419         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_sum_1d    (1:npti), hfx_sum       )
420         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_bom_1d    (1:npti), hfx_bom       )
421         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_bog_1d    (1:npti), hfx_bog       )
422         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_dif_1d    (1:npti), hfx_dif       )
423         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_opw_1d    (1:npti), hfx_opw       )
424         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_snw_1d    (1:npti), hfx_snw       )
425         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_sub_1d    (1:npti), hfx_sub       )
426         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_res_1d    (1:npti), hfx_res       )
427         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_err_dif_1d(1:npti), hfx_err_dif   )
428         !
429         ! ocean surface fields
430         CALL tab_2d_1d( npti, nptidx(1:npti), sst_1d(1:npti), sst_m )
431         CALL tab_2d_1d( npti, nptidx(1:npti), sss_1d(1:npti), sss_m )
432         !
433         ! to update ice age
434         CALL tab_2d_1d( npti, nptidx(1:npti), o_i_1d (1:npti), o_i (:,:,kl) )
435         CALL tab_2d_1d( npti, nptidx(1:npti), oa_i_1d(1:npti), oa_i(:,:,kl) )
436         !
437         ! --- Change units of e_i, e_s from J/m2 to J/m3 --- !
438         DO jk = 1, nlay_i
439            WHERE( h_i_1d(1:npti)>0._wp ) e_i_1d(1:npti,jk) = e_i_1d(1:npti,jk) / (h_i_1d(1:npti) * a_i_1d(1:npti)) * nlay_i
440         END DO
441         DO jk = 1, nlay_s
442            WHERE( h_s_1d(1:npti)>0._wp ) e_s_1d(1:npti,jk) = e_s_1d(1:npti,jk) / (h_s_1d(1:npti) * a_i_1d(1:npti)) * nlay_s
443         END DO
444         !
445         !                 !---------------------!
446      CASE( 2 )            !==  from 1D to 2D  ==!
447         !                 !---------------------!
448         ! --- Change units of e_i, e_s from J/m3 to J/m2 --- !
449         DO jk = 1, nlay_i
450            e_i_1d(1:npti,jk) = e_i_1d(1:npti,jk) * h_i_1d(1:npti) * a_i_1d(1:npti) * r1_nlay_i
451         END DO
452         DO jk = 1, nlay_s
453            e_s_1d(1:npti,jk) = e_s_1d(1:npti,jk) * h_s_1d(1:npti) * a_i_1d(1:npti) * r1_nlay_s
454         END DO
455         !
456         ! Change thickness to volume (replaces routine ice_var_eqv2glo)
457         v_i_1d (1:npti) = h_i_1d (1:npti) * a_i_1d (1:npti)
458         v_s_1d (1:npti) = h_s_1d (1:npti) * a_i_1d (1:npti)
459         sv_i_1d(1:npti) = s_i_1d (1:npti) * v_i_1d (1:npti)
460         v_ip_1d(1:npti) = h_ip_1d(1:npti) * a_ip_1d(1:npti)
461         v_il_1d(1:npti) = h_il_1d(1:npti) * a_ip_1d(1:npti)
462         oa_i_1d(1:npti) = o_i_1d (1:npti) * a_i_1d (1:npti)
463         
464         CALL tab_1d_2d( npti, nptidx(1:npti), at_i_1d(1:npti), at_i             )
465         CALL tab_1d_2d( npti, nptidx(1:npti), a_i_1d (1:npti), a_i (:,:,kl)     )
466         CALL tab_1d_2d( npti, nptidx(1:npti), h_i_1d (1:npti), h_i (:,:,kl)     )
467         CALL tab_1d_2d( npti, nptidx(1:npti), h_s_1d (1:npti), h_s (:,:,kl)     )
468         CALL tab_1d_2d( npti, nptidx(1:npti), t_su_1d(1:npti), t_su(:,:,kl)     )
469         CALL tab_1d_2d( npti, nptidx(1:npti), s_i_1d (1:npti), s_i (:,:,kl)     )
470         DO jk = 1, nlay_s
471            CALL tab_1d_2d( npti, nptidx(1:npti), t_s_1d(1:npti,jk), t_s(:,:,jk,kl)    )
472            CALL tab_1d_2d( npti, nptidx(1:npti), e_s_1d(1:npti,jk), e_s(:,:,jk,kl)    )
473         END DO
474         DO jk = 1, nlay_i
475            CALL tab_1d_2d( npti, nptidx(1:npti), t_i_1d (1:npti,jk), t_i (:,:,jk,kl)  )
476            CALL tab_1d_2d( npti, nptidx(1:npti), e_i_1d (1:npti,jk), e_i (:,:,jk,kl)  )
477            CALL tab_1d_2d( npti, nptidx(1:npti), sz_i_1d(1:npti,jk), sz_i(:,:,jk,kl)  )
478         END DO
479         CALL tab_1d_2d( npti, nptidx(1:npti), a_ip_1d     (1:npti), a_ip     (:,:,kl) )
480         CALL tab_1d_2d( npti, nptidx(1:npti), h_ip_1d     (1:npti), h_ip     (:,:,kl) )
481         CALL tab_1d_2d( npti, nptidx(1:npti), h_il_1d     (1:npti), h_il     (:,:,kl) )
482         !
483         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_snw_sni_1d(1:npti), wfx_snw_sni )
484         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_snw_sum_1d(1:npti), wfx_snw_sum )
485         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_sub_1d    (1:npti), wfx_sub     )
486         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_snw_sub_1d(1:npti), wfx_snw_sub )
487         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_ice_sub_1d(1:npti), wfx_ice_sub )
488         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_err_sub_1d(1:npti), wfx_err_sub )
489         !
490         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_bog_1d (1:npti), wfx_bog        )
491         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_bom_1d (1:npti), wfx_bom        )
492         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_sum_1d (1:npti), wfx_sum        )
493         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_sni_1d (1:npti), wfx_sni        )
494         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_res_1d (1:npti), wfx_res        )
495         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_spr_1d (1:npti), wfx_spr        )
496         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_lam_1d (1:npti), wfx_lam        )
497         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_pnd_1d (1:npti), wfx_pnd        )
498         !
499         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_bog_1d (1:npti), sfx_bog        )
500         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_bom_1d (1:npti), sfx_bom        )
501         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_sum_1d (1:npti), sfx_sum        )
502         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_sni_1d (1:npti), sfx_sni        )
503         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_bri_1d (1:npti), sfx_bri        )
504         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_res_1d (1:npti), sfx_res        )
505         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_sub_1d (1:npti), sfx_sub        )
506         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_lam_1d (1:npti), sfx_lam        )
507         !
508         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_thd_1d    (1:npti), hfx_thd     )
509         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_spr_1d    (1:npti), hfx_spr     )
510         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_sum_1d    (1:npti), hfx_sum     )
511         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_bom_1d    (1:npti), hfx_bom     )
512         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_bog_1d    (1:npti), hfx_bog     )
513         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_dif_1d    (1:npti), hfx_dif     )
514         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_opw_1d    (1:npti), hfx_opw     )
515         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_snw_1d    (1:npti), hfx_snw     )
516         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_sub_1d    (1:npti), hfx_sub     )
517         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_res_1d    (1:npti), hfx_res     )
518         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_err_dif_1d(1:npti), hfx_err_dif )
519         !
520         CALL tab_1d_2d( npti, nptidx(1:npti), qns_ice_1d    (1:npti), qns_ice    (:,:,kl) )
521         CALL tab_1d_2d( npti, nptidx(1:npti), qtr_ice_bot_1d(1:npti), qtr_ice_bot(:,:,kl) )
522         ! effective conductivity and 1st layer temperature (ln_cndflx=T)
523         CALL tab_1d_2d( npti, nptidx(1:npti), cnd_ice_1d(1:npti), cnd_ice(:,:,kl) )
524         CALL tab_1d_2d( npti, nptidx(1:npti), t1_ice_1d (1:npti), t1_ice (:,:,kl) )
525         ! SIMIP diagnostics         
526         CALL tab_1d_2d( npti, nptidx(1:npti), t_si_1d       (1:npti), t_si       (:,:,kl) )
527         CALL tab_1d_2d( npti, nptidx(1:npti), qcn_ice_bot_1d(1:npti), qcn_ice_bot(:,:,kl) )
528         CALL tab_1d_2d( npti, nptidx(1:npti), qcn_ice_top_1d(1:npti), qcn_ice_top(:,:,kl) )
529         ! extensive variables
530         CALL tab_1d_2d( npti, nptidx(1:npti), v_i_1d (1:npti), v_i (:,:,kl) )
531         CALL tab_1d_2d( npti, nptidx(1:npti), v_s_1d (1:npti), v_s (:,:,kl) )
532         CALL tab_1d_2d( npti, nptidx(1:npti), sv_i_1d(1:npti), sv_i(:,:,kl) )
533         CALL tab_1d_2d( npti, nptidx(1:npti), v_ip_1d(1:npti), v_ip(:,:,kl) )
534         CALL tab_1d_2d( npti, nptidx(1:npti), v_il_1d(1:npti), v_il(:,:,kl) )
535         CALL tab_1d_2d( npti, nptidx(1:npti), oa_i_1d(1:npti), oa_i(:,:,kl) )
536         ! check convergence of heat diffusion scheme
537         IF( ln_zdf_chkcvg ) THEN
538            CALL tab_1d_2d( npti, nptidx(1:npti), tice_cvgerr_1d(1:npti), ztice_cvgerr(:,:,kl) )
539            CALL tab_1d_2d( npti, nptidx(1:npti), tice_cvgstp_1d(1:npti), ztice_cvgstp(:,:,kl) )
540         ENDIF
541         !
542      END SELECT
543      !
544   END SUBROUTINE ice_thd_1d2d
545
546
547   SUBROUTINE ice_thd_init
548      !!-------------------------------------------------------------------
549      !!                   ***  ROUTINE ice_thd_init ***
550      !!                 
551      !! ** Purpose :   Physical constants and parameters associated with
552      !!                ice thermodynamics
553      !!
554      !! ** Method  :   Read the namthd namelist and check the parameters
555      !!                called at the first timestep (nit000)
556      !!
557      !! ** input   :   Namelist namthd
558      !!-------------------------------------------------------------------
559      INTEGER  ::   ios   ! Local integer output status for namelist read
560      !!
561      NAMELIST/namthd/ ln_icedH, ln_icedA, ln_icedO, ln_icedS, ln_leadhfx
562      !!-------------------------------------------------------------------
563      !
564      READ  ( numnam_ice_ref, namthd, IOSTAT = ios, ERR = 901)
565901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd in reference namelist' )
566      READ  ( numnam_ice_cfg, namthd, IOSTAT = ios, ERR = 902 )
567902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd in configuration namelist' )
568      IF(lwm) WRITE( numoni, namthd )
569      !
570      IF(lwp) THEN                          ! control print
571         WRITE(numout,*)
572         WRITE(numout,*) 'ice_thd_init: Ice Thermodynamics'
573         WRITE(numout,*) '~~~~~~~~~~~~'
574         WRITE(numout,*) '   Namelist namthd:'
575         WRITE(numout,*) '      activate ice thick change from top/bot (T) or not (F)                ln_icedH   = ', ln_icedH
576         WRITE(numout,*) '      activate lateral melting (T) or not (F)                              ln_icedA   = ', ln_icedA
577         WRITE(numout,*) '      activate ice growth in open-water (T) or not (F)                     ln_icedO   = ', ln_icedO
578         WRITE(numout,*) '      activate gravity drainage and flushing (T) or not (F)                ln_icedS   = ', ln_icedS
579         WRITE(numout,*) '      heat in the leads is used to melt sea-ice before warming the ocean   ln_leadhfx = ', ln_leadhfx
580     ENDIF
581      !
582                       CALL ice_thd_zdf_init   ! set ice heat diffusion parameters
583      IF( ln_icedA )   CALL ice_thd_da_init    ! set ice lateral melting parameters
584      IF( ln_icedO )   CALL ice_thd_do_init    ! set ice growth in open water parameters
585                       CALL ice_thd_sal_init   ! set ice salinity parameters
586                       CALL ice_thd_pnd_init   ! set melt ponds parameters
587      !
588   END SUBROUTINE ice_thd_init
589
590#else
591   !!----------------------------------------------------------------------
592   !!   Default option         Dummy module          NO  SI3 sea-ice model
593   !!----------------------------------------------------------------------
594#endif
595
596   !!======================================================================
597END MODULE icethd
Note: See TracBrowser for help on using the repository browser.