Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed issue with test particle encounter size not being defined. Set …
Browse files Browse the repository at this point in the history
…to zero valued array
  • Loading branch information
daminton committed Dec 16, 2021
1 parent 59cb5f2 commit 6ec3b65
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/encounter/encounter_check.f90
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ subroutine encounter_check_all_sort_and_sweep_plplm(nplm, nplt, xplm, vplm, xplt
end subroutine encounter_check_all_sort_and_sweep_plplm


subroutine encounter_check_all_sort_and_sweep_pltp(npl, ntp, xpl, vpl, xtp, vtp, renc, dt, &
subroutine encounter_check_all_sort_and_sweep_pltp(npl, ntp, xpl, vpl, xtp, vtp, rencpl, dt, &
nenc, index1, index2, lvdotr)
!! author: David A. Minton
!!
Expand All @@ -382,7 +382,7 @@ subroutine encounter_check_all_sort_and_sweep_pltp(npl, ntp, xpl, vpl, xtp, vtp,
real(DP), dimension(:,:), intent(in) :: vpl !! Velocity vectors of massive bodies
real(DP), dimension(:,:), intent(in) :: xtp !! Position vectors of massive bodies
real(DP), dimension(:,:), intent(in) :: vtp !! Velocity vectors of massive bodies
real(DP), dimension(:), intent(in) :: renc !! Critical radii of massive bodies that defines an encounter
real(DP), dimension(:), intent(in) :: rencpl !! Critical radii of massive bodies that defines an encounter
real(DP), intent(in) :: dt !! Step size
integer(I8B), intent(out) :: nenc !! Total number of encounter
integer(I4B), dimension(:), allocatable, intent(out) :: index1 !! List of indices for body 1 in each encounter
Expand All @@ -395,7 +395,7 @@ subroutine encounter_check_all_sort_and_sweep_pltp(npl, ntp, xpl, vpl, xtp, vtp,
logical, dimension(:), allocatable :: lencounter
integer(I2B), dimension(npl) :: vplshift_min, vplshift_max
integer(I2B), dimension(ntp) :: vtpshift_min, vtpshift_max
real(DP), dimension(ntp) :: renctp
real(DP), dimension(ntp) :: renctp

! If this is the first time through, build the index lists
if ((ntp == 0) .or. (npl == 0)) return
Expand All @@ -406,9 +406,11 @@ subroutine encounter_check_all_sort_and_sweep_pltp(npl, ntp, xpl, vpl, xtp, vtp,
call boundingbox%setup(ntot, ntot_last)
ntot_last = ntot
end if

renctp(:) = 0.0_DP

!$omp parallel do default(private) schedule(static) &
!$omp shared(xpl, xtp, vpl, vtp, renc, boundingbox) &
!$omp shared(xpl, xtp, vpl, vtp, rencpl, renctp, boundingbox) &
!$omp firstprivate(dt, npl, ntp, ntot)
do dim = 1, SWEEPDIM
where(vpl(dim,1:npl) < 0.0_DP)
Expand All @@ -427,14 +429,14 @@ subroutine encounter_check_all_sort_and_sweep_pltp(npl, ntp, xpl, vpl, xtp, vtp,
vtpshift_max(1:ntp) = 1
end where

call boundingbox%aabb(dim)%sort(ntot, [xpl(dim,1:npl) - renc(1:npl) + vplshift_min(1:npl) * vpl(dim,1:npl) * dt, &
xtp(dim,1:ntp) + vtpshift_min(1:ntp) * vtp(dim,1:ntp) * dt, &
xpl(dim,1:npl) + renc(1:npl) + vplshift_max(1:npl) * vpl(dim,1:npl) * dt, &
xtp(dim,1:ntp) + vtpshift_max(1:ntp) * vtp(dim,1:ntp) * dt])
call boundingbox%aabb(dim)%sort(ntot, [xpl(dim,1:npl) - rencpl(1:npl) + vplshift_min(1:npl) * vpl(dim,1:npl) * dt, &
xtp(dim,1:ntp) - renctp(1:ntp) + vtpshift_min(1:ntp) * vtp(dim,1:ntp) * dt, &
xpl(dim,1:npl) + rencpl(1:npl) + vplshift_max(1:npl) * vpl(dim,1:npl) * dt, &
xtp(dim,1:ntp) + renctp(1:ntp) + vtpshift_max(1:ntp) * vtp(dim,1:ntp) * dt])
end do
!$omp end parallel do

call boundingbox%sweep(npl, ntp, xpl, vpl, xtp, vtp, renc, renctp, dt, nenc, index1, index2, lvdotr)
call boundingbox%sweep(npl, ntp, xpl, vpl, xtp, vtp, rencpl, renctp, dt, nenc, index1, index2, lvdotr)

return
end subroutine encounter_check_all_sort_and_sweep_pltp
Expand Down

0 comments on commit 6ec3b65

Please sign in to comment.