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

Changeset 6697


Ignore:
Timestamp:
2016-06-13T17:08:32+02:00 (8 years ago)
Author:
frrh
Message:

Merge corrections for bit reproducibility of ice mass balance coupling fields
from dev_r5518_fix_global_ice revision 6343

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

Legend:

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

    r6498 r6697  
    4949   USE limthd_dh       ! for CALL lim_thd_snwblow 
    5050#endif 
     51   USE lib_fortran, ONLY: glob_sum 
    5152 
    5253   IMPLICIT NONE 
     
    12731274      zepsilon = rn_iceshelf_fluxes_tolerance 
    12741275 
     1276 
     1277      ! See if we need zmask_sum... 
     1278      IF ( srcv(jpr_grnm)%laction .OR. srcv(jpr_antm)%laction ) THEN 
     1279         zmask_sum = glob_sum( tmask(:,:,1) ) 
     1280      ENDIF 
     1281 
    12751282      IF( srcv(jpr_grnm)%laction ) THEN 
    12761283         greenland_icesheet_mass_array(:,:) = frcv(jpr_grnm)%z3(:,:,1) 
    12771284         ! take average over ocean points of input array to avoid cumulative error over time 
    1278          zgreenland_icesheet_mass_in = SUM( greenland_icesheet_mass_array(:,:) * tmask(:,:,1) ) 
    1279          IF(lk_mpp) CALL mpp_sum( zgreenland_icesheet_mass_in ) 
    1280          zmask_sum = SUM( tmask(:,:,1) ) 
    1281          IF(lk_mpp) CALL mpp_sum( zmask_sum )  
     1285 
     1286         ! The following must be bit reproducible over different PE decompositions 
     1287         zgreenland_icesheet_mass_in = glob_sum( greenland_icesheet_mass_array(:,:) * tmask(:,:,1) ) 
     1288 
    12821289         zgreenland_icesheet_mass_in = zgreenland_icesheet_mass_in / zmask_sum 
    12831290         greenland_icesheet_timelapsed = greenland_icesheet_timelapsed + rdt          
     
    13041311         antarctica_icesheet_mass_array(:,:) = frcv(jpr_antm)%z3(:,:,1) 
    13051312         ! take average over ocean points of input array to avoid cumulative error from rounding errors over time 
    1306          zantarctica_icesheet_mass_in = SUM( antarctica_icesheet_mass_array(:,:) * tmask(:,:,1) ) 
    1307          IF(lk_mpp) CALL mpp_sum( zantarctica_icesheet_mass_in ) 
    1308          zmask_sum = SUM( tmask(:,:,1) ) 
    1309          IF(lk_mpp) CALL mpp_sum( zmask_sum )  
     1313         ! The following must be bit reproducible over different PE decompositions 
     1314         zantarctica_icesheet_mass_in = glob_sum( antarctica_icesheet_mass_array(:,:) * tmask(:,:,1) ) 
     1315 
    13101316         zantarctica_icesheet_mass_in = zantarctica_icesheet_mass_in / zmask_sum 
    13111317         antarctica_icesheet_timelapsed = antarctica_icesheet_timelapsed + rdt          
  • branches/UKMO/dev_r5518_GO6_package_MEDUSA_temporary/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90

    r6498 r6697  
    2626   USE zdfbfr 
    2727   USE fldread         ! read input field at current time step 
     28   USE lib_fortran, ONLY: glob_sum 
    2829 
    2930   IMPLICIT NONE 
     
    257258              ! and southern hemispheres equals rate of increase of mass of greenland and antarctic ice sheets 
    258259              ! to preserve total freshwater conservation in coupled models without an active ice sheet model. 
    259  
    260                zgreenland_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
    261                IF( lk_mpp ) CALL mpp_sum( zgreenland_fwfisf_sum ) 
     260  
     261              ! All related global sums must be done bit reproducibly 
     262               zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
     263 
    262264               ! use ABS function because we need to preserve the sign of fwfisf 
    263265               WHERE( greenland_icesheet_mask(:,:) == 1.0 )                                                                  & 
     
    267269               ! check 
    268270               IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting climatology (kg/s) : ',zgreenland_fwfisf_sum 
    269                zgreenland_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
    270                IF( lk_mpp ) CALL mpp_sum( zgreenland_fwfisf_sum ) 
     271 
     272               zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
     273 
    271274               IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting adjusted value (kg/s) : ',zgreenland_fwfisf_sum 
    272275 
    273                zantarctica_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
    274                IF( lk_mpp ) CALL mpp_sum( zantarctica_fwfisf_sum ) 
     276               zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
     277 
    275278               ! use ABS function because we need to preserve the sign of fwfisf 
    276279               WHERE( antarctica_icesheet_mask(:,:) == 1.0 ) & 
     
    280283               ! check 
    281284               IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting climatology (kg/s) : ',zantarctica_fwfisf_sum 
    282                zantarctica_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
    283                IF( lk_mpp ) CALL mpp_sum( zantarctica_fwfisf_sum ) 
     285 
     286               zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
     287 
    284288               IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting adjusted value (kg/s) : ',zantarctica_fwfisf_sum 
    285289 
     
    304308              ! to preserve total freshwater conservation in coupled models without an active ice sheet model. 
    305309 
    306                zgreenland_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
    307                IF( lk_mpp ) CALL mpp_sum( zgreenland_fwfisf_sum ) 
     310              ! All related global sums must be done bit reproducibly 
     311               zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
     312 
    308313               ! use ABS function because we need to preserve the sign of fwfisf 
    309314               WHERE( greenland_icesheet_mask(:,:) == 1.0 )                                                                  & 
     
    313318               ! check 
    314319               IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting climatology (kg/s) : ',zgreenland_fwfisf_sum 
    315                zgreenland_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
    316                IF( lk_mpp ) CALL mpp_sum( zgreenland_fwfisf_sum ) 
     320 
     321               zgreenland_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * greenland_icesheet_mask(:,:) ) 
     322 
    317323               IF(lwp) WRITE(numout, *) 'Greenland iceshelf melting adjusted value (kg/s) : ',zgreenland_fwfisf_sum 
    318324 
    319                zantarctica_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
    320                IF( lk_mpp ) CALL mpp_sum( zantarctica_fwfisf_sum ) 
     325               zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
     326 
    321327               ! use ABS function because we need to preserve the sign of fwfisf 
    322328               WHERE( antarctica_icesheet_mask(:,:) == 1.0 ) & 
     
    326332               ! check 
    327333               IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting climatology (kg/s) : ',zantarctica_fwfisf_sum 
    328                zantarctica_fwfisf_sum = SUM( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
    329                IF( lk_mpp ) CALL mpp_sum( zantarctica_fwfisf_sum ) 
     334 
     335               zantarctica_fwfisf_sum = glob_sum( fwfisf(:,:) * e1t(:,:) * e2t(:,:) * antarctica_icesheet_mask(:,:) ) 
     336 
    330337               IF(lwp) WRITE(numout, *) 'Antarctica iceshelf melting adjusted value (kg/s) : ',zantarctica_fwfisf_sum 
    331338 
Note: See TracChangeset for help on using the changeset viewer.