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

Changeset 15048 for NEMO/trunk/src/ICE


Ignore:
Timestamp:
2021-06-23T18:02:14+02:00 (3 years ago)
Author:
clem
Message:

reduce drastically the number of global communications when using diagnostic outputs. New functions are created: glob_sum_vec and glob_sum_full_vec, which gave a vector as an output. This vector is composed of different summed arrays (such as temperature, salinity etc). Global diagnostics are identical as before. See examples in icedia and diahsb.

File:
1 edited

Legend:

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

    r14718 r15048  
    6565      INTEGER, INTENT(in) ::   kt   ! ocean time step 
    6666      !! 
    67       REAL(wp)   ::   zbg_ivol, zbg_item, zbg_area, zbg_isal 
    68       REAL(wp)   ::   zbg_svol, zbg_stem 
    69       REAL(wp)   ::   zbg_ipvol, zbg_ilvol 
    70       REAL(wp)   ::   z_frc_voltop, z_frc_temtop, z_frc_sal 
    71       REAL(wp)   ::   z_frc_volbot, z_frc_tembot 
    72       REAL(wp)   ::   zdiff_vol, zdiff_sal, zdiff_tem 
     67      REAL(wp), DIMENSION(jpi,jpj,16) ::   ztmp 
     68      REAL(wp), DIMENSION(16)         ::   zbg           
    7369      !!--------------------------------------------------------------------------- 
    7470      IF( ln_timing )   CALL timing_start('ice_dia') 
     
    8480      ENDIF 
    8581 
    86       ! ----------------------- ! 
    87       ! 1 -  Contents           ! 
    88       ! ----------------------- ! 
    89       IF(  iom_use('ibgvol_tot' ) .OR. iom_use('sbgvol_tot' ) .OR. iom_use('ibgarea_tot') .OR. & 
    90          & iom_use('ibgsalt_tot') .OR. iom_use('ibgheat_tot') .OR. iom_use('sbgheat_tot') .OR. & 
    91          & iom_use('ipbgvol_tot' ) .OR. iom_use('ilbgvol_tot' ) ) THEN 
    92  
    93          zbg_ivol = glob_sum( 'icedia', vt_i(:,:) * e1e2t(:,:) ) * 1.e-9  ! ice volume (km3) 
    94          zbg_svol = glob_sum( 'icedia', vt_s(:,:) * e1e2t(:,:) ) * 1.e-9  ! snow volume (km3) 
    95          zbg_area = glob_sum( 'icedia', at_i(:,:) * e1e2t(:,:) ) * 1.e-6  ! area (km2) 
    96          zbg_isal = glob_sum( 'icedia', st_i(:,:) * e1e2t(:,:) ) * 1.e-9  ! salt content (pss*km3) 
    97          zbg_item = glob_sum( 'icedia', et_i(:,:) * e1e2t(:,:) ) * 1.e-20 ! heat content (1.e20 J) 
    98          zbg_stem = glob_sum( 'icedia', et_s(:,:) * e1e2t(:,:) ) * 1.e-20 ! heat content (1.e20 J) 
    99          ! ponds 
    100          zbg_ipvol = glob_sum( 'icedia', vt_ip(:,:) * e1e2t(:,:) ) * 1.e-9  ! ice pond volume (km3) 
    101          zbg_ilvol = glob_sum( 'icedia', vt_il(:,:) * e1e2t(:,:) ) * 1.e-9  ! ice pond lid volume (km3) 
    102  
    103          CALL iom_put( 'ibgvol_tot'  , zbg_ivol ) 
    104          CALL iom_put( 'sbgvol_tot'  , zbg_svol ) 
    105          CALL iom_put( 'ibgarea_tot' , zbg_area ) 
    106          CALL iom_put( 'ibgsalt_tot' , zbg_isal ) 
    107          CALL iom_put( 'ibgheat_tot' , zbg_item ) 
    108          CALL iom_put( 'sbgheat_tot' , zbg_stem ) 
    109          ! ponds 
    110          CALL iom_put( 'ipbgvol_tot' , zbg_ipvol ) 
    111          CALL iom_put( 'ilbgvol_tot' , zbg_ilvol ) 
    112  
    113       ENDIF 
    114  
     82      ztmp(:,:,:) = 0._wp ! should be better coded 
     83       
    11584      ! ---------------------------! 
    116       ! 2 - Trends due to forcing  ! 
     85      ! 1 - Trends due to forcing  ! 
    11786      ! ---------------------------! 
    11887      ! they must be kept outside an IF(iom_use) because of the call to dia_rst below 
    119       z_frc_volbot = r1_rho0 * glob_sum( 'icedia', -( wfx_ice(:,:) + wfx_snw(:,:) + wfx_err_sub(:,:) ) * e1e2t(:,:) ) * 1.e-9   ! freshwater flux ice/snow-ocean 
    120       z_frc_voltop = r1_rho0 * glob_sum( 'icedia', -( wfx_sub(:,:) + wfx_spr(:,:) )                    * e1e2t(:,:) ) * 1.e-9   ! freshwater flux ice/snow-atm 
    121       z_frc_sal    = r1_rho0 * glob_sum( 'icedia', -      sfx(:,:)                                     * e1e2t(:,:) ) * 1.e-9   ! salt fluxes ice/snow-ocean 
    122       z_frc_tembot =           glob_sum( 'icedia',  qt_oce_ai(:,:)                                     * e1e2t(:,:) ) * 1.e-20  ! heat on top of ocean (and below ice) 
    123       z_frc_temtop =           glob_sum( 'icedia',  qt_atm_oi(:,:)                                     * e1e2t(:,:) ) * 1.e-20  ! heat on top of ice-coean 
    124       ! 
    125       frc_voltop  = frc_voltop  + z_frc_voltop  * rDt_ice ! km3 
    126       frc_volbot  = frc_volbot  + z_frc_volbot  * rDt_ice ! km3 
    127       frc_sal     = frc_sal     + z_frc_sal     * rDt_ice ! km3*pss 
    128       frc_temtop  = frc_temtop  + z_frc_temtop  * rDt_ice ! 1.e20 J 
    129       frc_tembot  = frc_tembot  + z_frc_tembot  * rDt_ice ! 1.e20 J 
    130  
    131       CALL iom_put( 'ibgfrcvoltop' , frc_voltop )   ! vol  forcing ice/snw-atm          (km3 equivalent ocean water) 
    132       CALL iom_put( 'ibgfrcvolbot' , frc_volbot )   ! vol  forcing ice/snw-ocean        (km3 equivalent ocean water) 
    133       CALL iom_put( 'ibgfrcsal'    , frc_sal    )   ! sal - forcing                     (psu*km3 equivalent ocean water) 
    134       CALL iom_put( 'ibgfrctemtop' , frc_temtop )   ! heat on top of ice/snw/ocean      (1.e20 J) 
    135       CALL iom_put( 'ibgfrctembot' , frc_tembot )   ! heat on top of ocean(below ice)   (1.e20 J) 
    136  
    137       IF(  iom_use('ibgfrchfxtop') .OR. iom_use('ibgfrchfxbot') ) THEN 
    138          CALL iom_put( 'ibgfrchfxtop' , frc_temtop * z1_e1e2 * 1.e-20 * kt*rn_Dt ) ! heat on top of ice/snw/ocean      (W/m2) 
    139          CALL iom_put( 'ibgfrchfxbot' , frc_tembot * z1_e1e2 * 1.e-20 * kt*rn_Dt ) ! heat on top of ocean(below ice)   (W/m2) 
    140       ENDIF 
     88      ztmp(:,:,1) = - ( wfx_ice(:,:) + wfx_snw(:,:) + wfx_err_sub(:,:) ) * e1e2t(:,:) ! freshwater flux ice/snow-ocean 
     89      ztmp(:,:,2) = - ( wfx_sub(:,:) + wfx_spr(:,:) )                    * e1e2t(:,:) ! freshwater flux ice/snow-atm 
     90      ztmp(:,:,3) = -   sfx    (:,:)                                     * e1e2t(:,:) ! salt fluxes ice/snow-ocean 
     91      ztmp(:,:,4) =   qt_atm_oi(:,:)                                     * e1e2t(:,:) ! heat on top of ice-ocean 
     92      ztmp(:,:,5) =   qt_oce_ai(:,:)                                     * e1e2t(:,:) ! heat on top of ocean (and below ice) 
     93       
     94      ! ----------------------- ! 
     95      ! 2 -  Contents           ! 
     96      ! ----------------------- ! 
     97      IF( iom_use('ibgvol_tot' ) )   ztmp(:,:,6 ) = vt_i (:,:) * e1e2t(:,:) ! ice volume 
     98      IF( iom_use('sbgvol_tot' ) )   ztmp(:,:,7 ) = vt_s (:,:) * e1e2t(:,:) ! snow volume 
     99      IF( iom_use('ibgarea_tot') )   ztmp(:,:,8 ) = at_i (:,:) * e1e2t(:,:) ! area 
     100      IF( iom_use('ibgsalt_tot') )   ztmp(:,:,9 ) = st_i (:,:) * e1e2t(:,:) ! salt content 
     101      IF( iom_use('ibgheat_tot') )   ztmp(:,:,10) = et_i (:,:) * e1e2t(:,:) ! heat content 
     102      IF( iom_use('sbgheat_tot') )   ztmp(:,:,11) = et_s (:,:) * e1e2t(:,:) ! heat content 
     103      IF( iom_use('ipbgvol_tot') )   ztmp(:,:,12) = vt_ip(:,:) * e1e2t(:,:) ! ice pond volume 
     104      IF( iom_use('ilbgvol_tot') )   ztmp(:,:,13) = vt_il(:,:) * e1e2t(:,:) ! ice pond lid volume 
    141105 
    142106      ! ---------------------------------- ! 
    143107      ! 3 -  Content variations and drifts ! 
    144108      ! ---------------------------------- ! 
    145       IF(  iom_use('ibgvolume') .OR. iom_use('ibgsaltco') .OR. iom_use('ibgheatco') .OR. iom_use('ibgheatfx') ) THEN 
    146  
    147          zdiff_vol = r1_rho0 * glob_sum( 'icedia', ( rhoi*vt_i(:,:) + rhos*vt_s(:,:) - vol_loc_ini(:,:) ) * e1e2t(:,:) ) * 1.e-9   ! freshwater trend (km3) 
    148          zdiff_sal = r1_rho0 * glob_sum( 'icedia', ( rhoi*st_i(:,:)                  - sal_loc_ini(:,:) ) * e1e2t(:,:) ) * 1.e-9   ! salt content trend (km3*pss) 
    149          zdiff_tem =           glob_sum( 'icedia', ( et_i(:,:) + et_s(:,:)           - tem_loc_ini(:,:) ) * e1e2t(:,:) ) * 1.e-20  ! heat content trend (1.e20 J) 
    150          !                               + SUM( qevap_ice * a_i_b, dim=3 )       !! clem: I think this term should not be there (but needs a check) 
    151  
    152          zdiff_vol = zdiff_vol - ( frc_voltop + frc_volbot ) 
    153          zdiff_sal = zdiff_sal - frc_sal 
    154          zdiff_tem = zdiff_tem - ( frc_tembot - frc_temtop ) 
    155  
    156          CALL iom_put( 'ibgvolume' , zdiff_vol )   ! ice/snow volume  drift            (km3 equivalent ocean water) 
    157          CALL iom_put( 'ibgsaltco' , zdiff_sal )   ! ice salt content drift            (psu*km3 equivalent ocean water) 
    158          CALL iom_put( 'ibgheatco' , zdiff_tem )   ! ice/snow heat content drift       (1.e20 J) 
    159          ! 
    160       ENDIF 
    161  
     109      IF( iom_use('ibgvolume') ) ztmp(:,:,14) = ( rhoi*vt_i(:,:) + rhos*vt_s(:,:) - vol_loc_ini(:,:) ) * e1e2t(:,:) ! freshwater trend 
     110      IF( iom_use('ibgsaltco') ) ztmp(:,:,15) = ( rhoi*st_i(:,:)                  - sal_loc_ini(:,:) ) * e1e2t(:,:) ! salt content trend 
     111      IF( iom_use('ibgheatco') .OR. iom_use('ibgheatfx') ) & 
     112         &                       ztmp(:,:,16) = ( et_i(:,:) + et_s(:,:)           - tem_loc_ini(:,:) ) * e1e2t(:,:) ! heat content trend 
     113       
     114      ! global sum 
     115      zbg(1:16) = glob_sum_vec( 'icedia', ztmp(:,:,1:16) ) 
     116 
     117      ! change units for trends 
     118      zbg(1) = zbg(1) * r1_rho0 * 1.e-9  * rDt_ice ! freshwater flux ice/snow-ocean (km3) 
     119      zbg(2) = zbg(2) * r1_rho0 * 1.e-9  * rDt_ice ! freshwater flux ice/snow-atm (km3) 
     120      zbg(3) = zbg(3) * r1_rho0 * 1.e-9  * rDt_ice ! salt fluxes ice/snow-ocean (km3*pss) 
     121      zbg(4) = zbg(4)           * 1.e-20 * rDt_ice ! heat on top of ice-ocean (1.e20 J) 
     122      zbg(5) = zbg(5)           * 1.e-20 * rDt_ice ! heat on top of ocean (and below ice) (1.e20 J) 
     123      ! cumulative sum 
     124      frc_voltop  = frc_voltop  + zbg(1) 
     125      frc_volbot  = frc_volbot  + zbg(2) 
     126      frc_sal     = frc_sal     + zbg(3) 
     127      frc_temtop  = frc_temtop  + zbg(4) 
     128      frc_tembot  = frc_tembot  + zbg(5) 
     129 
     130      ! change units for contents 
     131      zbg(6)  = zbg(6)  * 1.e-9  ! ice volume (km3) 
     132      zbg(7)  = zbg(7)  * 1.e-9  ! snw volume (km3) 
     133      zbg(8)  = zbg(8)  * 1.e-6  ! ice area (km2) 
     134      zbg(9)  = zbg(9)  * 1.e-9  ! salt content (km3*pss) 
     135      zbg(10) = zbg(10) * 1.e-20 ! ice heat content (1.e20 J) 
     136      zbg(11) = zbg(11) * 1.e-20 ! snw heat content (1.e20 J) 
     137      zbg(12) = zbg(12) * 1.e-9  ! pnd volume (km3) 
     138      zbg(13) = zbg(13) * 1.e-9  ! pnd lid volume (km3) 
     139 
     140      ! change units for trends 
     141      zbg(14) = zbg(14) * r1_rho0 * 1.e-9  ! freshwater trend (km3) 
     142      zbg(15) = zbg(15) * r1_rho0 * 1.e-9  ! salt content trend (km3*pss) 
     143      zbg(16) = zbg(16)           * 1.e-20 ! heat content trend (1.e20 J) 
     144      ! difference 
     145      zbg(14) = zbg(14) - ( frc_voltop + frc_volbot ) 
     146      zbg(15) = zbg(15) -   frc_sal 
     147      zbg(16) = zbg(16) - ( frc_tembot - frc_temtop ) 
     148 
     149      ! outputs 
     150      CALL iom_put( 'ibgfrcvoltop' , frc_voltop )   ! vol  forcing ice/snw-atm          (km3 equivalent ocean water) 
     151      CALL iom_put( 'ibgfrcvolbot' , frc_volbot )   ! vol  forcing ice/snw-ocean        (km3 equivalent ocean water) 
     152      CALL iom_put( 'ibgfrcsal'    , frc_sal    )   ! sal  forcing                      (psu*km3 equivalent ocean water) 
     153      CALL iom_put( 'ibgfrctemtop' , frc_temtop )   ! heat on top of ice/snw/ocean      (1.e20 J) 
     154      CALL iom_put( 'ibgfrctembot' , frc_tembot )   ! heat on top of ocean(below ice)   (1.e20 J) 
     155      CALL iom_put( 'ibgfrchfxtop' , frc_temtop * z1_e1e2 * 1.e-20 * kt*rn_Dt ) ! heat on top of ice/snw/ocean      (W/m2) 
     156      CALL iom_put( 'ibgfrchfxbot' , frc_tembot * z1_e1e2 * 1.e-20 * kt*rn_Dt ) ! heat on top of ocean(below ice)   (W/m2) 
     157 
     158      CALL iom_put( 'ibgvol_tot'  , zbg(6)  ) 
     159      CALL iom_put( 'sbgvol_tot'  , zbg(7)  ) 
     160      CALL iom_put( 'ibgarea_tot' , zbg(8)  ) 
     161      CALL iom_put( 'ibgsalt_tot' , zbg(9)  ) 
     162      CALL iom_put( 'ibgheat_tot' , zbg(10) ) 
     163      CALL iom_put( 'sbgheat_tot' , zbg(11) ) 
     164      CALL iom_put( 'ipbgvol_tot' , zbg(12) ) 
     165      CALL iom_put( 'ilbgvol_tot' , zbg(13) ) 
     166      
     167      CALL iom_put( 'ibgvolume' , zbg(14) )   ! ice/snow volume  drift            (km3 equivalent ocean water) 
     168      CALL iom_put( 'ibgsaltco' , zbg(15) )   ! ice salt content drift            (psu*km3 equivalent ocean water) 
     169      CALL iom_put( 'ibgheatco' , zbg(16) )   ! ice/snow heat content drift       (1.e20 J) 
     170      ! 
     171      ! restarts 
    162172      IF( lrst_ice )   CALL ice_dia_rst( 'WRITE', kt_ice ) 
    163173      ! 
Note: See TracChangeset for help on using the changeset viewer.