subroutine xT_periodic use modglobal, only : ib, ie, ih, ihc use modfields, only : thl0, thlm, thl0c integer m do m = 1, ih thl0(ib - m, :, :) = thl0(ie + 1 - m, :, :) thl0(ie + m, :, :) = thl0(ib - 1 + m, :, :) thlm(ib - m, :, :) = thlm(ie + 1 - m, :, :) thlm(ie + m, :, :) = thlm(ib - 1 + m, :, :) end do do m = 1, ihc thl0c(ib - m, :, :) = thl0c(ie + 1 - m, :, :) thl0c(ie + m, :, :) = thl0c(ib - 1 + m, :, :) end do return end subroutine xT_periodic