Ignore:
Timestamp:
2019-12-18T16:42:19+01:00 (11 months ago)
Author:
mathiot
Message:

fix icb reproducibility (ticket #2238)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r12072_MERGE_OPTION2_2019/src/OCE/ICB/icbthm.F90

    r10068 r12275  
    2020   USE phycst         ! NEMO physical constants 
    2121   USE sbc_oce 
     22   USE lib_fortran, ONLY : DDPDD 
    2223 
    2324   USE icb_oce        ! define iceberg arrays 
     
    5556      TYPE(iceberg), POINTER ::   this, next 
    5657      TYPE(point)  , POINTER ::   pt 
     58      ! 
     59      COMPLEX(wp), DIMENSION(jpi,jpj) :: cicb_melt, cicb_hflx 
    5760      !!---------------------------------------------------------------------- 
     61      ! 
     62      !! initialiaze cicb_melt and cicb_heat 
     63      cicb_melt = CMPLX( 0.e0, 0.e0, wp )  
     64      cicb_hflx = CMPLX( 0.e0, 0.e0, wp )  
    5865      ! 
    5966      z1_rday = 1._wp / rday 
     
    165172            z1_e1e2    = r1_e1e2t(ii,ij) * this%mass_scaling 
    166173            z1_dt_e1e2 = z1_dt * z1_e1e2 
     174            ! 
     175            ! iceberg melt 
     176            !! the use of DDPDD function for the cumulative sum is needed for reproducibility 
    167177            zmelt    = ( zdM - ( zdMbitsE - zdMbitsM ) ) * z1_dt   ! kg/s 
    168             berg_grid%floating_melt(ii,ij) = berg_grid%floating_melt(ii,ij) + zmelt    * z1_e1e2    ! kg/m2/s 
     178            CALL DDPDD( CMPLX( zmelt * z1_e1e2, 0.e0, wp ), cicb_melt(ii,ij) ) 
     179            ! 
     180            ! iceberg heat flux 
     181            !! the use of DDPDD function for the cumulative sum is needed for reproducibility 
    169182            !! NB. The src_calving_hflx field is currently hardwired to zero in icb_stp, which means that the 
    170183            !!     heat density of the icebergs is zero and the heat content flux to the ocean from iceberg 
     
    172185            zheat_hcflux = zmelt * pt%heat_density       ! heat content flux : kg/s x J/kg = J/s 
    173186            zheat_latent = - zmelt * rLfus               ! latent heat flux:  kg/s x J/kg = J/s 
    174             berg_grid%calving_hflx (ii,ij) = berg_grid%calving_hflx (ii,ij) + ( zheat_hcflux + zheat_latent ) * z1_e1e2    ! W/m2 
     187            CALL DDPDD( CMPLX( ( zheat_hcflux + zheat_latent ) * z1_e1e2, 0.e0, wp ), cicb_hflx(ii,ij) ) 
     188            ! 
     189            ! diagnostics 
    175190            CALL icb_dia_melt( ii, ij, zMnew, zheat_hcflux, zheat_latent, this%mass_scaling,       & 
    176191               &                       zdM, zdMbitsE, zdMbitsM, zdMb, zdMe,   & 
     
    214229         ! 
    215230      END DO 
    216  
     231      ! 
     232      berg_grid%floating_melt = REAL(cicb_melt,wp)    ! kg/m2/s 
     233      berg_grid%calving_hflx  = REAL(cicb_hflx,wp) 
     234      ! 
    217235      ! now use melt and associated heat flux in ocean (or not) 
    218236      ! 
Note: See TracChangeset for help on using the changeset viewer.