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

Commit

Permalink
Fixed bugs that prevented the encounter list from being properly buil…
Browse files Browse the repository at this point in the history
…t in triangular mode
  • Loading branch information
daminton committed Sep 17, 2021
1 parent 85b296b commit 8ae5215
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/symba/symba_encounter_check.f90
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ subroutine symba_encounter_check_all_triangular(npl, nplm, x, v, rhill, dt, ire

ind_arr(:) = [(i, i = 1, npl)]
!$omp parallel do default(private) schedule(static)&
!$omp shared(npl, nplm, x, v, rhill, dt, irec, lenc) &
!$omp firstprivate(ind_arr) &
!$omp shared(npl, nplm, x, v, rhill, dt, irec, lenc, ind_arr) &
!$omp lastprivate(xr, yr, zr, vxr, vyr, vzr, rhill1, rhill2, lencounteri, lvdotri)
do i = 1, nplm
do concurrent(j = i+1:npl)
Expand All @@ -90,9 +89,10 @@ subroutine symba_encounter_check_all_triangular(npl, nplm, x, v, rhill, dt, ire
rhill2 = rhill(j)
call symba_encounter_check_one(xr, yr, zr, vxr, vyr, vzr, rhill1, rhill2, dt, irec, lencounteri(j), lvdotri(j))
end do
lenc(i)%nenc = count(lencounteri(i+1:npl))
if (lenc(i)%nenc > 0) then
nenci = count(lencounteri(i+1:npl))
if (nenci > 0) then
allocate(lenc(i)%lvdotr(nenci), lenc(i)%index2(nenci))
lenc(i)%nenc = nenci
lenc(i)%lvdotr(:) = pack(lvdotri(i+1:npl), lencounteri(i+1:npl))
lenc(i)%index2(:) = pack(ind_arr(i+1:npl), lencounteri(i+1:npl))
end if
Expand Down Expand Up @@ -175,6 +175,7 @@ module function symba_encounter_check_pl(self, param, system, dt, irec) result(l
call symba_encounter_check_all_triangular(npl, nplm, pl%xh, pl%vh, pl%rhill, dt, irec, lvdotr, index1, index2, nenc)
lany_encounter = nenc > 0
if (lany_encounter) then
call plplenc_list%resize(nenc)
call move_alloc(lvdotr, plplenc_list%lvdotr)
call move_alloc(index1, plplenc_list%index1)
call move_alloc(index2, plplenc_list%index2)
Expand Down

0 comments on commit 8ae5215

Please sign in to comment.