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/branches/UKMO/NEMO_4.0_GO8_coupled_iodef/src/ICE – NEMO

source: NEMO/branches/UKMO/NEMO_4.0_GO8_coupled_iodef/src/ICE/icethd.F90 @ 12779

Last change on this file since 12779 was 11367, checked in by dancopsey, 5 years ago

More print statements including fix

File size: 34.9 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, qns_tot, qsr_tot, 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 lib_mpp        ! MPP library
38   USE lib_fortran    ! fortran utilities (glob_sum + no signed zero)
39   USE lbclnk         ! lateral boundary conditions (or mpp links)
40   USE timing         ! Timing
41
42   IMPLICIT NONE
43   PRIVATE
44
45   PUBLIC   ice_thd         ! called by limstp module
46   PUBLIC   ice_thd_init    ! called by ice_init
47
48   !!** namelist (namthd) **
49   LOGICAL ::   ln_icedH         ! activate ice thickness change from growing/melting (T) or not (F)
50   LOGICAL ::   ln_icedA         ! activate lateral melting param. (T) or not (F)
51   LOGICAL ::   ln_icedO         ! activate ice growth in open-water (T) or not (F)
52   LOGICAL ::   ln_icedS         ! activate gravity drainage and flushing (T) or not (F)
53
54   !! * Substitutions
55#  include "vectopt_loop_substitute.h90"
56   !!----------------------------------------------------------------------
57   !! NEMO/ICE 4.0 , NEMO Consortium (2018)
58   !! $Id$
59   !! Software governed by the CeCILL license (see ./LICENSE)
60   !!----------------------------------------------------------------------
61CONTAINS
62
63   SUBROUTINE ice_thd( kt )
64      !!-------------------------------------------------------------------
65      !!                ***  ROUTINE ice_thd  ***       
66      !! 
67      !! ** Purpose : This routine manages ice thermodynamics
68      !!         
69      !! ** Action : - computation of oceanic sensible heat flux at the ice base
70      !!                              energy budget in the leads
71      !!                              net fluxes on top of ice and of ocean
72      !!             - selection of grid cells with ice
73      !!                - call ice_thd_zdf  for vertical heat diffusion
74      !!                - call ice_thd_dh   for vertical ice growth and melt
75      !!                - call ice_thd_pnd  for melt ponds
76      !!                - call ice_thd_ent  for enthalpy remapping
77      !!                - call ice_thd_sal  for ice desalination
78      !!                - call ice_thd_temp to  retrieve temperature from ice enthalpy
79      !!                - call ice_thd_mono for extra lateral ice melt if active virtual thickness distribution
80      !!                - call ice_thd_da   for lateral ice melt
81      !!             - back to the geographic grid
82      !!                - call ice_thd_rem  for remapping thickness distribution
83      !!                - call ice_thd_do   for ice growth in leads
84      !!-------------------------------------------------------------------
85      INTEGER, INTENT(in) :: kt    ! number of iteration
86      !
87      INTEGER  :: ji, jj, jk, jl   ! dummy loop indices
88      REAL(wp) :: zfric_u, zqld, zqfr, zqfr_neg
89      REAL(wp), PARAMETER :: zfric_umin = 0._wp           ! lower bound for the friction velocity (cice value=5.e-04)
90      REAL(wp), PARAMETER :: zch        = 0.0057_wp       ! heat transfer coefficient
91      REAL(wp), DIMENSION(jpi,jpj) ::   zu_io, zv_io, zfric   ! ice-ocean velocity (m/s) and frictional velocity (m2/s2)
92      !
93      !!-------------------------------------------------------------------
94      ! controls
95      IF( ln_timing    )   CALL timing_start('icethd')                                                             ! timing
96      IF( ln_icediachk )   CALL ice_cons_hsm(0, 'icethd', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft) ! conservation
97
98      IF( kt == nit000 .AND. lwp ) THEN
99         WRITE(numout,*)
100         WRITE(numout,*) 'ice_thd: sea-ice thermodynamics'
101         WRITE(numout,*) '~~~~~~~'
102      ENDIF
103     
104      !---------------------------------------------!
105      ! computation of friction velocity at T points
106      !---------------------------------------------!
107      IF( ln_icedyn ) 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( 'icethd', zfric, 'T',  1. )
127
128      IF(narea == 68) THEN
129         WRITE(968,*) 'sum qlead in icethd before loop = ',SUM(qlead)
130         WRITE(968,*) 'sum tmask = ',SUM(tmask)
131         WRITE(968,*) 'sum at_i = ',SUM(at_i)
132         WRITE(968,*) 'sum at_i_b = ',SUM(at_i_b)
133         WRITE(968,*) 'sum qsr_oce = ',SUM(qsr_oce)
134         WRITE(968,*) 'sum frq_m = ',SUM(frq_m)
135         WRITE(968,*) 'sum qns_oce = ',SUM(qns_oce)
136         WRITE(968,*) 'sum qemp_oce = ',SUM(qemp_oce)
137         WRITE(968,*) 'sum e3t_m = ',SUM(e3t_m)
138         WRITE(968,*) 'sum t_bo = ',SUM(t_bo)
139         WRITE(968,*) 'sum sst_m = ',SUM(sst_m)
140         WRITE(968,*) 'sum zfric = ',SUM(zfric)
141      ENDIF
142      !
143      !--------------------------------------------------------------------!
144      ! Partial computation of forcing for the thermodynamic sea ice model
145      !--------------------------------------------------------------------!
146      DO jj = 1, jpj
147         DO ji = 1, jpi
148            rswitch  = tmask(ji,jj,1) * MAX( 0._wp , SIGN( 1._wp , at_i(ji,jj) - epsi10 ) ) ! 0 if no ice
149            !
150            !           !  solar irradiance transmission at the mixed layer bottom and used in the lead heat budget
151            !           !  practically no "direct lateral ablation"
152            !           
153            !           !  net downward heat flux from the ice to the ocean, expressed as a function of ocean
154            !           !  temperature and turbulent mixing (McPhee, 1992)
155            !
156            ! --- Energy received in the lead from atm-oce exchanges, zqld is defined everywhere (J.m-2) --- !
157            zqld =  tmask(ji,jj,1) * rdt_ice *  &
158               &    ( ( 1._wp - at_i_b(ji,jj) ) * qsr_oce(ji,jj) * frq_m(ji,jj) +  &
159               &      ( 1._wp - at_i_b(ji,jj) ) * qns_oce(ji,jj) + qemp_oce(ji,jj) )
160
161            ! --- Energy needed to bring ocean surface layer until its freezing (mostly<0 but >0 if supercooling, J.m-2) --- !
162            zqfr     = rau0 * 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)
163            zqfr_neg = MIN( zqfr , 0._wp )                                                                    ! only < 0
164
165            ! --- Sensible ocean-to-ice heat flux (mostly>0 but <0 if supercooling, W/m2)
166            zfric_u            = MAX( SQRT( zfric(ji,jj) ), zfric_umin ) 
167            qsb_ice_bot(ji,jj) = rswitch * rau0 * rcp * zch * zfric_u * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) ) ! W.m-2
168
169            qsb_ice_bot(ji,jj) = rswitch * MIN( qsb_ice_bot(ji,jj), - zqfr_neg * r1_rdtice / MAX( at_i(ji,jj), epsi10 ) )
170            ! upper bound for qsb_ice_bot: the heat retrieved from the ocean must be smaller than the heat necessary to reach
171            !                              the freezing point, so that we do not have SST < T_freeze
172            !                              This implies: - ( qsb_ice_bot(ji,jj) * at_i(ji,jj) * rtdice ) - zqfr >= 0
173
174            !-- Energy Budget of the leads (J.m-2), source of ice growth in open water. Must be < 0 to form ice
175            qlead(ji,jj) = MIN( 0._wp , zqld - ( qsb_ice_bot(ji,jj) * at_i(ji,jj) * rdt_ice ) - zqfr )
176
177            ! If there is ice and leads are warming => transfer energy from the lead budget and use it for bottom melting
178            ! If the grid cell is fully covered by ice (no leads) => transfer energy from the lead budget to the ice bottom budget
179            IF( ( zqld >= 0._wp .AND. at_i(ji,jj) > 0._wp ) .OR. at_i(ji,jj) >= (1._wp - epsi10) ) THEN
180               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
181               qlead(ji,jj) = 0._wp
182            ELSE
183               fhld (ji,jj) = 0._wp
184            ENDIF
185            !
186            ! Net heat flux on top of the ice-ocean [W.m-2]
187            ! ---------------------------------------------
188            qt_atm_oi(ji,jj) = qns_tot(ji,jj) + qsr_tot(ji,jj) 
189         END DO
190      END DO
191
192      IF(narea == 68) THEN
193         WRITE(968,*) 'sum qlead in icethd after loop = ',SUM(qlead)
194      ENDIF
195     
196      ! In case we bypass open-water ice formation
197      IF( .NOT. ln_icedO )  qlead(:,:) = 0._wp
198      ! In case we bypass growing/melting from top and bottom
199      IF( .NOT. ln_icedH ) THEN
200         qsb_ice_bot(:,:) = 0._wp
201         fhld       (:,:) = 0._wp
202      ENDIF
203
204      ! ---------------------------------------------------------------------
205      ! Net heat flux on top of the ocean after ice thermo (1st step) [W.m-2]
206      ! ---------------------------------------------------------------------
207      !     First  step here              :  non solar + precip - qlead - qsensible
208      !     Second step in icethd_dh      :  heat remaining if total melt (zq_rema)
209      !     Third  step in iceupdate.F90  :  heat from ice-ocean mass exchange (zf_mass) + solar
210      qt_oce_ai(:,:) = ( 1._wp - at_i_b(:,:) ) * qns_oce(:,:) + qemp_oce(:,:)  &  ! Non solar heat flux received by the ocean               
211         &             - qlead(:,:) * r1_rdtice                                &  ! heat flux taken from the ocean where there is open water ice formation
212         &             - at_i (:,:) * qsb_ice_bot(:,:)                         &  ! heat flux taken by sensible flux
213         &             - at_i (:,:) * fhld       (:,:)                            ! heat flux taken during bottom growth/melt
214      !                                                                           !    (fhld should be 0 while bott growth)
215      !-------------------------------------------------------------------------------------------!
216      ! Thermodynamic computation (only on grid points covered by ice) => loop over ice categories
217      !-------------------------------------------------------------------------------------------!
218      DO jl = 1, jpl
219
220         ! select ice covered grid points
221         npti = 0 ; nptidx(:) = 0
222         DO jj = 1, jpj
223            DO ji = 1, jpi
224               IF ( a_i(ji,jj,jl) > epsi10 ) THEN     
225                  npti         = npti  + 1
226                  nptidx(npti) = (jj - 1) * jpi + ji
227               ENDIF
228            END DO
229         END DO
230
231         IF( npti > 0 ) THEN  ! If there is no ice, do nothing.
232            !                                                               
233                              CALL ice_thd_1d2d( jl, 1 )            ! --- Move to 1D arrays --- !
234            !                                                       ! --- & Change units of e_i, e_s from J/m2 to J/m3 --- !
235            !
236            s_i_new   (1:npti) = 0._wp ; dh_s_tot(1:npti) = 0._wp  ! --- some init --- !  (important to have them here)
237            dh_i_sum  (1:npti) = 0._wp ; dh_i_bom(1:npti) = 0._wp ; dh_i_itm  (1:npti) = 0._wp 
238            dh_i_sub  (1:npti) = 0._wp ; dh_i_bog(1:npti) = 0._wp
239            dh_snowice(1:npti) = 0._wp ; dh_s_mlt(1:npti) = 0._wp
240            !                                     
241                              CALL ice_thd_zdf                      ! --- Ice-Snow temperature --- !
242            !
243            IF( ln_icedH ) THEN                                     ! --- Growing/Melting --- !
244                              CALL ice_thd_dh                           ! Ice-Snow thickness   
245                              CALL ice_thd_pnd                          ! Melt ponds formation
246                              CALL ice_thd_ent( e_i_1d(1:npti,:) )      ! Ice enthalpy remapping
247            ENDIF
248                              CALL ice_thd_sal( ln_icedS )          ! --- Ice salinity --- !   
249            !
250                              CALL ice_thd_temp                     ! --- Temperature update --- !
251            !
252            IF( ln_icedH .AND. ln_virtual_itd ) &
253               &              CALL ice_thd_mono                     ! --- Extra lateral melting if virtual_itd --- !
254            !
255            IF( ln_icedA )    CALL ice_thd_da                       ! --- Lateral melting --- !
256            !
257                              CALL ice_thd_1d2d( jl, 2 )            ! --- Change units of e_i, e_s from J/m3 to J/m2 --- !
258            !                                                       ! --- & Move to 2D arrays --- !
259         ENDIF
260         !
261      END DO
262      !
263      IF( ln_icediachk )   CALL ice_cons_hsm(1, 'icethd', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft)
264      !                   
265      IF( jpl > 1  )          CALL ice_itd_rem( kt )                ! --- Transport ice between thickness categories --- !
266      !
267      IF( ln_icedO )          CALL ice_thd_do                       ! --- Frazil ice growth in leads --- !
268      !
269      ! controls
270      IF( ln_icectl )   CALL ice_prt    (kt, iiceprt, jiceprt, 1, ' - ice thermodyn. - ') ! prints
271      IF( ln_ctl    )   CALL ice_prt3D  ('icethd')                                        ! prints
272      IF( ln_timing )   CALL timing_stop('icethd')                                        ! timing
273      !
274   END SUBROUTINE ice_thd 
275
276 
277   SUBROUTINE ice_thd_temp
278      !!-----------------------------------------------------------------------
279      !!                   ***  ROUTINE ice_thd_temp ***
280      !!                 
281      !! ** Purpose :   Computes sea ice temperature (Kelvin) from enthalpy
282      !!
283      !! ** Method  :   Formula (Bitz and Lipscomb, 1999)
284      !!-------------------------------------------------------------------
285      INTEGER  ::   ji, jk   ! dummy loop indices
286      REAL(wp) ::   ztmelts, zbbb, zccc  ! local scalar
287      !!-------------------------------------------------------------------
288      ! Recover ice temperature
289      DO jk = 1, nlay_i
290         DO ji = 1, npti
291            ztmelts       = -rTmlt * sz_i_1d(ji,jk)
292            ! Conversion q(S,T) -> T (second order equation)
293            zbbb          = ( rcp - rcpi ) * ztmelts + e_i_1d(ji,jk) * r1_rhoi - rLfus
294            zccc          = SQRT( MAX( zbbb * zbbb - 4._wp * rcpi * rLfus * ztmelts, 0._wp ) )
295            t_i_1d(ji,jk) = rt0 - ( zbbb + zccc ) * 0.5_wp * r1_rcpi
296           
297            ! mask temperature
298            rswitch       = 1._wp - MAX( 0._wp , SIGN( 1._wp , - h_i_1d(ji) ) ) 
299            t_i_1d(ji,jk) = rswitch * t_i_1d(ji,jk) + ( 1._wp - rswitch ) * rt0
300         END DO
301      END DO 
302      !
303   END SUBROUTINE ice_thd_temp
304
305
306   SUBROUTINE ice_thd_mono
307      !!-----------------------------------------------------------------------
308      !!                   ***  ROUTINE ice_thd_mono ***
309      !!                 
310      !! ** Purpose :   Lateral melting in case virtual_itd
311      !!                          ( dA = A/2h dh )
312      !!-----------------------------------------------------------------------
313      INTEGER  ::   ji                 ! dummy loop indices
314      REAL(wp) ::   zhi_bef            ! ice thickness before thermo
315      REAL(wp) ::   zdh_mel, zda_mel   ! net melting
316      REAL(wp) ::   zvi, zvs           ! ice/snow volumes
317      !!-----------------------------------------------------------------------
318      !
319      DO ji = 1, npti
320         zdh_mel = MIN( 0._wp, dh_i_itm(ji) + dh_i_sum(ji) + dh_i_bom(ji) + dh_snowice(ji) + dh_i_sub(ji) )
321         IF( zdh_mel < 0._wp .AND. a_i_1d(ji) > 0._wp )  THEN
322            zvi          = a_i_1d(ji) * h_i_1d(ji)
323            zvs          = a_i_1d(ji) * h_s_1d(ji)
324            ! lateral melting = concentration change
325            zhi_bef     = h_i_1d(ji) - zdh_mel
326            rswitch     = MAX( 0._wp , SIGN( 1._wp , zhi_bef - epsi20 ) )
327            zda_mel     = rswitch * a_i_1d(ji) * zdh_mel / ( 2._wp * MAX( zhi_bef, epsi20 ) )
328            a_i_1d(ji)  = MAX( epsi20, a_i_1d(ji) + zda_mel ) 
329            ! adjust thickness
330            h_i_1d(ji) = zvi / a_i_1d(ji)           
331            h_s_1d(ji) = zvs / a_i_1d(ji)           
332            ! retrieve total concentration
333            at_i_1d(ji) = a_i_1d(ji)
334         END IF
335      END DO
336      !
337   END SUBROUTINE ice_thd_mono
338
339
340   SUBROUTINE ice_thd_1d2d( kl, kn )
341      !!-----------------------------------------------------------------------
342      !!                   ***  ROUTINE ice_thd_1d2d ***
343      !!                 
344      !! ** Purpose :   move arrays from 1d to 2d and the reverse
345      !!-----------------------------------------------------------------------
346      INTEGER, INTENT(in) ::   kl   ! index of the ice category
347      INTEGER, INTENT(in) ::   kn   ! 1= from 2D to 1D   ;   2= from 1D to 2D
348      !
349      INTEGER ::   jk   ! dummy loop indices
350      INTEGER ::   jn , jid, jjd
351      !!-----------------------------------------------------------------------
352      !
353      SELECT CASE( kn )
354      !                    !---------------------!
355      CASE( 1 )            !==  from 2D to 1D  ==!
356         !                 !---------------------!
357
358         DO jn = 1, npti
359           jid        = MOD( nptidx(jn) - 1 , jpi ) + 1
360           jjd        =    ( nptidx(jn) - 1 ) / jpi + 1
361           IF( jn == 54 ) THEN
362             IF( narea == 68) THEN
363               WRITE(968,*) 'in ice_thd_1d2d: ice_cat=',kl
364               WRITE(968,*) 'in ice_thd_1d2d: jid, jjd for point 54 is ',jid,jjd
365               WRITE(968,*) 'a_i for this point = ',a_i(jid,jjd)
366             END IF
367           END IF
368         END DO
369
370         CALL tab_2d_1d( npti, nptidx(1:npti), at_i_1d(1:npti), at_i             )
371         CALL tab_2d_1d( npti, nptidx(1:npti), a_i_1d (1:npti), a_i (:,:,kl)     )
372         CALL tab_2d_1d( npti, nptidx(1:npti), h_i_1d (1:npti), h_i (:,:,kl)     )
373         CALL tab_2d_1d( npti, nptidx(1:npti), h_s_1d (1:npti), h_s (:,:,kl)     )
374         CALL tab_2d_1d( npti, nptidx(1:npti), t_su_1d(1:npti), t_su(:,:,kl)     )
375         CALL tab_2d_1d( npti, nptidx(1:npti), s_i_1d (1:npti), s_i (:,:,kl)     )
376         DO jk = 1, nlay_s
377            CALL tab_2d_1d( npti, nptidx(1:npti), t_s_1d(1:npti,jk), t_s(:,:,jk,kl)    )
378            CALL tab_2d_1d( npti, nptidx(1:npti), e_s_1d(1:npti,jk), e_s(:,:,jk,kl)    )
379         END DO
380         DO jk = 1, nlay_i
381            CALL tab_2d_1d( npti, nptidx(1:npti), t_i_1d (1:npti,jk), t_i (:,:,jk,kl)  )
382            CALL tab_2d_1d( npti, nptidx(1:npti), e_i_1d (1:npti,jk), e_i (:,:,jk,kl)  )
383            CALL tab_2d_1d( npti, nptidx(1:npti), sz_i_1d(1:npti,jk), sz_i(:,:,jk,kl)  )
384         END DO
385         CALL tab_2d_1d( npti, nptidx(1:npti), a_ip_1d     (1:npti), a_ip     (:,:,kl) )
386         CALL tab_2d_1d( npti, nptidx(1:npti), h_ip_1d     (1:npti), h_ip     (:,:,kl) )
387         CALL tab_2d_1d( npti, nptidx(1:npti), a_ip_frac_1d(1:npti), a_ip_frac(:,:,kl) )
388         !
389         CALL tab_2d_1d( npti, nptidx(1:npti), qprec_ice_1d  (1:npti), qprec_ice            )
390         CALL tab_2d_1d( npti, nptidx(1:npti), qsr_ice_1d    (1:npti), qsr_ice (:,:,kl)     )
391         CALL tab_2d_1d( npti, nptidx(1:npti), qns_ice_1d    (1:npti), qns_ice (:,:,kl)     )
392         CALL tab_2d_1d( npti, nptidx(1:npti), evap_ice_1d   (1:npti), evap_ice(:,:,kl)     )
393         CALL tab_2d_1d( npti, nptidx(1:npti), dqns_ice_1d   (1:npti), dqns_ice(:,:,kl)     )
394         CALL tab_2d_1d( npti, nptidx(1:npti), t_bo_1d       (1:npti), t_bo                 )
395         CALL tab_2d_1d( npti, nptidx(1:npti), sprecip_1d    (1:npti), sprecip              ) 
396         CALL tab_2d_1d( npti, nptidx(1:npti), qsb_ice_bot_1d(1:npti), qsb_ice_bot          )
397         CALL tab_2d_1d( npti, nptidx(1:npti), fhld_1d       (1:npti), fhld                 )
398         
399         CALL tab_2d_1d( npti, nptidx(1:npti), qml_ice_1d    (1:npti), qml_ice    (:,:,kl) )
400         CALL tab_2d_1d( npti, nptidx(1:npti), qcn_ice_1d    (1:npti), qcn_ice    (:,:,kl) )
401         CALL tab_2d_1d( npti, nptidx(1:npti), qtr_ice_top_1d(1:npti), qtr_ice_top(:,:,kl) )
402         !
403         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_snw_sni_1d(1:npti), wfx_snw_sni   )
404         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_snw_sum_1d(1:npti), wfx_snw_sum   )
405         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_sub_1d    (1:npti), wfx_sub       )
406         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_snw_sub_1d(1:npti), wfx_snw_sub   )
407         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_ice_sub_1d(1:npti), wfx_ice_sub   )
408         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_err_sub_1d(1:npti), wfx_err_sub   )
409         !
410         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_bog_1d (1:npti), wfx_bog          )
411         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_bom_1d (1:npti), wfx_bom          )
412         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_sum_1d (1:npti), wfx_sum          )
413         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_sni_1d (1:npti), wfx_sni          )
414         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_res_1d (1:npti), wfx_res          )
415         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_spr_1d (1:npti), wfx_spr          )
416         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_lam_1d (1:npti), wfx_lam          )
417         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_pnd_1d (1:npti), wfx_pnd          )
418         !
419         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_bog_1d (1:npti), sfx_bog          )
420         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_bom_1d (1:npti), sfx_bom          )
421         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_sum_1d (1:npti), sfx_sum          )
422         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_sni_1d (1:npti), sfx_sni          )
423         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_bri_1d (1:npti), sfx_bri          )
424         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_res_1d (1:npti), sfx_res          )
425         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_sub_1d (1:npti), sfx_sub          )
426         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_lam_1d (1:npti), sfx_lam          )
427         !
428         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_thd_1d    (1:npti), hfx_thd       )
429         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_spr_1d    (1:npti), hfx_spr       )
430         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_sum_1d    (1:npti), hfx_sum       )
431         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_bom_1d    (1:npti), hfx_bom       )
432         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_bog_1d    (1:npti), hfx_bog       )
433         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_dif_1d    (1:npti), hfx_dif       )
434         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_opw_1d    (1:npti), hfx_opw       )
435         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_snw_1d    (1:npti), hfx_snw       )
436         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_sub_1d    (1:npti), hfx_sub       )
437         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_res_1d    (1:npti), hfx_res       )
438         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_err_dif_1d(1:npti), hfx_err_dif   )
439         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_err_rem_1d(1:npti), hfx_err_rem   )
440         CALL tab_2d_1d( npti, nptidx(1:npti), qt_oce_ai_1d  (1:npti), qt_oce_ai     )
441         !
442         ! ocean surface fields
443         CALL tab_2d_1d( npti, nptidx(1:npti), sst_1d(1:npti), sst_m )
444         CALL tab_2d_1d( npti, nptidx(1:npti), sss_1d(1:npti), sss_m )
445         !
446         ! to update ice age
447         CALL tab_2d_1d( npti, nptidx(1:npti), o_i_1d (1:npti), o_i (:,:,kl) )
448         CALL tab_2d_1d( npti, nptidx(1:npti), oa_i_1d(1:npti), oa_i(:,:,kl) )
449         !
450         ! --- Change units of e_i, e_s from J/m2 to J/m3 --- !
451         DO jk = 1, nlay_i
452            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
453         END DO
454         DO jk = 1, nlay_s
455            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
456         END DO
457         !
458         !                 !---------------------!
459      CASE( 2 )            !==  from 1D to 2D  ==!
460         !                 !---------------------!
461         ! --- Change units of e_i, e_s from J/m3 to J/m2 --- !
462         DO jk = 1, nlay_i
463            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
464         END DO
465         DO jk = 1, nlay_s
466            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
467         END DO
468         !
469         ! Change thickness to volume (replaces routine ice_var_eqv2glo)
470         v_i_1d (1:npti) = h_i_1d (1:npti) * a_i_1d (1:npti)
471         v_s_1d (1:npti) = h_s_1d (1:npti) * a_i_1d (1:npti)
472         sv_i_1d(1:npti) = s_i_1d (1:npti) * v_i_1d (1:npti)
473         v_ip_1d(1:npti) = h_ip_1d(1:npti) * a_ip_1d(1:npti)
474         oa_i_1d(1:npti) = o_i_1d (1:npti) * a_i_1d (1:npti)
475         
476         CALL tab_1d_2d( npti, nptidx(1:npti), at_i_1d(1:npti), at_i             )
477         CALL tab_1d_2d( npti, nptidx(1:npti), a_i_1d (1:npti), a_i (:,:,kl)     )
478         CALL tab_1d_2d( npti, nptidx(1:npti), h_i_1d (1:npti), h_i (:,:,kl)     )
479         CALL tab_1d_2d( npti, nptidx(1:npti), h_s_1d (1:npti), h_s (:,:,kl)     )
480         CALL tab_1d_2d( npti, nptidx(1:npti), t_su_1d(1:npti), t_su(:,:,kl)     )
481         CALL tab_1d_2d( npti, nptidx(1:npti), s_i_1d (1:npti), s_i (:,:,kl)     )
482         DO jk = 1, nlay_s
483            CALL tab_1d_2d( npti, nptidx(1:npti), t_s_1d(1:npti,jk), t_s(:,:,jk,kl)    )
484            CALL tab_1d_2d( npti, nptidx(1:npti), e_s_1d(1:npti,jk), e_s(:,:,jk,kl)    )
485         END DO
486         DO jk = 1, nlay_i
487            CALL tab_1d_2d( npti, nptidx(1:npti), t_i_1d (1:npti,jk), t_i (:,:,jk,kl)  )
488            CALL tab_1d_2d( npti, nptidx(1:npti), e_i_1d (1:npti,jk), e_i (:,:,jk,kl)  )
489            CALL tab_1d_2d( npti, nptidx(1:npti), sz_i_1d(1:npti,jk), sz_i(:,:,jk,kl)  )
490         END DO
491         CALL tab_1d_2d( npti, nptidx(1:npti), a_ip_1d     (1:npti), a_ip     (:,:,kl) )
492         CALL tab_1d_2d( npti, nptidx(1:npti), h_ip_1d     (1:npti), h_ip     (:,:,kl) )
493         CALL tab_1d_2d( npti, nptidx(1:npti), a_ip_frac_1d(1:npti), a_ip_frac(:,:,kl) )
494         !
495         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_snw_sni_1d(1:npti), wfx_snw_sni )
496         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_snw_sum_1d(1:npti), wfx_snw_sum )
497         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_sub_1d    (1:npti), wfx_sub     )
498         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_snw_sub_1d(1:npti), wfx_snw_sub )
499         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_ice_sub_1d(1:npti), wfx_ice_sub )
500         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_err_sub_1d(1:npti), wfx_err_sub )
501         !
502         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_bog_1d (1:npti), wfx_bog        )
503         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_bom_1d (1:npti), wfx_bom        )
504         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_sum_1d (1:npti), wfx_sum        )
505         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_sni_1d (1:npti), wfx_sni        )
506         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_res_1d (1:npti), wfx_res        )
507         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_spr_1d (1:npti), wfx_spr        )
508         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_lam_1d (1:npti), wfx_lam        )
509         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_pnd_1d (1:npti), wfx_pnd        )
510         !
511         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_bog_1d (1:npti), sfx_bog        )
512         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_bom_1d (1:npti), sfx_bom        )
513         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_sum_1d (1:npti), sfx_sum        )
514         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_sni_1d (1:npti), sfx_sni        )
515         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_bri_1d (1:npti), sfx_bri        )
516         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_res_1d (1:npti), sfx_res        )
517         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_sub_1d (1:npti), sfx_sub        )
518         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_lam_1d (1:npti), sfx_lam        )
519         !
520         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_thd_1d    (1:npti), hfx_thd     )
521         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_spr_1d    (1:npti), hfx_spr     )
522         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_sum_1d    (1:npti), hfx_sum     )
523         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_bom_1d    (1:npti), hfx_bom     )
524         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_bog_1d    (1:npti), hfx_bog     )
525         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_dif_1d    (1:npti), hfx_dif     )
526         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_opw_1d    (1:npti), hfx_opw     )
527         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_snw_1d    (1:npti), hfx_snw     )
528         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_sub_1d    (1:npti), hfx_sub     )
529         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_res_1d    (1:npti), hfx_res     )
530         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_err_dif_1d(1:npti), hfx_err_dif )
531         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_err_rem_1d(1:npti), hfx_err_rem )
532         CALL tab_1d_2d( npti, nptidx(1:npti), qt_oce_ai_1d  (1:npti), qt_oce_ai   )
533         !
534         CALL tab_1d_2d( npti, nptidx(1:npti), qns_ice_1d    (1:npti), qns_ice    (:,:,kl) )
535         CALL tab_1d_2d( npti, nptidx(1:npti), qtr_ice_bot_1d(1:npti), qtr_ice_bot(:,:,kl) )
536         ! effective conductivity and 1st layer temperature (ln_cndflx=T)
537         CALL tab_1d_2d( npti, nptidx(1:npti), cnd_ice_1d(1:npti), cnd_ice(:,:,kl) )
538         CALL tab_1d_2d( npti, nptidx(1:npti), t1_ice_1d (1:npti), t1_ice (:,:,kl) )
539         ! SIMIP diagnostics         
540         CALL tab_1d_2d( npti, nptidx(1:npti), t_si_1d       (1:npti), t_si       (:,:,kl) )
541         CALL tab_1d_2d( npti, nptidx(1:npti), qcn_ice_bot_1d(1:npti), qcn_ice_bot(:,:,kl) )
542         CALL tab_1d_2d( npti, nptidx(1:npti), qcn_ice_top_1d(1:npti), qcn_ice_top(:,:,kl) )
543         ! extensive variables
544         CALL tab_1d_2d( npti, nptidx(1:npti), v_i_1d (1:npti), v_i (:,:,kl) )
545         CALL tab_1d_2d( npti, nptidx(1:npti), v_s_1d (1:npti), v_s (:,:,kl) )
546         CALL tab_1d_2d( npti, nptidx(1:npti), sv_i_1d(1:npti), sv_i(:,:,kl) )
547         CALL tab_1d_2d( npti, nptidx(1:npti), v_ip_1d(1:npti), v_ip(:,:,kl) )
548         CALL tab_1d_2d( npti, nptidx(1:npti), oa_i_1d(1:npti), oa_i(:,:,kl) )
549         !
550      END SELECT
551      !
552   END SUBROUTINE ice_thd_1d2d
553
554
555   SUBROUTINE ice_thd_init
556      !!-------------------------------------------------------------------
557      !!                   ***  ROUTINE ice_thd_init ***
558      !!                 
559      !! ** Purpose :   Physical constants and parameters associated with
560      !!                ice thermodynamics
561      !!
562      !! ** Method  :   Read the namthd namelist and check the parameters
563      !!                called at the first timestep (nit000)
564      !!
565      !! ** input   :   Namelist namthd
566      !!-------------------------------------------------------------------
567      INTEGER  ::   ios   ! Local integer output status for namelist read
568      !!
569      NAMELIST/namthd/ ln_icedH, ln_icedA, ln_icedO, ln_icedS
570      !!-------------------------------------------------------------------
571      !
572      REWIND( numnam_ice_ref )              ! Namelist namthd in reference namelist : Ice thermodynamics
573      READ  ( numnam_ice_ref, namthd, IOSTAT = ios, ERR = 901)
574901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namthd in reference namelist', lwp )
575      REWIND( numnam_ice_cfg )              ! Namelist namthd in configuration namelist : Ice thermodynamics
576      READ  ( numnam_ice_cfg, namthd, IOSTAT = ios, ERR = 902 )
577902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namthd in configuration namelist', lwp )
578      IF(lwm) WRITE( numoni, namthd )
579      !
580      IF(lwp) THEN                          ! control print
581         WRITE(numout,*)
582         WRITE(numout,*) 'ice_thd_init: Ice Thermodynamics'
583         WRITE(numout,*) '~~~~~~~~~~~~'
584         WRITE(numout,*) '   Namelist namthd:'
585         WRITE(numout,*) '      activate ice thick change from top/bot (T) or not (F)   ln_icedH  = ', ln_icedH
586         WRITE(numout,*) '      activate lateral melting (T) or not (F)                 ln_icedA  = ', ln_icedA
587         WRITE(numout,*) '      activate ice growth in open-water (T) or not (F)        ln_icedO  = ', ln_icedO
588         WRITE(numout,*) '      activate gravity drainage and flushing (T) or not (F)   ln_icedS  = ', ln_icedS
589     ENDIF
590      !
591                       CALL ice_thd_zdf_init   ! set ice heat diffusion parameters
592      IF( ln_icedA )   CALL ice_thd_da_init    ! set ice lateral melting parameters
593      IF( ln_icedO )   CALL ice_thd_do_init    ! set ice growth in open water parameters
594                       CALL ice_thd_sal_init   ! set ice salinity parameters
595                       CALL ice_thd_pnd_init   ! set melt ponds parameters
596      !
597   END SUBROUTINE ice_thd_init
598
599#else
600   !!----------------------------------------------------------------------
601   !!   Default option         Dummy module          NO  SI3 sea-ice model
602   !!----------------------------------------------------------------------
603#endif
604
605   !!======================================================================
606END MODULE icethd
Note: See TracBrowser for help on using the repository browser.