Skip to content

Commit

Permalink
Merge pull request #2436 from GEOS-ESM/feature/wjiang/change_grid_is_ok
Browse files Browse the repository at this point in the history
avoid collective call inside subroutine MAPL_GetGlobalHorzIJIndex
  • Loading branch information
tclune committed Oct 31, 2023
2 parents 57429a5 + f2f8e00 commit 3211d11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Change the verification of the grid in MAPL_GetGlobalHorzIJIndex to avoid collective call

### Fixed

### Removed
Expand Down
12 changes: 7 additions & 5 deletions base/Base/Base_Base_implementation.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3210,17 +3210,19 @@ function grid_is_ok(grid) result(OK)
type(ESMF_Grid), intent(inout) :: grid
logical :: OK
integer :: I1, I2, J1, J2, j
real(ESMF_KIND_R8), allocatable :: corner_lons(:,:), corner_lats(:,:)
real(ESMF_KIND_R8), pointer :: corner_lons(:,:), corner_lats(:,:)
real(ESMF_KIND_R8) :: accurate_lat, accurate_lon
real :: tolerance

tolerance = epsilon(1.0)
call MAPL_GridGetInterior(grid,I1,I2,J1,J2)
OK = .true.
! check the edge of face 1 along longitude
allocate(corner_lons(I2-I1+2, J2-J1+2))
allocate(corner_lats(I2-I1+2, J2-J1+2))
call MAPL_GridGetCorners(Grid,corner_lons,corner_lats)
call ESMF_GridGetCoord(grid,localDE=0,coordDim=1,staggerloc=ESMF_STAGGERLOC_CORNER, &
farrayPtr=corner_lons, rc=status)
call ESMF_GridGetCoord(grid,localDE=0,coordDim=2,staggerloc=ESMF_STAGGERLOC_CORNER, &
farrayPtr=corner_lats, rc=status)

if ( I1 ==1 .and. J2<=IM_WORLD ) then
if (J1 == 1) then
accurate_lon = 1.750d0*MAPL_PI_R8 - shift
Expand All @@ -3233,7 +3235,7 @@ function grid_is_ok(grid) result(OK)
endif
endif

do j = J1, J2+1
do j = J1+1, J2
accurate_lat = -alpha + (j-1)*dalpha
if ( abs(accurate_lat - corner_lats(1,j-J1+1)) > 5.0*tolerance) then
print*, "accurate_lat: ", accurate_lat
Expand Down

0 comments on commit 3211d11

Please sign in to comment.