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

source: NEMO/trunk/src/ICE/icectl.F90 @ 10538

Last change on this file since 10538 was 10538, checked in by clem, 5 years ago

increase the max number of communications (needed when using bdy which produces a lot of comm.)

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