pure subroutine evp_mi_face_impl(mis, mi_u, mi_v, nx, ny)
!! `mi_u(i,j) = 0.5*(mis(i-1,j)+mis(i,j))`; `mi_v(i,j) =
!! 0.5*(mis(i,j-1)+mis(i,j))` (SIS2 :967-974, rdb index
!! translation §1). Array-edge faces (`i=1`/`i=nx+1`, `j=1`/
!! `j=ny+1`) have no neighbour on one side; `mis` at those ghost
!! rows/cols was already periodic-wrapped or zeroed, so a naive
!! `mis(i-1,j)`/`mis(i,j)` read is always in-bounds here EXCEPT at
!! the two hard array edges themselves — those faces are handled
!! explicitly.
integer, intent(in) :: nx, ny
real(wp), intent(in) :: mis(nx, ny)
real(wp), intent(out) :: mi_u(nx + 1, ny)
real(wp), intent(out) :: mi_v(nx, ny + 1)
integer :: i, j
do concurrent(j=1:ny, i=1:nx + 1)
if (i == 1) then
mi_u(i, j) = 0.5_wp*mis(1, j)
else if (i == nx + 1) then
mi_u(i, j) = 0.5_wp*mis(nx, j)
else
mi_u(i, j) = 0.5_wp*(mis(i - 1, j) + mis(i, j))
end if
end do
do concurrent(j=1:ny + 1, i=1:nx)
if (j == 1) then
mi_v(i, j) = 0.5_wp*mis(i, 1)
else if (j == ny + 1) then
mi_v(i, j) = 0.5_wp*mis(i, ny)
else
mi_v(i, j) = 0.5_wp*(mis(i, j - 1) + mis(i, j))
end if
end do
end subroutine evp_mi_face_impl