In physics/mpas_atmphys_interface.F, the variables ‘z_p’ and ‘w_p’ are allocated for ‘kms:kme’ in the vertical dimension.
97 if(.not.allocated(z_p) ) allocate(z_p(ims:ime,kms:kme,jms:jme) )
107 if(.not.allocated(w_p) ) allocate(w_p(ims:ime,kms:kme,jms:jme) )
But shouldn't these layer interface variables instead be allocated as ‘kms:kme+1’ (or kts:kte+1)? The following do loop later in the code confirms this (do k = kts,kte+1):
435 !arrays located at w points:
436 do j = jts, jte
437 do k = kts,kte+1
438 do i = its,ite
439 w_p(i,k,j) = w(k,i)
440 z_p(i,k,j) = zgrid(k,i)
441 enddo
442 enddo
443 enddo
97 if(.not.allocated(z_p) ) allocate(z_p(ims:ime,kms:kme,jms:jme) )
107 if(.not.allocated(w_p) ) allocate(w_p(ims:ime,kms:kme,jms:jme) )
But shouldn't these layer interface variables instead be allocated as ‘kms:kme+1’ (or kts:kte+1)? The following do loop later in the code confirms this (do k = kts,kte+1):
435 !arrays located at w points:
436 do j = jts, jte
437 do k = kts,kte+1
438 do i = its,ite
439 w_p(i,k,j) = w(k,i)
440 z_p(i,k,j) = zgrid(k,i)
441 enddo
442 enddo
443 enddo