Skip to content

Commit

Permalink
*Reproducing sums for SST_global and SSS_global
Browse files Browse the repository at this point in the history
- Uses reproducing_sum() subroutine for global area, SST_global,
  and SSS_global
- Use this commit instead of debafa1
  • Loading branch information
jkrasting committed Apr 14, 2014
1 parent debafa1 commit 022fae2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ subroutine step_MOM(fluxes, state, Time_start, time_interval, CS)
if (CS%id_sst_global > 0) then
tmpForSumming(:,:) = 0.
do j=js,je ; do i=is, ie
tmpForSumming(i,j) = ( state%SST(i,j) * G%areaT(i,j) * G%mask2dT(i,j) )
tmpForSumming(i,j) = ( state%SST(i,j) * (G%areaT(i,j) * G%mask2dT(i,j)) )
enddo ; enddo
SST_global = reproducing_sum( tmpForSumming ) * G%IareaT_global
call post_data(CS%id_sst_global, SST_global, CS%diag)
Expand All @@ -1331,10 +1331,11 @@ subroutine step_MOM(fluxes, state, Time_start, time_interval, CS)
if (CS%id_sss_global > 0) then
tmpForSumming(:,:) = 0.
do j=js,je ; do i=is, ie
tmpForSumming(i,j) = ( state%SSS(i,j) * G%areaT(i,j) * G%mask2dT(i,j) )
tmpForSumming(i,j) = ( state%SSS(i,j) * (G%areaT(i,j) * G%mask2dT(i,j)) )
enddo ; enddo
SSS_global = reproducing_sum( tmpForSumming ) * G%IareaT_global
call post_data(CS%id_sss_global, SSS_global, CS%diag)
if (is_root_pe()) write (*,*) ' GLOBAL SSS = ', SSS_global

This comment has been minimized.

Copy link
@jkrasting

jkrasting Apr 15, 2014

Author Contributor

I left this line in by accident ... if/when merged with dev/master, please delete.

This comment has been minimized.

Copy link
@adcroft

adcroft Apr 15, 2014

Collaborator

You can update the code/branch and the pull request will automatically move to the revised code. I'll wait....

This comment has been minimized.

Copy link
@jkrasting

jkrasting Apr 15, 2014

Author Contributor

OK ... this is corrected in commit ab145f0

endif

if (CS%id_sss > 0) &
Expand Down
8 changes: 5 additions & 3 deletions src/initialization/MOM_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module MOM_initialization


use MOM_checksums, only : hchksum, qchksum, uchksum, vchksum, chksum
use MOM_coms, only : max_across_PEs, min_across_PEs
use MOM_coms, only : max_across_PEs, min_across_PEs, reproducing_sum
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end
use MOM_cpu_clock, only : CLOCK_ROUTINE, CLOCK_LOOP
use MOM_domains, only : pass_var, pass_vector, sum_across_PEs, broadcast
Expand Down Expand Up @@ -3236,12 +3236,14 @@ subroutine compute_global_grid_integrals(G)
! Subroutine to pre-compute global integrals of grid quantities for
! later use in reporting diagnostics
integer :: i,j
real, dimension(G%isc:G%iec,G%jsc:G%jec) :: tmpForSumming

G%areaT_global = 0.0 ; G%IareaT_global = 0.0
tmpForSumming(:,:) = 0.
do j=G%jsc,G%jec ; do i=G%isc,G%iec
G%areaT_global = G%areaT_global + ( G%areaT(i,j) * G%mask2dT(i,j) )
tmpForSumming(i,j) = G%areaT(i,j) * G%mask2dT(i,j)
enddo ; enddo
call sum_across_PEs( G%areaT_global )
G%areaT_global = reproducing_sum( tmpForSumming )
G%IareaT_global = 1. / G%areaT_global
end subroutine compute_global_grid_integrals

Expand Down

0 comments on commit 022fae2

Please sign in to comment.