From 199a453126373c0935caf29f9a78cde3b4d382a1 Mon Sep 17 00:00:00 2001 From: Robert Hallberg Date: Sat, 30 Jan 2021 10:46:55 -0500 Subject: [PATCH] (*)Corrected bug in field_chksum When the field_chksum interfaces was added, it returned integers, but the set of mpp_chksum routines from FMS it wraps return 64-bit integers, not 32-bit integers. For small domain sizes (like in the TC tests) this is not a problem, but for much larger problems (like tides_025), this results in a truncation of the results and a change in the checksums, which in turn causes the model to fail if it tries to read a depth-list file. This commit restores the model behavior prior to MOM6 PR#1299 (commit# 797b1958..). All answers are bitwise identical in cases that worked with the previous version of the code, but some depth-list files that were created with MOM6 code after that commit may have incorrect verification checksums that lead to spurious fatal errors and should be deleted. --- src/framework/MOM_coms_infra.F90 | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/framework/MOM_coms_infra.F90 b/src/framework/MOM_coms_infra.F90 index f83785dd7b..e204b753f6 100644 --- a/src/framework/MOM_coms_infra.F90 +++ b/src/framework/MOM_coms_infra.F90 @@ -236,10 +236,10 @@ end subroutine broadcast_real2D !> Compute a checksum for a field distributed over a PE list. If no PE list is !! provided, then the current active PE list is used. function field_chksum_real_0d(field, pelist, mask_val) result(chksum) - real, intent(in) :: field !< Input scalar + real, intent(in) :: field !< Input scalar integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum - real, optional, intent(in) :: mask_val !< FMS mask value - integer :: chksum !< checksum of array + real, optional, intent(in) :: mask_val !< FMS mask value + integer(kind=int64) :: chksum !< checksum of array chksum = mpp_chksum(field, pelist, mask_val) end function field_chksum_real_0d @@ -248,9 +248,9 @@ end function field_chksum_real_0d !! provided, then the current active PE list is used. function field_chksum_real_1d(field, pelist, mask_val) result(chksum) real, dimension(:), intent(in) :: field !< Input array - integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum - real, optional, intent(in) :: mask_val !< FMS mask value - integer :: chksum !< checksum of array + integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum + real, optional, intent(in) :: mask_val !< FMS mask value + integer(kind=int64) :: chksum !< checksum of array chksum = mpp_chksum(field, pelist, mask_val) end function field_chksum_real_1d @@ -258,10 +258,10 @@ end function field_chksum_real_1d !> Compute a checksum for a field distributed over a PE list. If no PE list is !! provided, then the current active PE list is used. function field_chksum_real_2d(field, pelist, mask_val) result(chksum) - real, dimension(:,:), intent(in) :: field !< Unrotated input field - integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum - real, optional, intent(in) :: mask_val !< FMS mask value - integer :: chksum !< checksum of array + real, dimension(:,:), intent(in) :: field !< Unrotated input field + integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum + real, optional, intent(in) :: mask_val !< FMS mask value + integer(kind=int64) :: chksum !< checksum of array chksum = mpp_chksum(field, pelist, mask_val) end function field_chksum_real_2d @@ -269,10 +269,10 @@ end function field_chksum_real_2d !> Compute a checksum for a field distributed over a PE list. If no PE list is !! provided, then the current active PE list is used. function field_chksum_real_3d(field, pelist, mask_val) result(chksum) - real, dimension(:,:,:), intent(in) :: field !< Unrotated input field - integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum - real, optional, intent(in) :: mask_val !< FMS mask value - integer :: chksum !< checksum of array + real, dimension(:,:,:), intent(in) :: field !< Unrotated input field + integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum + real, optional, intent(in) :: mask_val !< FMS mask value + integer(kind=int64) :: chksum !< checksum of array chksum = mpp_chksum(field, pelist, mask_val) end function field_chksum_real_3d @@ -280,10 +280,10 @@ end function field_chksum_real_3d !> Compute a checksum for a field distributed over a PE list. If no PE list is !! provided, then the current active PE list is used. function field_chksum_real_4d(field, pelist, mask_val) result(chksum) - real, dimension(:,:,:,:), intent(in) :: field !< Unrotated input field - integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum - real, optional, intent(in) :: mask_val !< FMS mask value - integer :: chksum !< checksum of array + real, dimension(:,:,:,:), intent(in) :: field !< Unrotated input field + integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum + real, optional, intent(in) :: mask_val !< FMS mask value + integer(kind=int64) :: chksum !< checksum of array chksum = mpp_chksum(field, pelist, mask_val) end function field_chksum_real_4d