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

source: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icectl.F90 @ 8517

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

changes in style - part6 - one more round

File size: 34.6 KB
Line 
1MODULE icectl
2   !!======================================================================
3   !!                     ***  MODULE  icectl  ***
4   !!   LIM-3 : control and printing
5   !!======================================================================
6   !! History :  3.5  !  2015-01  (M. Vancoppenolle) Original code
7   !!            3.7  !  2016-10  (C. Rousset)       Add routine ice_prt3D
8   !!----------------------------------------------------------------------
9#if defined key_lim3
10   !!----------------------------------------------------------------------
11   !!   'key_lim3'                                       LIM3 sea-ice model
12   !!----------------------------------------------------------------------
13   !!    ice_ctl   : control prints in case of crash
14   !!    ice_prt   : ice control print at a given grid point
15   !!    ice_prt3D : control prints of ice arrays
16   !!----------------------------------------------------------------------
17   USE oce            ! ocean dynamics and tracers
18   USE dom_oce        ! ocean space and time domain
19   USE ice            ! LIM-3: ice variables
20   USE ice1D          ! LIM-3: thermodynamical variables
21   USE sbc_oce        ! Surface boundary condition: ocean fields
22   USE sbc_ice        ! Surface boundary condition: ice   fields
23   USE phycst         ! Define parameters for the routines
24   !
25   USE lib_mpp        ! MPP library
26   USE timing         ! Timing
27   USE in_out_manager ! I/O manager
28   USE prtctl         ! Print control
29   USE lib_fortran    !
30
31   IMPLICIT NONE
32   PRIVATE
33
34   PUBLIC   ice_cons_hsm
35   PUBLIC   ice_cons_final
36   PUBLIC   ice_ctl
37   PUBLIC   ice_prt
38   PUBLIC   ice_prt3D
39
40   !! * Substitutions
41#  include "vectopt_loop_substitute.h90"
42   !!----------------------------------------------------------------------
43   !! NEMO/ICE 4.0 , NEMO Consortium (2017)
44   !! $Id: icectl.F90 5043 2015-01-28 16:44:18Z clem $
45   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
46   !!----------------------------------------------------------------------
47CONTAINS
48
49   SUBROUTINE ice_cons_hsm( icount, cd_routine, pdiag_v, pdiag_s, pdiag_t, pdiag_fv, pdiag_fs, pdiag_ft )
50      !!----------------------------------------------------------------------
51      !!                       ***  ROUTINE ice_cons_hsm ***
52      !!
53      !! ** Purpose : Test the conservation of heat, salt and mass for each ice routine
54      !!                     + test if ice concentration and volume are > 0
55      !!
56      !! ** Method  : This is an online diagnostics which can be activated with ln_icediachk=true
57      !!              It prints in ocean.output if there is a violation of conservation at each time-step
58      !!              The thresholds (zv_sill, zs_sill, zt_sill) which determine violations are set to
59      !!              a minimum of 1 mm of ice (over the ice area) that is lost/gained spuriously during 100 years.
60      !!              For salt and heat thresholds, ice is considered to have a salinity of 10
61      !!              and a heat content of 3e5 J/kg (=latent heat of fusion)
62      !!----------------------------------------------------------------------
63      INTEGER         , INTENT(in)    ::   icount        ! called at: =0 the begining of the routine, =1  the end
64      CHARACTER(len=*), INTENT(in)    ::   cd_routine    ! name of the routine
65      REAL(wp)        , INTENT(inout) ::   pdiag_v, pdiag_s, pdiag_t, pdiag_fv, pdiag_fs, pdiag_ft
66      !!
67      REAL(wp) ::   zv, zs, zt, zfs, zfv, zft
68      REAL(wp) ::   zvmin, zamin, zamax 
69      REAL(wp) ::   zvtrp, zetrp
70      REAL(wp) ::   zarea, zv_sill, zs_sill, zt_sill
71      REAL(wp), PARAMETER ::   zconv = 1.e-9 ! convert W to GW and kg to Mt
72      !!----------------------------------------------------------------------
73      !
74      IF( icount == 0 ) THEN
75         !                          ! water flux
76         pdiag_fv = glob_sum( -( wfx_bog(:,:) + wfx_bom(:,:)     + wfx_sum(:,:)     + wfx_sni(:,:)     +                     &
77            &                    wfx_opw(:,:) + wfx_res(:,:)     + wfx_dyn(:,:)     + wfx_lam(:,:)     + wfx_ice_sub(:,:) +  &
78            &                    wfx_snw_sni(:,:) + wfx_snw_sum(:,:) + wfx_snw_dyn(:,:) + wfx_snw_sub(:,:) + wfx_spr(:,:)    &
79            &                  ) * e1e2t(:,:) ) * zconv
80         !
81         !                          ! salt flux
82         pdiag_fs = glob_sum(  ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) +  &
83            &                    sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) + sfx_sub(:,:) + sfx_lam(:,:)    &
84            &                  ) *  e1e2t(:,:) ) * zconv 
85         !
86         !                          ! heat flux
87         pdiag_ft = glob_sum(  ( hfx_sum(:,:) + hfx_bom(:,:) + hfx_bog(:,:) + hfx_dif(:,:) + hfx_opw(:,:) + hfx_snw(:,:)  & 
88            &                  - hfx_thd(:,:) - hfx_dyn(:,:) - hfx_res(:,:) - hfx_sub(:,:) - hfx_spr(:,:)   &
89            &                  ) *  e1e2t(:,:) ) * zconv
90
91         pdiag_v = glob_sum( SUM( v_i * rhoic + v_s * rhosn, dim=3 ) * e1e2t * zconv )
92
93         pdiag_s = glob_sum( SUM( smv_i * rhoic            , dim=3 ) * e1e2t * zconv )
94
95         pdiag_t = glob_sum( (  SUM( SUM( e_i(:,:,1:nlay_i,:), dim=4 ), dim=3 )     &
96            &                 + SUM( SUM( e_s(:,:,1:nlay_s,:), dim=4 ), dim=3 )   ) * e1e2t ) * zconv
97
98      ELSEIF( icount == 1 ) THEN
99
100         ! water flux
101         zfv  = glob_sum( -( wfx_bog(:,:) + wfx_bom(:,:)     + wfx_sum(:,:)     + wfx_sni(:,:)     +                     &
102            &                wfx_opw(:,:) + wfx_res(:,:)     + wfx_dyn(:,:)     + wfx_lam(:,:)     + wfx_ice_sub(:,:) +  &
103            &                wfx_snw_sni(:,:) + wfx_snw_sum(:,:) + wfx_snw_dyn(:,:) + wfx_snw_sub(:,:) + wfx_spr(:,:)        &
104            &              ) * e1e2t(:,:) ) * zconv - pdiag_fv
105
106         ! salt flux
107         zfs  = glob_sum(  ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) +  &
108            &                sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) + sfx_sub(:,:) + sfx_lam(:,:)    & 
109            &              ) * e1e2t(:,:) ) * zconv - pdiag_fs
110
111         ! heat flux
112         zft  = glob_sum(  ( hfx_sum(:,:) + hfx_bom(:,:) + hfx_bog(:,:) + hfx_dif(:,:) + hfx_opw(:,:) + hfx_snw(:,:)  & 
113            &              - hfx_thd(:,:) - hfx_dyn(:,:) - hfx_res(:,:) - hfx_sub(:,:) - hfx_spr(:,:)   &
114            &              ) * e1e2t(:,:) ) * zconv - pdiag_ft
115 
116         ! outputs
117         zv = ( ( glob_sum( SUM( v_i * rhoic + v_s * rhosn, dim=3 ) * e1e2t  ) * zconv  &
118            &     - pdiag_v ) * r1_rdtice - zfv ) * rday
119
120         zs = ( ( glob_sum( SUM( smv_i * rhoic            , dim=3 ) * e1e2t ) * zconv  &
121            &     - pdiag_s ) * r1_rdtice + zfs ) * rday
122
123         zt = ( glob_sum( (  SUM( SUM( e_i(:,:,1:nlay_i,:), dim=4 ), dim=3 )   &
124            &                + SUM( SUM( e_s(:,:,1:nlay_s,:), dim=4 ), dim=3 ) ) * e1e2t ) * zconv   &
125            &   - pdiag_t ) * r1_rdtice + zft
126
127         ! zvtrp and zetrp must be close to 0 if the advection scheme is conservative
128         zvtrp = glob_sum( ( diag_trp_vi * rhoic + diag_trp_vs * rhosn ) * e1e2t  ) * zconv * rday 
129         zetrp = glob_sum( ( diag_trp_ei         + diag_trp_es         ) * e1e2t  ) * zconv
130
131         zvmin = glob_min( v_i )
132         zamax = glob_max( SUM( a_i, dim=3 ) )
133         zamin = glob_min( a_i )
134
135         ! set threshold values and calculate the ice area (+epsi10 to set a threshold > 0 when there is no ice)
136         zarea   = glob_sum( SUM( a_i + epsi10, dim=3 ) * e1e2t ) * zconv ! in 1.e9 m2
137         zv_sill = zarea * 2.5e-5
138         zs_sill = zarea * 25.e-5
139         zt_sill = zarea * 10.e-5
140
141         IF(lwp) THEN
142            IF ( ABS( zv   ) > zv_sill )   WRITE(numout,*) 'violation volume [Mt/day]     (',cd_routine,') = ',zv
143            IF ( ABS( zs   ) > zs_sill )   WRITE(numout,*) 'violation saline [psu*Mt/day] (',cd_routine,') = ',zs
144            IF ( ABS( zt   ) > zt_sill )   WRITE(numout,*) 'violation enthalpy [GW]       (',cd_routine,') = ',zt
145            IF ( ABS(zvtrp ) > zv_sill .AND. cd_routine == 'iceadv' ) THEN
146                                           WRITE(numout,*) 'violation vtrp [Mt/day]       (',cd_routine,') = ',zvtrp
147                                           WRITE(numout,*) 'violation etrp [GW]           (',cd_routine,') = ',zetrp
148            ENDIF
149            IF ( zvmin < -epsi10 )         WRITE(numout,*) 'violation v_i<0  [m]          (',cd_routine,') = ',zvmin
150            IF ( zamax > MAX(rn_amax_n,rn_amax_s) + epsi10 .AND. cd_routine /= 'iceadv' .AND. cd_routine /= 'icerdgrft' )  &
151               &                           WRITE(numout,*) 'violation a_i>amax            (',cd_routine,') = ',zamax
152            IF ( zamin < -epsi10 )         WRITE(numout,*) 'violation a_i<0               (',cd_routine,') = ',zamin
153         ENDIF
154         !
155      ENDIF
156
157   END SUBROUTINE ice_cons_hsm
158
159
160   SUBROUTINE ice_cons_final( cd_routine )
161      !!----------------------------------------------------------------------
162      !!                     ***  ROUTINE ice_cons_final ***
163      !!
164      !! ** Purpose : Test the conservation of heat, salt and mass at the end of each ice time-step
165      !!
166      !! ** Method  : This is an online diagnostics which can be activated with ln_icediachk=true
167      !!              It prints in ocean.output if there is a violation of conservation at each time-step
168      !!              The thresholds (zv_sill, zs_sill, zt_sill) which determine the violation are set to
169      !!              a minimum of 1 mm of ice (over the ice area) that is lost/gained spuriously during 100 years.
170      !!              For salt and heat thresholds, ice is considered to have a salinity of 10
171      !!              and a heat content of 3e5 J/kg (=latent heat of fusion)
172      !!----------------------------------------------------------------------
173      CHARACTER(len=*), INTENT(in)    :: cd_routine    ! name of the routine
174      REAL(wp)                        :: zhfx, zsfx, zvfx
175      REAL(wp)                        :: zarea, zv_sill, zs_sill, zt_sill
176      REAL(wp), PARAMETER             :: zconv = 1.e-9 ! convert W to GW and kg to Mt
177      !!----------------------------------------------------------------------
178
179      ! water flux
180      zvfx  = glob_sum( ( wfx_ice + wfx_snw + wfx_spr + wfx_sub + diag_vice + diag_vsnw ) * e1e2t ) * zconv * rday
181
182      ! salt flux
183      zsfx  = glob_sum( ( sfx + diag_smvi ) * e1e2t ) * zconv * rday
184
185      ! heat flux
186      zhfx  = glob_sum( ( hfx_in - hfx_out - diag_heat - diag_trp_ei - diag_trp_es   &
187      !  &              - SUM( qevap_ice * a_i_b, dim=3 )                           & !!clem: I think this line must be commented (but need check)
188         &              ) * e1e2t ) * zconv
189
190      ! set threshold values and calculate the ice area (+epsi10 to set a threshold > 0 when there is no ice)
191      zarea   = glob_sum( SUM( a_i + epsi10, dim=3 ) * e1e2t ) * zconv ! in 1.e9 m2
192      zv_sill = zarea * 2.5e-5
193      zs_sill = zarea * 25.e-5
194      zt_sill = zarea * 10.e-5
195
196      IF(lwp) THEN
197         IF( ABS( zvfx ) > zv_sill )   WRITE(numout,*) 'violation vfx  [Mt/day]       (',cd_routine,') = ',zvfx
198         IF( ABS( zsfx ) > zs_sill )   WRITE(numout,*) 'violation sfx  [psu*Mt/day]   (',cd_routine,') = ',zsfx
199         IF( ABS( zhfx ) > zt_sill )   WRITE(numout,*) 'violation hfx  [GW]           (',cd_routine,') = ',zhfx
200      ENDIF
201      !
202   END SUBROUTINE ice_cons_final
203
204   
205   SUBROUTINE ice_ctl( kt )
206      !!-----------------------------------------------------------------------
207      !!                   ***  ROUTINE ice_ctl ***
208      !!                 
209      !! ** Purpose :   Alerts in case of model crash
210      !!-------------------------------------------------------------------
211      INTEGER, INTENT(in) ::   kt      ! ocean time step
212      INTEGER  ::   ji, jj, jk,  jl   ! dummy loop indices
213      INTEGER  ::   inb_altests       ! number of alert tests (max 20)
214      INTEGER  ::   ialert_id         ! number of the current alert
215      REAL(wp) ::   ztmelts           ! ice layer melting point
216      CHARACTER (len=30), DIMENSION(20) ::   cl_alname   ! name of alert
217      INTEGER           , DIMENSION(20) ::   inb_alp     ! number of alerts positive
218      !!-------------------------------------------------------------------
219
220      inb_altests = 10
221      inb_alp(:)  =  0
222
223      ! Alert if incompatible volume and concentration
224      ialert_id = 2 ! reference number of this alert
225      cl_alname(ialert_id) = ' Incompat vol and con         '    ! name of the alert
226
227      DO jl = 1, jpl
228         DO jj = 1, jpj
229            DO ji = 1, jpi
230               IF(  v_i(ji,jj,jl) /= 0._wp   .AND.   a_i(ji,jj,jl) == 0._wp   ) THEN
231                  !WRITE(numout,*) ' ALERTE 2 :   Incompatible volume and concentration '
232                  !WRITE(numout,*) ' at_i     ', at_i(ji,jj)
233                  !WRITE(numout,*) ' Point - category', ji, jj, jl
234                  !WRITE(numout,*) ' a_i *** a_i_b   ', a_i      (ji,jj,jl), a_i_b  (ji,jj,jl)
235                  !WRITE(numout,*) ' v_i *** v_i_b   ', v_i      (ji,jj,jl), v_i_b  (ji,jj,jl)
236                  inb_alp(ialert_id) = inb_alp(ialert_id) + 1
237               ENDIF
238            END DO
239         END DO
240      END DO
241
242      ! Alerte if very thick ice
243      ialert_id = 3 ! reference number of this alert
244      cl_alname(ialert_id) = ' Very thick ice               ' ! name of the alert
245      jl = jpl 
246      DO jj = 1, jpj
247         DO ji = 1, jpi
248            IF(   ht_i(ji,jj,jl)  >  50._wp   ) THEN
249               !CALL ice_prt( kt, ji, jj, 2, ' ALERTE 3 :   Very thick ice ' )
250               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
251            ENDIF
252         END DO
253      END DO
254
255      ! Alert if very fast ice
256      ialert_id = 4 ! reference number of this alert
257      cl_alname(ialert_id) = ' Very fast ice               ' ! name of the alert
258      DO jj = 1, jpj
259         DO ji = 1, jpi
260            IF(   MAX( ABS( u_ice(ji,jj) ), ABS( v_ice(ji,jj) ) ) > 1.5  .AND.  &
261               &  at_i(ji,jj) > 0._wp   ) THEN
262               !CALL ice_prt( kt, ji, jj, 1, ' ALERTE 4 :   Very fast ice ' )
263               !WRITE(numout,*) ' ice strength             : ', strength(ji,jj)
264               !WRITE(numout,*) ' oceanic stress utau      : ', utau(ji,jj)
265               !WRITE(numout,*) ' oceanic stress vtau      : ', vtau(ji,jj)
266               !WRITE(numout,*) ' sea-ice stress utau_ice  : ', utau_ice(ji,jj)
267               !WRITE(numout,*) ' sea-ice stress vtau_ice  : ', vtau_ice(ji,jj)
268               !WRITE(numout,*) ' sst                      : ', sst_m(ji,jj)
269               !WRITE(numout,*) ' sss                      : ', sss_m(ji,jj)
270               !WRITE(numout,*)
271               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
272            ENDIF
273         END DO
274      END DO
275
276      ! Alert if there is ice on continents
277      ialert_id = 6 ! reference number of this alert
278      cl_alname(ialert_id) = ' Ice on continents           ' ! name of the alert
279      DO jj = 1, jpj
280         DO ji = 1, jpi
281            IF(   tmask(ji,jj,1) <= 0._wp   .AND.   at_i(ji,jj) > 0._wp   ) THEN 
282               !CALL ice_prt( kt, ji, jj, 1, ' ALERTE 6 :   Ice on continents ' )
283               !WRITE(numout,*) ' masks s, u, v        : ', tmask(ji,jj,1), umask(ji,jj,1), vmask(ji,jj,1)
284               !WRITE(numout,*) ' sst                  : ', sst_m(ji,jj)
285               !WRITE(numout,*) ' sss                  : ', sss_m(ji,jj)
286               !WRITE(numout,*) ' at_i(ji,jj)          : ', at_i(ji,jj)
287               !WRITE(numout,*) ' v_ice(ji,jj)         : ', v_ice(ji,jj)
288               !WRITE(numout,*) ' v_ice(ji,jj-1)       : ', v_ice(ji,jj-1)
289               !WRITE(numout,*) ' u_ice(ji-1,jj)       : ', u_ice(ji-1,jj)
290               !WRITE(numout,*) ' u_ice(ji,jj)         : ', v_ice(ji,jj)
291               !
292               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
293            ENDIF
294         END DO
295      END DO
296
297!
298!     ! Alert if very fresh ice
299      ialert_id = 7 ! reference number of this alert
300      cl_alname(ialert_id) = ' Very fresh ice               ' ! name of the alert
301      DO jl = 1, jpl
302         DO jj = 1, jpj
303            DO ji = 1, jpi
304               IF( sm_i(ji,jj,jl) < 0.1 .AND. a_i(ji,jj,jl) > 0._wp ) THEN
305!                 CALL ice_prt(kt,ji,jj,1, ' ALERTE 7 :   Very fresh ice ' )
306!                 WRITE(numout,*) ' sst                  : ', sst_m(ji,jj)
307!                 WRITE(numout,*) ' sss                  : ', sss_m(ji,jj)
308!                 WRITE(numout,*)
309                  inb_alp(ialert_id) = inb_alp(ialert_id) + 1
310               ENDIF
311            END DO
312         END DO
313      END DO
314!
315
316!     ! Alert if too old ice
317      ialert_id = 9 ! reference number of this alert
318      cl_alname(ialert_id) = ' Very old   ice               ' ! name of the alert
319      DO jl = 1, jpl
320         DO jj = 1, jpj
321            DO ji = 1, jpi
322               IF ( ( ( ABS( o_i(ji,jj,jl) ) > rdt_ice ) .OR. &
323                      ( ABS( o_i(ji,jj,jl) ) < 0._wp) ) .AND. &
324                             ( a_i(ji,jj,jl) > 0._wp ) ) THEN
325                  !CALL ice_prt( kt, ji, jj, 1, ' ALERTE 9 :   Wrong ice age ')
326                  inb_alp(ialert_id) = inb_alp(ialert_id) + 1
327               ENDIF
328            END DO
329         END DO
330      END DO
331 
332      ! Alert on salt flux
333      ialert_id = 5 ! reference number of this alert
334      cl_alname(ialert_id) = ' High salt flux               ' ! name of the alert
335      DO jj = 1, jpj
336         DO ji = 1, jpi
337            IF( ABS( sfx (ji,jj) ) > 1.0e-2 ) THEN  ! = 1 psu/day for 1m ocean depth
338               !CALL ice_prt( kt, ji, jj, 3, ' ALERTE 5 :   High salt flux ' )
339               !DO jl = 1, jpl
340                  !WRITE(numout,*) ' Category no: ', jl
341                  !WRITE(numout,*) ' a_i        : ', a_i      (ji,jj,jl) , ' a_i_b      : ', a_i_b  (ji,jj,jl)   
342                  !WRITE(numout,*) ' v_i        : ', v_i      (ji,jj,jl) , ' v_i_b      : ', v_i_b  (ji,jj,jl)   
343                  !WRITE(numout,*) ' '
344               !END DO
345               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
346            ENDIF
347         END DO
348      END DO
349
350      ! Alert if qns very big
351      ialert_id = 8 ! reference number of this alert
352      cl_alname(ialert_id) = ' fnsolar very big             ' ! name of the alert
353      DO jj = 1, jpj
354         DO ji = 1, jpi
355            IF( ABS( qns(ji,jj) ) > 1500._wp .AND. at_i(ji,jj) > 0._wp ) THEN
356               !
357               !WRITE(numout,*) ' ALERTE 8 :   Very high non-solar heat flux'
358               !WRITE(numout,*) ' ji, jj    : ', ji, jj
359               !WRITE(numout,*) ' qns       : ', qns(ji,jj)
360               !WRITE(numout,*) ' sst       : ', sst_m(ji,jj)
361               !WRITE(numout,*) ' sss       : ', sss_m(ji,jj)
362               !
363               !CALL ice_prt( kt, ji, jj, 2, '   ')
364               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
365               !
366            ENDIF
367         END DO
368      END DO
369      !+++++
370 
371      ! Alert if very warm ice
372      ialert_id = 10 ! reference number of this alert
373      cl_alname(ialert_id) = ' Very warm ice                ' ! name of the alert
374      inb_alp(ialert_id) = 0
375      DO jl = 1, jpl
376         DO jk = 1, nlay_i
377            DO jj = 1, jpj
378               DO ji = 1, jpi
379                  ztmelts    =  -tmut * s_i(ji,jj,jk,jl) + rt0
380                  IF( t_i(ji,jj,jk,jl) >= ztmelts  .AND.  v_i(ji,jj,jl) > 1.e-10   &
381                     &                             .AND.  a_i(ji,jj,jl) > 0._wp   ) THEN
382                     !WRITE(numout,*) ' ALERTE 10 :   Very warm ice'
383                     !WRITE(numout,*) ' ji, jj, jk, jl : ', ji, jj, jk, jl
384                     !WRITE(numout,*) ' t_i : ', t_i(ji,jj,jk,jl)
385                     !WRITE(numout,*) ' e_i : ', e_i(ji,jj,jk,jl)
386                     !WRITE(numout,*) ' s_i : ', s_i(ji,jj,jk,jl)
387                     !WRITE(numout,*) ' ztmelts : ', ztmelts
388                     inb_alp(ialert_id) = inb_alp(ialert_id) + 1
389                  ENDIF
390               END DO
391            END DO
392         END DO
393      END DO
394
395      ! sum of the alerts on all processors
396      IF( lk_mpp ) THEN
397         DO ialert_id = 1, inb_altests
398            CALL mpp_sum(inb_alp(ialert_id))
399         END DO
400      ENDIF
401
402      ! print alerts
403      IF( lwp ) THEN
404         ialert_id = 1                                 ! reference number of this alert
405         cl_alname(ialert_id) = ' NO alerte 1      '   ! name of the alert
406         WRITE(numout,*) ' time step ',kt
407         WRITE(numout,*) ' All alerts at the end of ice model '
408         DO ialert_id = 1, inb_altests
409            WRITE(numout,*) ialert_id, cl_alname(ialert_id)//' : ', inb_alp(ialert_id), ' times ! '
410         END DO
411      ENDIF
412     !
413   END SUBROUTINE ice_ctl
414 
415   
416   SUBROUTINE ice_prt( kt, ki, kj, kn, cd1 )
417      !!-----------------------------------------------------------------------
418      !!                   ***  ROUTINE ice_prt ***
419      !!                 
420      !! ** Purpose :   Writes global ice state on the (i,j) point
421      !!                in ocean.ouput
422      !!                3 possibilities exist
423      !!                n = 1/-1 -> simple ice state (plus Mechanical Check if -1)
424      !!                n = 2    -> exhaustive state
425      !!                n = 3    -> ice/ocean salt fluxes
426      !!
427      !! ** input   :   point coordinates (i,j)
428      !!                n : number of the option
429      !!-------------------------------------------------------------------
430      INTEGER         , INTENT(in) ::   kt            ! ocean time step
431      INTEGER         , INTENT(in) ::   ki, kj, kn    ! ocean gridpoint indices
432      CHARACTER(len=*), INTENT(in) ::   cd1           !
433      !!
434      INTEGER :: jl, ji, jj
435      !!-------------------------------------------------------------------
436
437      DO ji = mi0(ki), mi1(ki)
438         DO jj = mj0(kj), mj1(kj)
439
440            WRITE(numout,*) ' time step ',kt,' ',cd1             ! print title
441
442            !----------------
443            !  Simple state
444            !----------------
445           
446            IF ( kn == 1 .OR. kn == -1 ) THEN
447               WRITE(numout,*) ' ice_prt - Point : ',ji,jj
448               WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
449               WRITE(numout,*) ' Simple state '
450               WRITE(numout,*) ' masks s,u,v   : ', tmask(ji,jj,1), umask(ji,jj,1), vmask(ji,jj,1)
451               WRITE(numout,*) ' lat - long    : ', gphit(ji,jj), glamt(ji,jj)
452               WRITE(numout,*) ' - Ice drift   '
453               WRITE(numout,*) '   ~~~~~~~~~~~ '
454               WRITE(numout,*) ' u_ice(i-1,j)  : ', u_ice(ji-1,jj)
455               WRITE(numout,*) ' u_ice(i  ,j)  : ', u_ice(ji,jj)
456               WRITE(numout,*) ' v_ice(i  ,j-1): ', v_ice(ji,jj-1)
457               WRITE(numout,*) ' v_ice(i  ,j)  : ', v_ice(ji,jj)
458               WRITE(numout,*) ' strength      : ', strength(ji,jj)
459               WRITE(numout,*)
460               WRITE(numout,*) ' - Cell values '
461               WRITE(numout,*) '   ~~~~~~~~~~~ '
462               WRITE(numout,*) ' cell area     : ', e1e2t(ji,jj)
463               WRITE(numout,*) ' at_i          : ', at_i(ji,jj)       
464               WRITE(numout,*) ' vt_i          : ', vt_i(ji,jj)       
465               WRITE(numout,*) ' vt_s          : ', vt_s(ji,jj)       
466               DO jl = 1, jpl
467                  WRITE(numout,*) ' - Category (', jl,')'
468                  WRITE(numout,*) ' a_i           : ', a_i(ji,jj,jl)
469                  WRITE(numout,*) ' ht_i          : ', ht_i(ji,jj,jl)
470                  WRITE(numout,*) ' ht_s          : ', ht_s(ji,jj,jl)
471                  WRITE(numout,*) ' v_i           : ', v_i(ji,jj,jl)
472                  WRITE(numout,*) ' v_s           : ', v_s(ji,jj,jl)
473                  WRITE(numout,*) ' e_s           : ', e_s(ji,jj,1,jl)
474                  WRITE(numout,*) ' e_i           : ', e_i(ji,jj,1:nlay_i,jl)
475                  WRITE(numout,*) ' t_su          : ', t_su(ji,jj,jl)
476                  WRITE(numout,*) ' t_snow        : ', t_s(ji,jj,1,jl)
477                  WRITE(numout,*) ' t_i           : ', t_i(ji,jj,1:nlay_i,jl)
478                  WRITE(numout,*) ' sm_i          : ', sm_i(ji,jj,jl)
479                  WRITE(numout,*) ' smv_i         : ', smv_i(ji,jj,jl)
480                  WRITE(numout,*)
481               END DO
482            ENDIF
483            IF( kn == -1 ) THEN
484               WRITE(numout,*) ' Mechanical Check ************** '
485               WRITE(numout,*) ' Check what means ice divergence '
486               WRITE(numout,*) ' Total ice concentration ', at_i (ji,jj)
487               WRITE(numout,*) ' Total lead fraction     ', ato_i(ji,jj)
488               WRITE(numout,*) ' Sum of both             ', ato_i(ji,jj) + at_i(ji,jj)
489               WRITE(numout,*) ' Sum of both minus 1     ', ato_i(ji,jj) + at_i(ji,jj) - 1.00
490            ENDIF
491           
492
493            !--------------------
494            !  Exhaustive state
495            !--------------------
496           
497            IF ( kn .EQ. 2 ) THEN
498               WRITE(numout,*) ' ice_prt - Point : ',ji,jj
499               WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
500               WRITE(numout,*) ' Exhaustive state '
501               WRITE(numout,*) ' lat - long ', gphit(ji,jj), glamt(ji,jj)
502               WRITE(numout,*) 
503               WRITE(numout,*) ' - Cell values '
504               WRITE(numout,*) '   ~~~~~~~~~~~ '
505               WRITE(numout,*) ' cell area     : ', e1e2t(ji,jj)
506               WRITE(numout,*) ' at_i          : ', at_i(ji,jj)       
507               WRITE(numout,*) ' vt_i          : ', vt_i(ji,jj)       
508               WRITE(numout,*) ' vt_s          : ', vt_s(ji,jj)       
509               WRITE(numout,*) ' u_ice(i-1,j)  : ', u_ice(ji-1,jj)
510               WRITE(numout,*) ' u_ice(i  ,j)  : ', u_ice(ji,jj)
511               WRITE(numout,*) ' v_ice(i  ,j-1): ', v_ice(ji,jj-1)
512               WRITE(numout,*) ' v_ice(i  ,j)  : ', v_ice(ji,jj)
513               WRITE(numout,*) ' strength      : ', strength(ji,jj)
514               WRITE(numout,*) ' u_ice_b       : ', u_ice_b(ji,jj)    , ' v_ice_b       : ', v_ice_b(ji,jj) 
515               WRITE(numout,*)
516               
517               DO jl = 1, jpl
518                  WRITE(numout,*) ' - Category (',jl,')'
519                  WRITE(numout,*) '   ~~~~~~~~         ' 
520                  WRITE(numout,*) ' ht_i       : ', ht_i(ji,jj,jl)             , ' ht_s       : ', ht_s(ji,jj,jl)
521                  WRITE(numout,*) ' t_i        : ', t_i(ji,jj,1:nlay_i,jl)
522                  WRITE(numout,*) ' t_su       : ', t_su(ji,jj,jl)             , ' t_s        : ', t_s(ji,jj,1,jl)
523                  WRITE(numout,*) ' sm_i       : ', sm_i(ji,jj,jl)             , ' o_i        : ', o_i(ji,jj,jl)
524                  WRITE(numout,*) ' a_i        : ', a_i(ji,jj,jl)              , ' a_i_b      : ', a_i_b(ji,jj,jl)   
525                  WRITE(numout,*) ' v_i        : ', v_i(ji,jj,jl)              , ' v_i_b      : ', v_i_b(ji,jj,jl)   
526                  WRITE(numout,*) ' v_s        : ', v_s(ji,jj,jl)              , ' v_s_b      : ', v_s_b(ji,jj,jl) 
527                  WRITE(numout,*) ' e_i1       : ', e_i(ji,jj,1,jl)            , ' ei1        : ', e_i_b(ji,jj,1,jl) 
528                  WRITE(numout,*) ' e_i2       : ', e_i(ji,jj,2,jl)            , ' ei2_b      : ', e_i_b(ji,jj,2,jl) 
529                  WRITE(numout,*) ' e_snow     : ', e_s(ji,jj,1,jl)            , ' e_snow_b   : ', e_s_b(ji,jj,1,jl) 
530                  WRITE(numout,*) ' smv_i      : ', smv_i(ji,jj,jl)            , ' smv_i_b    : ', smv_i_b(ji,jj,jl)   
531                  WRITE(numout,*) ' oa_i       : ', oa_i(ji,jj,jl)             , ' oa_i_b     : ', oa_i_b(ji,jj,jl)
532               END DO !jl
533               
534               WRITE(numout,*)
535               WRITE(numout,*) ' - Heat / FW fluxes '
536               WRITE(numout,*) '   ~~~~~~~~~~~~~~~~ '
537               WRITE(numout,*) ' - Heat fluxes in and out the ice ***'
538               WRITE(numout,*) ' qsr_ini       : ', (1._wp-at_i_b(ji,jj)) * qsr(ji,jj) + SUM( a_i_b(ji,jj,:) * qsr_ice(ji,jj,:) )
539               WRITE(numout,*) ' qns_ini       : ', (1._wp-at_i_b(ji,jj)) * qns(ji,jj) + SUM( a_i_b(ji,jj,:) * qns_ice(ji,jj,:) )
540               WRITE(numout,*)
541               WRITE(numout,*) 
542               WRITE(numout,*) ' sst        : ', sst_m(ji,jj) 
543               WRITE(numout,*) ' sss        : ', sss_m(ji,jj) 
544               WRITE(numout,*) 
545               WRITE(numout,*) ' - Stresses '
546               WRITE(numout,*) '   ~~~~~~~~ '
547               WRITE(numout,*) ' utau_ice   : ', utau_ice(ji,jj) 
548               WRITE(numout,*) ' vtau_ice   : ', vtau_ice(ji,jj)
549               WRITE(numout,*) ' utau       : ', utau    (ji,jj) 
550               WRITE(numout,*) ' vtau       : ', vtau    (ji,jj)
551            ENDIF
552           
553            !---------------------
554            ! Salt / heat fluxes
555            !---------------------
556           
557            IF ( kn .EQ. 3 ) THEN
558               WRITE(numout,*) ' ice_prt - Point : ',ji,jj
559               WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
560               WRITE(numout,*) ' - Salt / Heat Fluxes '
561               WRITE(numout,*) '   ~~~~~~~~~~~~~~~~ '
562               WRITE(numout,*) ' lat - long ', gphit(ji,jj), glamt(ji,jj)
563               WRITE(numout,*)
564               WRITE(numout,*) ' - Heat fluxes at bottom interface ***'
565               WRITE(numout,*) ' qsr       : ', qsr(ji,jj)
566               WRITE(numout,*) ' qns       : ', qns(ji,jj)
567               WRITE(numout,*)
568               WRITE(numout,*) ' hfx_mass     : ', hfx_thd(ji,jj) + hfx_dyn(ji,jj) + hfx_snw(ji,jj) + hfx_res(ji,jj)
569               WRITE(numout,*) ' hfx_in       : ', hfx_in(ji,jj)
570               WRITE(numout,*) ' hfx_out      : ', hfx_out(ji,jj)
571               WRITE(numout,*) ' dhc          : ', diag_heat(ji,jj)             
572               WRITE(numout,*)
573               WRITE(numout,*) ' hfx_dyn      : ', hfx_dyn(ji,jj)
574               WRITE(numout,*) ' hfx_thd      : ', hfx_thd(ji,jj)
575               WRITE(numout,*) ' hfx_res      : ', hfx_res(ji,jj)
576               WRITE(numout,*) ' fhtur        : ', fhtur(ji,jj) 
577               WRITE(numout,*) ' qlead        : ', qlead(ji,jj) * r1_rdtice
578               WRITE(numout,*)
579               WRITE(numout,*) ' - Salt fluxes at bottom interface ***'
580               WRITE(numout,*) ' emp       : ', emp    (ji,jj)
581               WRITE(numout,*) ' sfx       : ', sfx    (ji,jj)
582               WRITE(numout,*) ' sfx_res   : ', sfx_res(ji,jj)
583               WRITE(numout,*) ' sfx_bri   : ', sfx_bri(ji,jj)
584               WRITE(numout,*) ' sfx_dyn   : ', sfx_dyn(ji,jj)
585               WRITE(numout,*)
586               WRITE(numout,*) ' - Momentum fluxes '
587               WRITE(numout,*) ' utau      : ', utau(ji,jj) 
588               WRITE(numout,*) ' vtau      : ', vtau(ji,jj)
589            ENDIF
590            WRITE(numout,*) ' '
591            !
592         END DO
593      END DO
594      !
595   END SUBROUTINE ice_prt
596
597   SUBROUTINE ice_prt3D( cd_routine )
598      !!---------------------------------------------------------------------------------------------------------
599      !!                                   ***  ROUTINE ice_prt3D ***
600      !!
601      !! ** Purpose : CTL prints of ice arrays in case ln_ctl is activated
602      !!
603      !!---------------------------------------------------------------------------------------------------------
604      CHARACTER(len=*), INTENT(in)  :: cd_routine    ! name of the routine
605      INTEGER                       :: jk, jl        ! dummy loop indices
606     
607      CALL prt_ctl_info(' ========== ')
608      CALL prt_ctl_info( cd_routine )
609      CALL prt_ctl_info(' ========== ')
610      CALL prt_ctl_info(' - Cell values : ')
611      CALL prt_ctl_info('   ~~~~~~~~~~~~~ ')
612      CALL prt_ctl(tab2d_1=e1e2t      , clinfo1=' cell area   :')
613      CALL prt_ctl(tab2d_1=at_i       , clinfo1=' at_i        :')
614      CALL prt_ctl(tab2d_1=ato_i      , clinfo1=' ato_i       :')
615      CALL prt_ctl(tab2d_1=vt_i       , clinfo1=' vt_i        :')
616      CALL prt_ctl(tab2d_1=vt_s       , clinfo1=' vt_s        :')
617      CALL prt_ctl(tab2d_1=divu_i     , clinfo1=' divu_i      :')
618      CALL prt_ctl(tab2d_1=delta_i    , clinfo1=' delta_i     :')
619      CALL prt_ctl(tab2d_1=stress1_i  , clinfo1=' stress1_i   :')
620      CALL prt_ctl(tab2d_1=stress2_i  , clinfo1=' stress2_i   :')
621      CALL prt_ctl(tab2d_1=stress12_i , clinfo1=' stress12_i  :')
622      CALL prt_ctl(tab2d_1=strength   , clinfo1=' strength    :')
623      CALL prt_ctl(tab2d_1=delta_i    , clinfo1=' delta_i     :')
624      CALL prt_ctl(tab2d_1=u_ice      , clinfo1=' u_ice       :', tab2d_2=v_ice      , clinfo2=' v_ice       :')
625       
626      DO jl = 1, jpl
627         CALL prt_ctl_info(' ')
628         CALL prt_ctl_info(' - Category : ', ivar1=jl)
629         CALL prt_ctl_info('   ~~~~~~~~~~')
630         CALL prt_ctl(tab2d_1=ht_i       (:,:,jl)        , clinfo1= ' ht_i        : ')
631         CALL prt_ctl(tab2d_1=ht_s       (:,:,jl)        , clinfo1= ' ht_s        : ')
632         CALL prt_ctl(tab2d_1=t_su       (:,:,jl)        , clinfo1= ' t_su        : ')
633         CALL prt_ctl(tab2d_1=t_s        (:,:,1,jl)      , clinfo1= ' t_snow      : ')
634         CALL prt_ctl(tab2d_1=sm_i       (:,:,jl)        , clinfo1= ' sm_i        : ')
635         CALL prt_ctl(tab2d_1=o_i        (:,:,jl)        , clinfo1= ' o_i         : ')
636         CALL prt_ctl(tab2d_1=a_i        (:,:,jl)        , clinfo1= ' a_i         : ')
637         CALL prt_ctl(tab2d_1=v_i        (:,:,jl)        , clinfo1= ' v_i         : ')
638         CALL prt_ctl(tab2d_1=v_s        (:,:,jl)        , clinfo1= ' v_s         : ')
639         CALL prt_ctl(tab2d_1=e_i        (:,:,1,jl)      , clinfo1= ' e_i1        : ')
640         CALL prt_ctl(tab2d_1=e_s        (:,:,1,jl)      , clinfo1= ' e_snow      : ')
641         CALL prt_ctl(tab2d_1=smv_i      (:,:,jl)        , clinfo1= ' smv_i       : ')
642         CALL prt_ctl(tab2d_1=oa_i       (:,:,jl)        , clinfo1= ' oa_i        : ')
643         
644         DO jk = 1, nlay_i
645            CALL prt_ctl_info(' - Layer : ', ivar1=jk)
646            CALL prt_ctl(tab2d_1=t_i(:,:,jk,jl) , clinfo1= ' t_i       : ')
647         END DO
648      END DO
649     
650      CALL prt_ctl_info(' ')
651      CALL prt_ctl_info(' - Heat / FW fluxes : ')
652      CALL prt_ctl_info('   ~~~~~~~~~~~~~~~~~~ ')
653      CALL prt_ctl(tab2d_1=sst_m  , clinfo1= ' sst   : ', tab2d_2=sss_m     , clinfo2= ' sss       : ')
654      CALL prt_ctl(tab2d_1=qsr    , clinfo1= ' qsr   : ', tab2d_2=qns       , clinfo2= ' qns       : ')
655      CALL prt_ctl(tab2d_1=emp    , clinfo1= ' emp   : ', tab2d_2=sfx       , clinfo2= ' sfx       : ')
656     
657      CALL prt_ctl_info(' ')
658      CALL prt_ctl_info(' - Stresses : ')
659      CALL prt_ctl_info('   ~~~~~~~~~~ ')
660      CALL prt_ctl(tab2d_1=utau       , clinfo1= ' utau      : ', tab2d_2=vtau       , clinfo2= ' vtau      : ')
661      CALL prt_ctl(tab2d_1=utau_ice   , clinfo1= ' utau_ice  : ', tab2d_2=vtau_ice   , clinfo2= ' vtau_ice  : ')
662     
663   END SUBROUTINE ice_prt3D
664
665#else
666   !!--------------------------------------------------------------------------
667   !!   Default option         Empty Module               No LIM3 sea-ice model
668   !!--------------------------------------------------------------------------
669#endif
670
671   !!======================================================================
672END MODULE icectl
Note: See TracBrowser for help on using the repository browser.