Skip to content

Commit

Permalink
20220330 Jesse Meng fix cloud cover variabes full field collection in…
Browse files Browse the repository at this point in the history
… 2d decomp
  • Loading branch information
wx22mj authored and wx22mj committed Mar 30, 2022
1 parent 8522567 commit b78a3a3
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 3 deletions.
17 changes: 14 additions & 3 deletions sorc/ncep_post.fd/CLDRAD.f
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ SUBROUTINE CLDRAD
!
real dummy(ista:iend,jsta:jend)
integer idummy(ista:iend,jsta:jend)
real full_dummy(im,jm)
!
! --- Revision added for GOCART ---
Expand Down Expand Up @@ -966,7 +967,10 @@ SUBROUTINE CLDRAD
endif
ENDDO
ENDDO
CALL AllGETHERV(FULL_CLD)
! CALL AllGETHERV(FULL_CLD)
full_dummy=spval
CALL COLLECT_ALL(FULL_CLD(ISTA:IEND,JSTA:JEND),full_dummy)
FULL_CLD=full_dummy
DO J=JSTA,JEND
DO I=ISTA,IEND
NUMPTS=0
Expand Down Expand Up @@ -2216,8 +2220,15 @@ SUBROUTINE CLDRAD
full_fis(i,j)=fis(i,j)
ENDDO
ENDDO
CALL AllGETHERV(full_ceil)
CALL AllGETHERV(full_fis)
! CALL AllGETHERV(full_ceil)
full_dummy=spval
CALL COLLECT_ALL(full_ceil(ISTA:IEND,JSTA:JEND),full_dummy)
full_ceil=full_dummy
! CALL AllGETHERV(full_fis)
full_dummy=spval
CALL COLLECT_ALL(full_fis(ISTA:IEND,JSTA:JEND),full_dummy)
full_fis=full_dummy

numr = 1
DO J=JSTA,JEND
DO I=ISTA,IEND
Expand Down
70 changes: 70 additions & 0 deletions sorc/ncep_post.fd/COLLECT_LOC.f
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,73 @@ SUBROUTINE COLLECT_LOC ( A, B )
deallocate(rbufs)

end
!
!-----------------------------------------------------------------------
!
SUBROUTINE COLLECT_ALL ( A, B )


use CTLBLK_mod, only: num_procs, jsta, icnt, idsp, mpi_comm_comp, im,&
jsta_2l, jend_2u, jm, me, &
buff,ista_2l,iend_2u,jexa,iexa,jsxa,isxa,ista,iend,jend
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
implicit none
!
include 'mpif.h'
integer ii,jj,isum
! real, dimension(ista_2l:iend_2u,jsta_2l:jend_2u), intent(in) :: a
real, dimension(ista:iend,jsta:jend), intent(in) :: a
real, dimension(im,jm), intent(out) :: b
integer ierr,n
real, allocatable :: rbufs(:)
write(0,*) ' GWVX COLL CALL'
allocate(buff(im*jm))
jj=( jexa(me)-jsxa(me)+1) * (iexa(me)-isxa(me)+1)
allocate( rbufs(( jexa(me)-jsxa(me)+1) * (iexa(me)-isxa(me)+1)) )
!
if ( num_procs <= 1 ) then
b = a
else

!GWV reshape the receive subdomain
isum=1
do jj=jsxa(me),jexa(me)
do ii=isxa(me),iexa(me)
if(isum .gt. im*jm .or. ii .gt. im .or. ii .lt. 1 .or. jj .gt. jm .or. jj.lt. 1) &
write(0,901)' GWVX BOUNDS2 FAIL in reshape',isum,ii,jj,im*jm,im,im*jm
rbufs(isum)=a(ii,jj)
isum=isum+1
end do
end do
!GWV end reshape

!UNCOMMENT POST TEST call mpi_gatherv(rbufs,icnt(me),MPI_REAL,
!buff,icnt,idsp,MPI_REAL,0,MPI_COMM_COMP, ierr )
! call mpi_gatherv(rbufs,icnt(me),MPI_REAL,
! buff,icnt,idsp,MPI_REAL,0,mpi_comm_comp, ierr ) !GWVX COMMENT
call mpi_allgatherv(rbufs,icnt(me),MPI_REAL,buff,icnt,idsp,MPI_REAL, mpi_comm_comp, ierr ) !GWVX COMMENT
call mpi_barrier(mpi_comm_comp,ierr)

!GWV reshape the gathered array and collect in all procs
! if(me .eq. 0) then
isum=1
do n=0,num_procs-1
do jj=jsxa(n),jexa(n)
do ii=isxa(n),iexa(n)
if(isum .gt. im*jm .or. ii .gt. im .or. ii .lt. 1 .or. jj .gt. jm .or. jj .lt. 1) &
write(0,901)' GWVX BOUNDS FAIL in reshape',isum,ii,jj,im*jm,im,im*jm
901 format(a30,10i10)
b(ii,jj)=buff(isum)
isum=isum+1
end do
end do
end do


! end if
endif
deallocate(buff)
deallocate(rbufs)

end

0 comments on commit b78a3a3

Please sign in to comment.