Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*Reproducing sums for SST_global and SSS_global #11

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ module MOM
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end
use MOM_cpu_clock, only : CLOCK_COMPONENT, CLOCK_SUBCOMPONENT
use MOM_cpu_clock, only : CLOCK_MODULE_DRIVER, CLOCK_MODULE, CLOCK_ROUTINE
use MOM_coms, only : reproducing_sum
use MOM_diag_mediator, only : diag_mediator_init, enable_averaging
use MOM_diag_mediator, only : disable_averaging, post_data, safe_alloc_ptr
use MOM_diag_mediator, only : register_diag_field, register_static_field
Expand Down Expand Up @@ -646,6 +647,7 @@ subroutine step_MOM(fluxes, state, Time_start, time_interval, CS)
h ! h : Layer thickness, in m.
real, dimension(SZI_(CS%G),SZJ_(CS%G),SZK_(CS%G)+1) :: eta_predia
real :: tot_wt_ssh, Itot_wt_ssh, I_time_int
real, dimension(SZI_(CS%G),SZJ_(CS%G)) :: tmpForSumming
real :: SST_global, SSS_global
type(time_type) :: Time_local
integer :: pid_tau, pid_ustar, pid_psurf, pid_u, pid_h
Expand Down Expand Up @@ -1318,22 +1320,20 @@ subroutine step_MOM(fluxes, state, Time_start, time_interval, CS)
endif

if (CS%id_sst_global > 0) then
SST_global = 0.0
tmpForSumming(:,:) = 0.
do j=js,je ; do i=is, ie
SST_global = SST_global + ( 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
call sum_across_PEs( SST_global )
SST_global = SST_global * G%IareaT_global
SST_global = reproducing_sum( tmpForSumming ) * G%IareaT_global
call post_data(CS%id_sst_global, SST_global, CS%diag)
endif

if (CS%id_sss_global > 0) then
SSS_global = 0.0
tmpForSumming(:,:) = 0.
do j=js,je ; do i=is, ie
SSS_global = SSS_global + ( 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
call sum_across_PEs( SSS_global )
SSS_global = SSS_global * G%IareaT_global
SSS_global = reproducing_sum( tmpForSumming ) * G%IareaT_global
call post_data(CS%id_sss_global, SSS_global, CS%diag)
endif

Expand Down