Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for regional runs when dycore is compiled in double precision #25

Merged
merged 4 commits into from
Jun 29, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions model/fv_regional_bc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3431,6 +3431,7 @@ subroutine remap_scalar_nggps_regional_bc(Atm &
print *, 'clwmr = ', liq_wat
print *, ' o3mr = ', o3mr
print *, 'ncnst = ', ncnst
print *, 'ntracers = ', ntracers
endif

if ( sphum/=1 ) then
Expand Down Expand Up @@ -6483,7 +6484,7 @@ subroutine exch_uv(domain, bd, npz, u, v)
real, intent(inout) :: v (bd%isd:bd%ied+1,bd%jsd:bd%jed ,1:npz)

integer,parameter :: ibufexch=2500000
real,dimension(ibufexch) :: buf1,buf2,buf3,buf4
real, dimension(:), allocatable :: buf1,buf2,buf3,buf4
integer :: ihandle1,ihandle2,ihandle3,ihandle4
integer,dimension(MPI_STATUS_SIZE) :: istat
integer :: ic, i, j, k, is, ie, js, je
Expand All @@ -6508,18 +6509,28 @@ subroutine exch_uv(domain, bd, npz, u, v)
js=bd%js
je=bd%je

allocate(buf1(1:24*npz))
allocate(buf2(1:36*npz))
allocate(buf3(1:36*npz))
allocate(buf4(1:24*npz))

! FIXME: MPI_COMM_WORLD

#ifdef OVERLOAD_R4
#define _DYN_MPI_REAL MPI_REAL
#else
#define _DYN_MPI_REAL MPI_DOUBLE_PRECISION
#endif

! Receive from north
if( north_pe /= NULL_PE )then
call MPI_Irecv(buf1,ibufexch,MPI_REAL,north_pe,north_pe &
call MPI_Irecv(buf1,ibufexch,_DYN_MPI_REAL,north_pe,north_pe &
,MPI_COMM_WORLD,ihandle1,irecv)
endif

! Receive from south
if( south_pe /= NULL_PE )then
call MPI_Irecv(buf2,ibufexch,MPI_REAL,south_pe,south_pe &
call MPI_Irecv(buf2,ibufexch,_DYN_MPI_REAL,south_pe,south_pe &
,MPI_COMM_WORLD,ihandle2,irecv)
endif

Expand Down Expand Up @@ -6551,7 +6562,7 @@ subroutine exch_uv(domain, bd, npz, u, v)
enddo

enddo
call MPI_Issend(buf3,ic,MPI_REAL,north_pe,mype &
call MPI_Issend(buf3,ic,_DYN_MPI_REAL,north_pe,mype &
,MPI_COMM_WORLD,ihandle3,isend)
endif

Expand Down Expand Up @@ -6583,7 +6594,7 @@ subroutine exch_uv(domain, bd, npz, u, v)
enddo

enddo
call MPI_Issend(buf4,ic,MPI_REAL,south_pe,mype &
call MPI_Issend(buf4,ic,_DYN_MPI_REAL,south_pe,mype &
,MPI_COMM_WORLD,ihandle4,isend)
endif

Expand Down Expand Up @@ -6649,6 +6660,11 @@ subroutine exch_uv(domain, bd, npz, u, v)
enddo
endif

deallocate(buf1)
deallocate(buf2)
deallocate(buf3)
deallocate(buf4)

end subroutine exch_uv

!---------------------------------------------------------------------
Expand Down