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 12032 for NEMO/branches/2019/ENHANCE-02_ISF_nemo/src – NEMO

Ignore:
Timestamp:
2019-12-02T19:08:44+01:00 (5 years ago)
Author:
mathiot
Message:

ENHANCE-02_ISF_nemo: improve isf debug with a basic checksum

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/ISF/isfutils.F90

    r11987 r12032  
    1515   USE lib_fortran   , ONLY: glob_sum, glob_min, glob_max             ! compute global value 
    1616   USE par_oce       , ONLY: jpi,jpj,jpk                              ! domain size 
    17    USE in_out_manager, ONLY: wp, lwp, numout                          ! miscelenious 
     17   USE dom_oce       , ONLY: nldi, nlei, nldj, nlej                   ! local domain 
     18   USE in_out_manager, ONLY: i8, wp, lwp, numout                          ! miscelenious 
     19   USE lib_mpp 
    1820 
    1921   IMPLICIT NONE 
     
    6062      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) :: pvar 
    6163      !!-------------------------------------------------------------------- 
    62       REAL(wp) :: zmin, zmax, zsum 
     64      REAL(wp)    :: zmin, zmax, zsum 
     65      INTEGER(i8) :: imodd, ip 
     66      INTEGER     :: itmps,imods, ji, jj, jk 
    6367      !!-------------------------------------------------------------------- 
    6468      ! 
     69      ! global min/max/sum to check data range and NaN 
    6570      zsum = glob_sum( 'debug', pvar(:,:) ) 
    6671      zmin = glob_min( 'debug', pvar(:,:) ) 
    6772      zmax = glob_max( 'debug', pvar(:,:) ) 
    6873      ! 
    69       IF (lwp) WRITE(numout,*) TRIM(cdtxt),' (min, max, sum) : ',zmin, zmax, zsum 
     74      ! basic check sum to check reproducibility 
     75      ! TRANSFER function find out the integer corresponding to pvar(i,j) bit pattern 
     76      ! MOD allow us to keep only the latest digits during the sum 
     77      ! imod is not choosen to be very large as at the end there is a classic mpp_sum 
     78      imodd=65521 ! highest prime number < 2**16 with i8 type 
     79      imods=65521 ! highest prime number < 2**16 with default integer for mpp_sum subroutine 
     80      itmps=0 
     81      DO jj=nldj,nlej 
     82         DO ji=nldi,nlei 
     83            itmps = MOD(itmps + MOD(TRANSFER(pvar(ji,jj), ip),imodd), imods) 
     84         END DO 
     85      END DO 
     86      CALL mpp_sum('debug',itmps) 
     87      ! 
     88      ! print out 
     89      IF (lwp) WRITE(numout,*) TRIM(cdtxt),' (min, max, sum, tag) : ',zmin, zmax, zsum, itmps 
    7090      ! 
    7191      CALL FLUSH(numout) 
     
    84104      !!-------------------------------------------------------------------- 
    85105      REAL(wp) :: zmin, zmax, zsum 
     106      INTEGER(i8) :: imodd, ip 
     107      INTEGER     :: itmps,imods, ji, jj, jk 
    86108      !!-------------------------------------------------------------------- 
    87109      ! 
     110      ! global min/max/sum to check data range and NaN 
    88111      zsum = glob_sum( 'debug', pvar(:,:,:) ) 
    89112      zmin = glob_min( 'debug', pvar(:,:,:) ) 
    90113      zmax = glob_max( 'debug', pvar(:,:,:) ) 
    91114      ! 
    92       IF (lwp) WRITE(numout,*) TRIM(cdtxt),' (min, max, sum) : ',zmin, zmax, zsum 
     115      ! basic check sum to check reproducibility 
     116      ! TRANSFER function find out the integer corresponding to pvar(i,j) bit pattern 
     117      ! MOD allow us to keep only the latest digits during the sum 
     118      ! imod is not choosen to be very large as at the end there is a classic mpp_sum 
     119      imodd=65521 ! highest prime number < 2**16 with i8 type 
     120      imods=65521 ! highest prime number < 2**16 with default integer for mpp_sum subroutine 
     121      itmps=0 
     122      DO jk=1,jpk 
     123         DO jj=nldj,nlej 
     124            DO ji=nldi,nlei 
     125               itmps = MOD(itmps + MOD(TRANSFER(pvar(ji,jj,jk), ip),imodd), imods) 
     126            END DO 
     127         END DO 
     128      END DO 
     129      CALL mpp_sum('debug',itmps) 
     130      ! 
     131      ! print out 
     132      IF (lwp) WRITE(numout,*) TRIM(cdtxt),' (min, max, sum, tag) : ',zmin, zmax, zsum, itmps 
    93133      ! 
    94134      CALL FLUSH(numout) 
     
    97137 
    98138END MODULE isfutils 
    99  
Note: See TracChangeset for help on using the changeset viewer.