diff --git a/model/fv_grid_utils.F90 b/model/fv_grid_utils.F90 index 9e150859a..ef8af8239 100644 --- a/model/fv_grid_utils.F90 +++ b/model/fv_grid_utils.F90 @@ -215,18 +215,6 @@ subroutine grid_utils_init(Atm, npx, npy, npz, non_ortho, grid_type, c2l_order) cos_sg(:,:,:) = big_number sin_sg(:,:,:) = tiny_number - sw_corner = .false. - se_corner = .false. - ne_corner = .false. - nw_corner = .false. - - if (grid_type < 3 .and. .not. Atm%gridstruct%bounded_domain) then - if ( is==1 .and. js==1 ) sw_corner = .true. - if ( (ie+1)==npx .and. js==1 ) se_corner = .true. - if ( (ie+1)==npx .and. (je+1)==npy ) ne_corner = .true. - if ( is==1 .and. (je+1)==npy ) nw_corner = .true. - endif - if ( sw_corner ) then tmp1 = great_circle_dist(grid(1,1,1:2), agrid(1,1,1:2)) tmp2 = great_circle_dist(grid(1,1,1:2), agrid(2,2,1:2)) diff --git a/tools/fv_grid_tools.F90 b/tools/fv_grid_tools.F90 index 3eae83358..5d0f955cc 100644 --- a/tools/fv_grid_tools.F90 +++ b/tools/fv_grid_tools.F90 @@ -565,6 +565,18 @@ subroutine init_grid(Atm, grid_name, grid_file, npx, npy, npz, ndims, nregions, latlon = .false. cubed_sphere = .false. + ! set corner flags + sw_corner = .false. + se_corner = .false. + ne_corner = .false. + nw_corner = .false. + if (Atm%flagstruct%grid_type < 3 .and. .not. Atm%gridstruct%bounded_domain) then + if ( is==1 .and. js==1 ) sw_corner = .true. + if ( (ie+1)==npx .and. js==1 ) se_corner = .true. + if ( (ie+1)==npx .and. (je+1)==npy ) ne_corner = .true. + if ( is==1 .and. (je+1)==npy ) nw_corner = .true. + endif + if ( (Atm%flagstruct%do_schmidt .or. Atm%flagstruct%do_cube_transform) .and. abs(atm%flagstruct%stretch_fac-1.) > 1.E-5 ) then stretched_grid = .true. if (Atm%flagstruct%do_schmidt .and. Atm%flagstruct%do_cube_transform) then