Skip to content

Commit

Permalink
Avoid id collisions between dynamics and physics grids
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanchihwang committed Apr 30, 2024
1 parent e47f906 commit d40ff0e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/dynamics/mpas/dyn_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module dyn_grid
use dyn_comp, only: dyn_debug_print, mpas_dynamical_core
use dynconst, only: dynconst_init, pi
use physics_column_type, only: kind_pcol, physics_column_t
use physics_grid, only: phys_grid_init
use physics_grid, only: phys_decomp, phys_grid_init
use ref_pres, only: ref_pres_init
use spmd_utils, only: iam
use std_atm_profile, only: std_atm_pres
Expand Down Expand Up @@ -460,12 +460,13 @@ pure function dyn_grid_id(name)
character(*), intent(in) :: name
integer :: dyn_grid_id

integer, parameter :: dyn_grid_id_offset = 0
integer :: i

do i = 1, size(dyn_grid_name)
if (trim(adjustl(dyn_grid_name(i))) == trim(adjustl(name))) then
dyn_grid_id = dyn_grid_id_offset + i
! Grid ids count from `phys_decomp` + 1.
! This avoids id collisions between dynamics and physics grids.
dyn_grid_id = phys_decomp + i

return
end if
Expand Down

0 comments on commit d40ff0e

Please sign in to comment.