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

G%areaT_global calculation with reproducing_sum() #467

Merged
merged 2 commits into from
Apr 13, 2017
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
8 changes: 5 additions & 3 deletions src/initialization/MOM_shared_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module MOM_shared_initialization

! This file is part of MOM6. See LICENSE.md for the license.

use MOM_coms, only : max_across_PEs
use MOM_coms, only : max_across_PEs, reproducing_sum
use MOM_domains, only : pass_var, pass_vector, sum_across_PEs, broadcast
use MOM_domains, only : root_PE, To_All, SCALAR_PAIR, CGRID_NE, AGRID
use MOM_dyn_horgrid, only : dyn_horgrid_type
Expand Down Expand Up @@ -1044,13 +1044,15 @@ subroutine compute_global_grid_integrals(G)
type(dyn_horgrid_type), intent(inout) :: G !< The dynamic horizontal grid
! Subroutine to pre-compute global integrals of grid quantities for
! later use in reporting diagnostics
real, dimension(G%isc:G%iec, G%jsc:G%jec) :: tmpForSumming
integer :: i,j

tmpForSumming(:,:) = 0.
G%areaT_global = 0.0 ; G%IareaT_global = 0.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)

if (G%areaT_global == 0.0) &
call MOM_error(FATAL, "compute_global_grid_integrals: "//&
Expand Down
8 changes: 5 additions & 3 deletions src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module MOM_state_initialization
! This file is part of MOM6. See LICENSE.md for the license.

use MOM_debugging, only : hchksum, qchksum, uvchksum
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 @@ -1560,13 +1560,15 @@ subroutine compute_global_grid_integrals(G)
type(ocean_grid_type), intent(inout) :: G
! Subroutine to pre-compute global integrals of grid quantities for
! later use in reporting diagnostics
real, dimension(G%isc:G%iec, G%jsc:G%jec) :: tmpForSumming
integer :: i,j

tmpForSumming(:,:) = 0.
G%areaT_global = 0.0 ; G%IareaT_global = 0.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