Skip to content
Merged
Show file tree
Hide file tree
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
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