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

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

changes in style - part1 - (now the code looks better txs to Gurvan's comments)

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