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.
Changeset 15377 – NEMO

Changeset 15377


Ignore:
Timestamp:
2021-10-14T22:50:18+02:00 (3 years ago)
Author:
clem
Message:

reduce drastically the number of global com (from 250 to 50) when the logical ln_icediachk is on

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/ICE/icectl.F90

    r14997 r15377  
    8484      REAL(wp)        , INTENT(inout) ::   pdiag_v, pdiag_s, pdiag_t, pdiag_fv, pdiag_fs, pdiag_ft 
    8585      !! 
    86       REAL(wp) ::   zdiag_mass, zdiag_salt, zdiag_heat, & 
    87          &          zdiag_vimin, zdiag_vsmin, zdiag_vpmin, zdiag_vlmin, zdiag_aimin, zdiag_aimax, & 
    88          &          zdiag_eimin, zdiag_esmin, zdiag_simin 
    89       REAL(wp) ::   zvtrp, zetrp 
    90       REAL(wp) ::   zarea 
    91       !!------------------------------------------------------------------- 
    92       ! 
     86      REAL(wp) ::   zdiag_mass, zdiag_salt, zdiag_heat 
     87      REAL(wp), DIMENSION(jpi,jpj,10)     ::   ztmp3 
     88      REAL(wp), DIMENSION(jpi,jpj,jpl,8)  ::   ztmp4 
     89      REAL(wp), DIMENSION(10)             ::   zchk3          
     90      REAL(wp), DIMENSION(8)              ::   zchk4          
     91      !!------------------------------------------------------------------- 
     92      ! 
     93      ! -- quantities -- ! 
     94      ztmp3(:,:,1) = SUM( v_i * rhoi + v_s * rhos + ( v_ip + v_il ) * rhow, dim=3 ) * e1e2t        ! volume 
     95      ztmp3(:,:,2) = SUM( sv_i * rhoi, dim=3 ) * e1e2t                                             ! salt 
     96      ztmp3(:,:,3) = ( SUM( SUM( e_i, dim=4 ), dim=3 ) + SUM( SUM( e_s, dim=4 ), dim=3 ) ) * e1e2t ! heat 
     97      ! 
     98      ! -- fluxes -- ! 
     99      ztmp3(:,:,4) = ( wfx_bog + wfx_bom + wfx_sum + wfx_sni + wfx_opw + wfx_res + wfx_dyn + wfx_lam + wfx_pnd &  ! mass 
     100         &          + wfx_snw_sni + wfx_snw_sum + wfx_snw_dyn + wfx_snw_sub + wfx_ice_sub + wfx_spr ) * e1e2t 
     101      ztmp3(:,:,5) = ( sfx_bri + sfx_bog + sfx_bom + sfx_sum + sfx_sni + sfx_opw &                                ! salt 
     102         &          + sfx_res + sfx_dyn + sfx_sub + sfx_lam ) * e1e2t 
     103      ztmp3(:,:,6) = ( hfx_sum + hfx_bom + hfx_bog + hfx_dif + hfx_opw + hfx_snw &                                ! heat 
     104         &          - hfx_thd - hfx_dyn - hfx_res - hfx_sub - hfx_spr ) * e1e2t 
     105      ! 
     106      ! -- global sum -- ! 
     107      zchk3(1:6) = glob_sum_vec( 'icectl', ztmp3(:,:,1:6) ) 
     108 
    93109      IF( icount == 0 ) THEN 
    94  
    95          pdiag_v = glob_sum( 'icectl',   SUM( v_i * rhoi + v_s * rhos + ( v_ip + v_il ) * rhow, dim=3 ) * e1e2t ) 
    96          pdiag_s = glob_sum( 'icectl',   SUM( sv_i * rhoi            , dim=3 ) * e1e2t ) 
    97          pdiag_t = glob_sum( 'icectl', ( SUM( SUM( e_i, dim=4 ), dim=3 ) + SUM( SUM( e_s, dim=4 ), dim=3 ) ) * e1e2t ) 
    98  
    99          ! mass flux 
    100          pdiag_fv = glob_sum( 'icectl',  & 
    101             &                         ( wfx_bog + wfx_bom + wfx_sum + wfx_sni + wfx_opw + wfx_res + wfx_dyn + wfx_lam + wfx_pnd + & 
    102             &                           wfx_snw_sni + wfx_snw_sum + wfx_snw_dyn + wfx_snw_sub + wfx_ice_sub + wfx_spr ) * e1e2t ) 
    103          ! salt flux 
    104          pdiag_fs = glob_sum( 'icectl',  & 
    105             &                         ( sfx_bri + sfx_bog + sfx_bom + sfx_sum + sfx_sni + & 
    106             &                           sfx_opw + sfx_res + sfx_dyn + sfx_sub + sfx_lam ) * e1e2t ) 
    107          ! heat flux 
    108          pdiag_ft = glob_sum( 'icectl',  & 
    109             &                         (   hfx_sum + hfx_bom + hfx_bog + hfx_dif + hfx_opw + hfx_snw  & 
    110             &                           - hfx_thd - hfx_dyn - hfx_res - hfx_sub - hfx_spr ) * e1e2t ) 
    111  
     110         ! 
     111         pdiag_v  = zchk3(1) 
     112         pdiag_s  = zchk3(2) 
     113         pdiag_t  = zchk3(3) 
     114         pdiag_fv = zchk3(4) 
     115         pdiag_fs = zchk3(5) 
     116         pdiag_ft = zchk3(6) 
     117         ! 
    112118      ELSEIF( icount == 1 ) THEN 
    113  
    114          ! -- mass diag -- ! 
    115          zdiag_mass = ( glob_sum( 'icectl', SUM( v_i * rhoi + v_s * rhos + ( v_ip + v_il ) * rhow, dim=3 ) * e1e2t )      & 
    116             &            - pdiag_v ) * r1_Dt_ice                                                                          & 
    117             &         + glob_sum( 'icectl', ( wfx_bog + wfx_bom + wfx_sum + wfx_sni + wfx_opw + wfx_res + wfx_dyn +       & 
    118             &                                 wfx_lam + wfx_pnd + wfx_snw_sni + wfx_snw_sum + wfx_snw_dyn + wfx_snw_sub + & 
    119             &                                 wfx_ice_sub + wfx_spr ) * e1e2t )                                           & 
    120             &         - pdiag_fv 
    121119         ! 
    122          ! -- salt diag -- ! 
    123          zdiag_salt = ( glob_sum( 'icectl', SUM( sv_i * rhoi , dim=3 ) * e1e2t ) - pdiag_s ) * r1_Dt_ice  & 
    124             &         + glob_sum( 'icectl', ( sfx_bri + sfx_bog + sfx_bom + sfx_sum + sfx_sni +           & 
    125             &                                 sfx_opw + sfx_res + sfx_dyn + sfx_sub + sfx_lam ) * e1e2t ) & 
    126             &         - pdiag_fs 
    127          ! 
    128          ! -- heat diag -- ! 
    129          zdiag_heat = ( glob_sum( 'icectl', ( SUM(SUM(e_i, dim=4), dim=3) + SUM(SUM(e_s, dim=4), dim=3) ) * e1e2t ) - pdiag_t & 
    130             &         ) * r1_Dt_ice                                                                                           & 
    131             &         + glob_sum( 'icectl', (  hfx_sum + hfx_bom + hfx_bog + hfx_dif + hfx_opw + hfx_snw                      & 
    132             &                                - hfx_thd - hfx_dyn - hfx_res - hfx_sub - hfx_spr ) * e1e2t )                    & 
    133             &         - pdiag_ft 
    134  
    135          ! -- min/max diag -- ! 
    136          zdiag_aimax = glob_max( 'icectl', SUM( a_i, dim=3 ) ) 
    137          zdiag_vimin = glob_min( 'icectl', v_i  ) 
    138          zdiag_vsmin = glob_min( 'icectl', v_s  ) 
    139          zdiag_vpmin = glob_min( 'icectl', v_ip ) 
    140          zdiag_vlmin = glob_min( 'icectl', v_il ) 
    141          zdiag_aimin = glob_min( 'icectl', a_i  ) 
    142          zdiag_simin = glob_min( 'icectl', sv_i ) 
    143          zdiag_eimin = glob_min( 'icectl', SUM( e_i, dim=3 ) ) 
    144          zdiag_esmin = glob_min( 'icectl', SUM( e_s, dim=3 ) ) 
     120         ! -- mass, salt and heat diags -- ! 
     121         zdiag_mass = ( zchk3(1) - pdiag_v ) * r1_Dt_ice + ( zchk3(4) - pdiag_fv ) 
     122         zdiag_salt = ( zchk3(2) - pdiag_s ) * r1_Dt_ice + ( zchk3(5) - pdiag_fs ) 
     123         zdiag_heat = ( zchk3(3) - pdiag_t ) * r1_Dt_ice + ( zchk3(6) - pdiag_ft ) 
     124 
     125         ! -- max concentration diag -- ! 
     126         ztmp3(:,:,7) = SUM( a_i, dim=3 ) 
     127         zchk3(7)     = glob_max( 'icectl', ztmp3(:,:,7) ) 
    145128 
    146129         ! -- advection scheme is conservative? -- ! 
    147          zvtrp = glob_sum( 'icectl', diag_adv_mass * e1e2t ) 
    148          zetrp = glob_sum( 'icectl', diag_adv_heat * e1e2t ) 
    149  
    150          ! ice area (+epsi10 to set a threshold > 0 when there is no ice) 
    151          zarea = glob_sum( 'icectl', SUM( a_i + epsi10, dim=3 ) * e1e2t ) 
     130         ztmp3(:,:,8 ) = diag_adv_mass * e1e2t  
     131         ztmp3(:,:,9 ) = diag_adv_heat * e1e2t  
     132         ztmp3(:,:,10) = SUM( a_i + epsi10, dim=3 ) * e1e2t ! ice area (+epsi10 to set a threshold > 0 when there is no ice) 
     133         zchk3(8:10)   = glob_sum_vec( 'icectl', ztmp3(:,:,8:10) ) 
     134          
     135         ! -- min diags -- ! 
     136         ztmp4(:,:,:,1) = v_i 
     137         ztmp4(:,:,:,2) = v_s 
     138         ztmp4(:,:,:,3) = v_ip 
     139         ztmp4(:,:,:,4) = v_il 
     140         ztmp4(:,:,:,5) = a_i 
     141         ztmp4(:,:,:,6) = sv_i 
     142         ztmp4(:,:,:,7) = SUM( e_i, dim=3 ) 
     143         ztmp4(:,:,:,8) = SUM( e_s, dim=3 ) 
     144         zchk4(1:8)     = glob_min_vec( 'icectl', ztmp4(:,:,:,1:8) ) 
    152145 
    153146         IF( lwp ) THEN 
    154147            ! check conservation issues 
    155             IF( ABS(zdiag_mass) > zchk_m * rn_icechk_glo * zarea ) & 
     148            IF( ABS(zdiag_mass) > zchk_m * rn_icechk_glo * zchk3(10) ) & 
    156149               &                   WRITE(numout,*)   cd_routine,' : violation mass cons. [kg] = ',zdiag_mass * rDt_ice 
    157             IF( ABS(zdiag_salt) > zchk_s * rn_icechk_glo * zarea ) & 
     150            IF( ABS(zdiag_salt) > zchk_s * rn_icechk_glo * zchk3(10) ) & 
    158151               &                   WRITE(numout,*)   cd_routine,' : violation salt cons. [g]  = ',zdiag_salt * rDt_ice 
    159             IF( ABS(zdiag_heat) > zchk_t * rn_icechk_glo * zarea ) & 
     152            IF( ABS(zdiag_heat) > zchk_t * rn_icechk_glo * zchk3(10) ) & 
    160153               &                   WRITE(numout,*)   cd_routine,' : violation heat cons. [J]  = ',zdiag_heat * rDt_ice 
    161154            ! check negative values 
    162             IF( zdiag_vimin < 0. ) WRITE(numout,*)   cd_routine,' : violation v_i  < 0        = ',zdiag_vimin 
    163             IF( zdiag_vsmin < 0. ) WRITE(numout,*)   cd_routine,' : violation v_s  < 0        = ',zdiag_vsmin 
    164             IF( zdiag_vpmin < 0. ) WRITE(numout,*)   cd_routine,' : violation v_ip < 0        = ',zdiag_vpmin 
    165             IF( zdiag_vlmin < 0. ) WRITE(numout,*)   cd_routine,' : violation v_il < 0        = ',zdiag_vlmin 
    166             IF( zdiag_aimin < 0. ) WRITE(numout,*)   cd_routine,' : violation a_i  < 0        = ',zdiag_aimin 
    167             IF( zdiag_simin < 0. ) WRITE(numout,*)   cd_routine,' : violation s_i  < 0        = ',zdiag_simin 
    168             IF( zdiag_eimin < 0. ) WRITE(numout,*)   cd_routine,' : violation e_i  < 0        = ',zdiag_eimin 
    169             IF( zdiag_esmin < 0. ) WRITE(numout,*)   cd_routine,' : violation e_s  < 0        = ',zdiag_esmin 
     155            IF( zchk4(1) < 0. )   WRITE(numout,*)   cd_routine,' : violation v_i  < 0        = ',zchk4(1) 
     156            IF( zchk4(2) < 0. )   WRITE(numout,*)   cd_routine,' : violation v_s  < 0        = ',zchk4(2) 
     157            IF( zchk4(3) < 0. )   WRITE(numout,*)   cd_routine,' : violation v_ip < 0        = ',zchk4(3) 
     158            IF( zchk4(4) < 0. )   WRITE(numout,*)   cd_routine,' : violation v_il < 0        = ',zchk4(4) 
     159            IF( zchk4(5) < 0. )   WRITE(numout,*)   cd_routine,' : violation a_i  < 0        = ',zchk4(5) 
     160            IF( zchk4(6) < 0. )   WRITE(numout,*)   cd_routine,' : violation s_i  < 0        = ',zchk4(6) 
     161            IF( zchk4(7) < 0. )   WRITE(numout,*)   cd_routine,' : violation e_i  < 0        = ',zchk4(7) 
     162            IF( zchk4(8) < 0. )   WRITE(numout,*)   cd_routine,' : violation e_s  < 0        = ',zchk4(8) 
    170163            ! check maximum ice concentration 
    171             IF( zdiag_aimax>MAX(rn_amax_n,rn_amax_s)+epsi10 .AND. cd_routine /= 'icedyn_adv' .AND. cd_routine /= 'icedyn_rdgrft' ) & 
    172                &                   WRITE(numout,*)   cd_routine,' : violation a_i > amax      = ',zdiag_aimax 
     164            IF( zchk3(7)>MAX(rn_amax_n,rn_amax_s)+epsi10 .AND. cd_routine /= 'icedyn_adv' .AND. cd_routine /= 'icedyn_rdgrft' ) & 
     165               &                  WRITE(numout,*)   cd_routine,' : violation a_i > amax      = ',zchk3(7) 
    173166            ! check if advection scheme is conservative 
    174             IF( ABS(zvtrp) > zchk_m * rn_icechk_glo * zarea .AND. cd_routine == 'icedyn_adv' ) & 
    175                &                   WRITE(numout,*)   cd_routine,' : violation adv scheme [kg] = ',zvtrp * rDt_ice 
    176             IF( ABS(zetrp) > zchk_t * rn_icechk_glo * zarea .AND. cd_routine == 'icedyn_adv' ) & 
    177                &                   WRITE(numout,*)   cd_routine,' : violation adv scheme [J]  = ',zetrp * rDt_ice 
     167            IF( ABS(zchk3(8)) > zchk_m * rn_icechk_glo * zchk3(10) .AND. cd_routine == 'icedyn_adv' ) & 
     168               &                  WRITE(numout,*)   cd_routine,' : violation adv scheme [kg] = ',zchk3(8) * rDt_ice 
     169            IF( ABS(zchk3(9)) > zchk_t * rn_icechk_glo * zchk3(10) .AND. cd_routine == 'icedyn_adv' ) & 
     170               &                  WRITE(numout,*)   cd_routine,' : violation adv scheme [J]  = ',zchk3(9) * rDt_ice 
    178171         ENDIF 
    179172         ! 
     
    195188      !!------------------------------------------------------------------- 
    196189      CHARACTER(len=*), INTENT(in) ::   cd_routine    ! name of the routine 
    197       REAL(wp) ::   zdiag_mass, zdiag_salt, zdiag_heat 
    198       REAL(wp) ::   zarea 
    199       !!------------------------------------------------------------------- 
    200  
    201       ! water flux 
    202       ! -- mass diag -- ! 
    203       zdiag_mass = glob_sum( 'icectl', (  wfx_ice   + wfx_snw   + wfx_spr   + wfx_sub + wfx_pnd & 
    204          &                              + diag_vice + diag_vsnw + diag_vpnd - diag_adv_mass ) * e1e2t ) 
    205  
    206       ! -- salt diag -- ! 
    207       zdiag_salt = glob_sum( 'icectl', ( sfx + diag_sice - diag_adv_salt ) * e1e2t ) 
    208  
    209       ! -- heat diag -- ! 
    210       zdiag_heat = glob_sum( 'icectl', ( qt_oce_ai - qt_atm_oi + diag_heat - diag_adv_heat ) * e1e2t ) 
     190      !! 
     191      REAL(wp), DIMENSION(jpi,jpj,4)     ::   ztmp 
     192      REAL(wp), DIMENSION(4)             ::   zchk          
     193      !!------------------------------------------------------------------- 
     194 
     195      ztmp(:,:,1) = ( wfx_ice + wfx_snw + wfx_spr + wfx_sub + wfx_pnd + diag_vice + diag_vsnw + diag_vpnd - diag_adv_mass ) * e1e2t ! mass diag 
     196      ztmp(:,:,2) = ( sfx + diag_sice - diag_adv_salt ) * e1e2t                                                                     ! salt 
     197      ztmp(:,:,3) = ( qt_oce_ai - qt_atm_oi + diag_heat - diag_adv_heat ) * e1e2t                                                   ! heat 
    211198      ! equivalent to this: 
    212       !!zdiag_heat = glob_sum( 'icectl', ( -diag_heat + hfx_sum + hfx_bom + hfx_bog + hfx_dif + hfx_opw + hfx_snw & 
    213       !!   &                                          - hfx_thd - hfx_dyn - hfx_res - hfx_sub - hfx_spr & 
    214       !!   &                                          ) * e1e2t ) 
    215  
    216       ! ice area (+epsi10 to set a threshold > 0 when there is no ice) 
    217       zarea = glob_sum( 'icectl', SUM( a_i + epsi10, dim=3 ) * e1e2t ) 
    218  
     199      !! ( -diag_heat + hfx_sum + hfx_bom + hfx_bog + hfx_dif + hfx_opw + hfx_snw & 
     200      !!   &                                        - hfx_thd - hfx_dyn - hfx_res - hfx_sub - hfx_spr ) * e1e2t ) 
     201      ztmp(:,:,4) =  SUM( a_i + epsi10, dim=3 ) * e1e2t      ! ice area (+epsi10 to set a threshold > 0 when there is no ice) 
     202 
     203      ! global sums 
     204      zchk(1:4)   = glob_sum_vec( 'icectl', ztmp(:,:,1:4) ) 
     205       
    219206      IF( lwp ) THEN 
    220          IF( ABS(zdiag_mass) > zchk_m * rn_icechk_glo * zarea ) & 
    221             &                   WRITE(numout,*) cd_routine,' : violation mass cons. [kg] = ',zdiag_mass * rDt_ice 
    222          IF( ABS(zdiag_salt) > zchk_s * rn_icechk_glo * zarea ) & 
    223             &                   WRITE(numout,*) cd_routine,' : violation salt cons. [g]  = ',zdiag_salt * rDt_ice 
    224          IF( ABS(zdiag_heat) > zchk_t * rn_icechk_glo * zarea ) & 
    225             &                   WRITE(numout,*) cd_routine,' : violation heat cons. [J]  = ',zdiag_heat * rDt_ice 
     207         IF( ABS(zchk(1)) > zchk_m * rn_icechk_glo * zchk(4) ) & 
     208            &                   WRITE(numout,*) cd_routine,' : violation mass cons. [kg] = ',zchk(1) * rDt_ice 
     209         IF( ABS(zchk(2)) > zchk_s * rn_icechk_glo * zchk(4) ) & 
     210            &                   WRITE(numout,*) cd_routine,' : violation salt cons. [g]  = ',zchk(2) * rDt_ice 
     211         IF( ABS(zchk(3)) > zchk_t * rn_icechk_glo * zchk(4) ) & 
     212            &                   WRITE(numout,*) cd_routine,' : violation heat cons. [J]  = ',zchk(3) * rDt_ice 
    226213      ENDIF 
    227214      ! 
     
    762749      INTEGER, INTENT(in) ::   kt   ! ice time-step index 
    763750      ! 
    764       INTEGER  ::   ji, jj 
    765       REAL(wp) ::   zdiag_mass, zdiag_salt, zdiag_heat, zdiag_adv_mass, zdiag_adv_salt, zdiag_adv_heat 
    766       REAL(wp), DIMENSION(jpi,jpj) ::   zdiag_mass2D, zdiag_salt2D, zdiag_heat2D 
     751      REAL(wp), DIMENSION(jpi,jpj,6) ::   ztmp 
     752      REAL(wp), DIMENSION(6)         ::   zchk 
    767753      !!------------------------------------------------------------------- 
    768754      ! 
     
    773759      ENDIF 
    774760      ! 
    775       ! 2D budgets (must be close to 0) 
    776       IF( iom_use('icedrift_mass') .OR. iom_use('icedrift_salt') .OR. iom_use('icedrift_heat') ) THEN 
    777          DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) 
    778             zdiag_mass2D(ji,jj) = wfx_ice(ji,jj)   + wfx_snw(ji,jj)   + wfx_spr(ji,jj)   + wfx_sub(ji,jj) + wfx_pnd(ji,jj) & 
    779                &                + diag_vice(ji,jj) + diag_vsnw(ji,jj) + diag_vpnd(ji,jj) - diag_adv_mass(ji,jj) 
    780             zdiag_salt2D(ji,jj) = sfx(ji,jj) + diag_sice(ji,jj) - diag_adv_salt(ji,jj) 
    781             zdiag_heat2D(ji,jj) = qt_oce_ai(ji,jj) - qt_atm_oi(ji,jj) + diag_heat(ji,jj) - diag_adv_heat(ji,jj) 
    782          END_2D 
    783          ! 
    784          ! write outputs 
    785          CALL iom_put( 'icedrift_mass', zdiag_mass2D ) 
    786          CALL iom_put( 'icedrift_salt', zdiag_salt2D ) 
    787          CALL iom_put( 'icedrift_heat', zdiag_heat2D ) 
    788       ENDIF 
    789  
    790       ! -- mass diag -- ! 
    791       zdiag_mass     = glob_sum( 'icectl', (  wfx_ice   + wfx_snw   + wfx_spr   + wfx_sub + wfx_pnd & 
    792          &                                  + diag_vice + diag_vsnw + diag_vpnd - diag_adv_mass ) * e1e2t ) * rDt_ice 
    793       zdiag_adv_mass = glob_sum( 'icectl', diag_adv_mass * e1e2t ) * rDt_ice 
    794  
    795       ! -- salt diag -- ! 
    796       zdiag_salt     = glob_sum( 'icectl', ( sfx + diag_sice - diag_adv_salt ) * e1e2t ) * rDt_ice * 1.e-3 
    797       zdiag_adv_salt = glob_sum( 'icectl', diag_adv_salt * e1e2t ) * rDt_ice * 1.e-3 
    798  
    799       ! -- heat diag -- ! 
    800       zdiag_heat     = glob_sum( 'icectl', ( qt_oce_ai - qt_atm_oi + diag_heat - diag_adv_heat ) * e1e2t ) 
    801       zdiag_adv_heat = glob_sum( 'icectl', diag_adv_heat * e1e2t ) 
    802  
     761      ! -- 2D budgets (must be close to 0) -- ! 
     762      ztmp(:,:,1) =  wfx_ice  (:,:) + wfx_snw  (:,:) + wfx_spr  (:,:) + wfx_sub(:,:) + wfx_pnd(:,:) & 
     763         &         + diag_vice(:,:) + diag_vsnw(:,:) + diag_vpnd(:,:) - diag_adv_mass(:,:) 
     764      ztmp(:,:,2) = sfx(:,:) + diag_sice(:,:) - diag_adv_salt(:,:) 
     765      ztmp(:,:,3) = qt_oce_ai(:,:) - qt_atm_oi(:,:) + diag_heat(:,:) - diag_adv_heat(:,:) 
     766 
     767      ! write outputs 
     768      CALL iom_put( 'icedrift_mass', ztmp(:,:,1) ) 
     769      CALL iom_put( 'icedrift_salt', ztmp(:,:,2) ) 
     770      CALL iom_put( 'icedrift_heat', ztmp(:,:,3) ) 
     771 
     772      ! -- 1D budgets -- ! 
     773      ztmp(:,:,1) = ztmp(:,:,1) * e1e2t * rDt_ice         ! mass 
     774      ztmp(:,:,2) = ztmp(:,:,2) * e1e2t * rDt_ice * 1.e-3 ! salt 
     775      ztmp(:,:,3) = ztmp(:,:,3) * e1e2t                   ! heat 
     776 
     777      ztmp(:,:,4) = diag_adv_mass * e1e2t * rDt_ice 
     778      ztmp(:,:,5) = diag_adv_salt * e1e2t * rDt_ice * 1.e-3 
     779      ztmp(:,:,6) = diag_adv_heat * e1e2t 
     780 
     781      ! global sums 
     782      zchk(1:6) = glob_sum_vec( 'icectl', ztmp(:,:,1:6) ) 
     783       
    803784      !                    ! write out to file 
    804785      IF( lwp ) THEN 
    805786         ! check global drift (must be close to 0) 
    806          WRITE(numicedrift,FMT='(2x,i6,3x,a19,4x,f25.5)') kt, 'mass drift     [kg]', zdiag_mass 
    807          WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'salt drift     [kg]', zdiag_salt 
    808          WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'heat drift     [W] ', zdiag_heat 
     787         WRITE(numicedrift,FMT='(2x,i6,3x,a19,4x,f25.5)') kt, 'mass drift     [kg]', zchk(1) 
     788         WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'salt drift     [kg]', zchk(2) 
     789         WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'heat drift     [W] ', zchk(3) 
    809790         ! check drift from advection scheme (can be /=0 with bdy but not sure why) 
    810          WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'mass drift adv [kg]', zdiag_adv_mass 
    811          WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'salt drift adv [kg]', zdiag_adv_salt 
    812          WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'heat drift adv [W] ', zdiag_adv_heat 
     791         WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'mass drift adv [kg]', zchk(4) 
     792         WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'salt drift adv [kg]', zchk(5) 
     793         WRITE(numicedrift,FMT='(11x,     a19,4x,f25.5)')     'heat drift adv [W] ', zchk(6) 
    813794      ENDIF 
    814795      !                    ! drifts 
    815       rdiag_icemass = rdiag_icemass + zdiag_mass 
    816       rdiag_icesalt = rdiag_icesalt + zdiag_salt 
    817       rdiag_iceheat = rdiag_iceheat + zdiag_heat 
    818       rdiag_adv_icemass = rdiag_adv_icemass + zdiag_adv_mass 
    819       rdiag_adv_icesalt = rdiag_adv_icesalt + zdiag_adv_salt 
    820       rdiag_adv_iceheat = rdiag_adv_iceheat + zdiag_adv_heat 
     796      rdiag_icemass = rdiag_icemass + zchk(1) 
     797      rdiag_icesalt = rdiag_icesalt + zchk(2) 
     798      rdiag_iceheat = rdiag_iceheat + zchk(3) 
     799      rdiag_adv_icemass = rdiag_adv_icemass + zchk(4) 
     800      rdiag_adv_icesalt = rdiag_adv_icesalt + zchk(5) 
     801      rdiag_adv_iceheat = rdiag_adv_iceheat + zchk(6) 
    821802      ! 
    822803      !                    ! output drifts and close ascii file 
Note: See TracChangeset for help on using the changeset viewer.