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

mpp_check_field fix for test_mpp_domains2 #1292

Merged
merged 3 commits into from
Aug 8, 2023
Merged
Changes from all 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
9 changes: 9 additions & 0 deletions mpp/include/mpp_domains_misc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ end subroutine init_nonblock_type
field2(isd:ied, jsd:jed) = field_in(:,:)
endif

! allocate field1 on pelist1
! if field1 is left unallocated, the code will try to access unallocated memory
! when field1 is set to 0 in mpp_redistribute
if(any(pelist1 == pe)) then
allocate(field1(1,1))
endif

laurenchilutti marked this conversation as resolved.
Show resolved Hide resolved
! broadcast domain
call mpp_broadcast_domain(domain1)
call mpp_broadcast_domain(domain2)
Expand All @@ -443,6 +450,8 @@ end subroutine init_nonblock_type

if(any(pelist2 == pe)) deallocate(field1, field2)

if(any(pelist1 == pe)) deallocate(field1)

call mpp_sync()

return
Expand Down