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

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

changes in style - part6 - pure cosmetics

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