subroutine halos use modglobal, only : ib, ie, ih, jb, je, jh, kb, ke, kh, ihc, jhc, khc, nsv, & BCxm, BCym, BCxT, BCyT, BCxq, BCyq, BCxs, BCys, & BCxm_periodic, BCxT_periodic, BCxq_periodic, BCxs_periodic, & BCym_periodic, BCyT_periodic, BCyq_periodic, BCys_periodic, & ibrank, ierank, jbrank, jerank use modfields, only : u0, v0, w0, um, vm, wm, thl0, thlm, qt0, qtm, sv0, svm, thl0c use decomp_2d, only : exchange_halo_z implicit none integer i, k, n call exchange_halo_z(u0) call exchange_halo_z(v0) call exchange_halo_z(w0) call exchange_halo_z(um) call exchange_halo_z(vm) call exchange_halo_z(wm) call exchange_halo_z(thl0) call exchange_halo_z(thlm) call exchange_halo_z(thl0c, opt_zlevel=(/ihc,jhc,khc/)) call exchange_halo_z(qt0) call exchange_halo_z(qtm) do n = 1, nsv call exchange_halo_z(sv0(:, :, :, n), opt_zlevel=(/ihc,jhc,khc/)) call exchange_halo_z(svm(:, :, :, n), opt_zlevel=(/ihc,jhc,khc/)) enddo if (ibrank .and. ierank) then ! not parallelized in x if (BCxm == BCxm_periodic) call xm_periodic if (BCxT == BCxT_periodic) call xT_periodic if (BCxq == BCxq_periodic) call xq_periodic if (BCxs == BCxs_periodic) call xs_periodic end if if (jbrank .and. jerank) then ! not parallelized in x if (BCym == BCym_periodic) call ym_periodic if (BCyT == BCyT_periodic) call yT_periodic if (BCyq == BCyq_periodic) call yq_periodic if (BCys == BCys_periodic) call ys_periodic end if end subroutine halos