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 6343 – NEMO

Changeset 6343


Ignore:
Timestamp:
2016-02-23T10:36:53+01:00 (8 years ago)
Author:
frrh
Message:

Commit working version demonstrating bit comparable results over different PE
decompositions.

Here we use the function "glob_sum" to ensure bit reproducible
global summation and we rejig the code slightly to avoid
duplicating the summation of the mask varaiable.

This simplifies the code slightly too because we no longer have to
do local sums followed by a global sum, we just have a single call
top glob_sum in each case.

Location:
branches/UKMO/dev_r5518_fix_global_ice/NEMOGCM/NEMO/OPA_SRC/SBC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_fix_global_ice/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90

    r6342 r6343  
    4949   USE limthd_dh       ! for CALL lim_thd_snwblow 
    5050#endif 
     51   USE lib_fortran, ONLY: glob_sum 
    5152 
    5253   IMPLICIT NONE 
     
    12711272      zepsilon = rn_iceshelf_fluxes_tolerance 
    12721273 
     1274 
     1275      ! See if we need zmask_sum... 
     1276      IF ( srcv(jpr_grnm)%laction .OR. srcv(jpr_antm)%laction ) THEN 
     1277         zmask_sum = glob_sum( tmask(:,:,1) ) 
     1278      ENDIF 
     1279 
    12731280      IF( srcv(jpr_grnm)%laction ) THEN 
    12741281         greenland_icesheet_mass_array(:,:) = frcv(jpr_grnm)%z3(:,:,1) 
    12751282         ! take average over ocean points of input array to avoid cumulative error over time 
    1276          zgreenland_icesheet_mass_in = SUM( greenland_icesheet_mass_array(:,:) * tmask(:,:,1) ) 
    1277          IF(lk_mpp) CALL mpp_sum( zgreenland_icesheet_mass_in ) 
    1278          zmask_sum = SUM( tmask(:,:,1) ) 
    1279          IF(lk_mpp) CALL mpp_sum( zmask_sum )  
     1283 
     1284         ! The following must be bit reproducible over different PE decompositions 
     1285         zgreenland_icesheet_mass_in = glob_sum( greenland_icesheet_mass_array(:,:) * tmask(:,:,1) ) 
     1286 
    12801287         zgreenland_icesheet_mass_in = zgreenland_icesheet_mass_in / zmask_sum 
    12811288         greenland_icesheet_timelapsed = greenland_icesheet_timelapsed + rdt          
     
    13021309         antarctica_icesheet_mass_array(:,:) = frcv(jpr_antm)%z3(:,:,1) 
    13031310         ! take average over ocean points of input array to avoid cumulative error from rounding errors over time 
    1304          zantarctica_icesheet_mass_in = SUM( antarctica_icesheet_mass_array(:,:) * tmask(:,:,1) ) 
    1305          IF(lk_mpp) CALL mpp_sum( zantarctica_icesheet_mass_in ) 
    1306          zmask_sum = SUM( tmask(:,:,1) ) 
    1307          IF(lk_mpp) CALL mpp_sum( zmask_sum )  
     1311         ! The following must be bit reproducible over different PE decompositions 
     1312         zantarctica_icesheet_mass_in = glob_sum( antarctica_icesheet_mass_array(:,:) * tmask(:,:,1) ) 
     1313 
    13081314         zantarctica_icesheet_mass_in = zantarctica_icesheet_mass_in / zmask_sum 
    13091315         antarctica_icesheet_timelapsed = antarctica_icesheet_timelapsed + rdt          
  • branches/UKMO/dev_r5518_fix_global_ice/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90

    r6342 r6343  
    2626   USE zdfbfr 
    2727   USE fldread         ! read input field at current time step 
     28   USE lib_fortran, ONLY: glob_sum 
    2829 
    2930   IMPLICIT NONE 
     
    263264              ! and southern hemispheres equals rate of increase of mass of greenland and antarctic ice sheets 
    264265              ! to preserve total freshwater conservation in coupled models without an active ice sheet model. 
    265  
    266                zgreenland_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
    267                IF( lk_mpp ) CALL mpp_sum( zgreenland_fwfisf_sum ) 
     266  
     267              ! All related global sums must be done bit reproducibly 
     268               zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
     269 
    268270               ! use ABS function because we need to preserve the sign of fwfisf 
    269271               WHERE( greenland_icesheet_mask(:,:) == 1.0 )                                                                  & 
     
    273275               ! check 
    274276               IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting climatology (kg/s) : ',zgreenland_fwfisf_sum 
    275                zgreenland_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
    276                IF( lk_mpp ) CALL mpp_sum( zgreenland_fwfisf_sum ) 
     277 
     278               zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
     279 
    277280               IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting adjusted value (kg/s) : ',zgreenland_fwfisf_sum 
    278281 
    279                zantarctica_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
    280                IF( lk_mpp ) CALL mpp_sum( zantarctica_fwfisf_sum ) 
     282               zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
     283 
    281284               ! use ABS function because we need to preserve the sign of fwfisf 
    282285               WHERE( antarctica_icesheet_mask(:,:) == 1.0 ) & 
     
    286289               ! check 
    287290               IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting climatology (kg/s) : ',zantarctica_fwfisf_sum 
    288                zantarctica_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
    289                IF( lk_mpp ) CALL mpp_sum( zantarctica_fwfisf_sum ) 
     291 
     292               zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
     293 
    290294               IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting adjusted value (kg/s) : ',zantarctica_fwfisf_sum 
    291295 
     
    310314              ! to preserve total freshwater conservation in coupled models without an active ice sheet model. 
    311315 
    312                zgreenland_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
    313                IF( lk_mpp ) CALL mpp_sum( zgreenland_fwfisf_sum ) 
     316              ! All related global sums must be done bit reproducibly 
     317               zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
     318 
    314319               ! use ABS function because we need to preserve the sign of fwfisf 
    315320               WHERE( greenland_icesheet_mask(:,:) == 1.0 )                                                                  & 
     
    319324               ! check 
    320325               IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting climatology (kg/s) : ',zgreenland_fwfisf_sum 
    321                zgreenland_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
    322                IF( lk_mpp ) CALL mpp_sum( zgreenland_fwfisf_sum ) 
     326 
     327               zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
     328 
    323329               IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting adjusted value (kg/s) : ',zgreenland_fwfisf_sum 
    324330 
    325                zantarctica_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
    326                IF( lk_mpp ) CALL mpp_sum( zantarctica_fwfisf_sum ) 
     331               zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
     332 
    327333               ! use ABS function because we need to preserve the sign of fwfisf 
    328334               WHERE( antarctica_icesheet_mask(:,:) == 1.0 ) & 
     
    332338               ! check 
    333339               IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting climatology (kg/s) : ',zantarctica_fwfisf_sum 
    334                zantarctica_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
    335                IF( lk_mpp ) CALL mpp_sum( zantarctica_fwfisf_sum ) 
     340 
     341               zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
     342 
    336343               IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting adjusted value (kg/s) : ',zantarctica_fwfisf_sum 
    337344 
Note: See TracChangeset for help on using the changeset viewer.