da_patch_to_global_2d.inc
References to this file elsewhere.
1 subroutine da_patch_to_global_2d (grid, vlocal, vglobal)
2
3 !---------------------------------------------------------------------
4 ! Purpose: Gathers local 2D array vlocal into global array vglobal.
5 !
6 ! Must be called by all MPI tasks.
7 !---------------------------------------------------------------------
8
9 implicit none
10
11 type(domain), intent(in) :: grid
12 real, intent(in) :: vlocal(:,:)
13 real, intent(out) :: vglobal(:,:)
14
15 real, allocatable :: vlocal3d(:,:,:), vglobal3d(:,:,:)
16
17 if (trace_use_frequent) call da_trace_entry("da_patch_to_global_2d")
18
19 allocate(vlocal3d (ims:ime, jms:jme, 1:1))
20 allocate(vglobal3d(ids:ide, jds:jde, 1:1))
21
22 vlocal3d(:,:,1) = vlocal(:,:)
23 call da_patch_to_global_3d(grid, vlocal3d, vglobal3d, 1)
24 if (rootproc) then
25 vglobal(:,:) = vglobal3d(:,:,1)
26 end if
27
28 deallocate(vlocal3d)
29 deallocate(vglobal3d)
30
31 if (trace_use_frequent) call da_trace_exit("da_patch_to_global_2d")
32
33 end subroutine da_patch_to_global_2d
34
35