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

Commit

Permalink
Fixed bug that caused the pl-tp encounter list to not be reset after …
Browse files Browse the repository at this point in the history
…all test particles were lost
  • Loading branch information
daminton committed Dec 14, 2021
1 parent bb272e2 commit 9214858
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/symba/symba_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ module subroutine symba_step_reset_system(self, param)
select type(tp => system%tp)
class is (symba_tp)
associate(npl => pl%nbody, ntp => tp%nbody)
nenc_old = system%plplenc_list%nenc
call system%plplenc_list%setup(0)
call system%plplcollision_list%setup(0)
if (npl > 0) then
pl%lcollision(1:npl) = .false.
call pl%reset_kinship([(i, i=1, npl)])
Expand All @@ -261,24 +264,21 @@ module subroutine symba_step_reset_system(self, param)
pl%lcollision(1:npl) = .false.
pl%ldiscard(1:npl) = .false.
pl%lmask(1:npl) = .true.
nenc_old = system%plplenc_list%nenc
call system%plplenc_list%setup(0)
call system%plplenc_list%setup(nenc_old)
system%plplenc_list%nenc = 0
call system%plplcollision_list%setup(0)
call system%pl%set_renc(0)
call pl%set_renc(0)
call system%plplenc_list%setup(nenc_old) ! This resizes the pl-pl encounter list to be the same size as it was the last step, to decrease the number of potential resize operations that have to be one inside the step
system%plplenc_list%nenc = 0 ! Sets the true number of encounters back to 0 after resizing
end if

nenc_old = system%pltpenc_list%nenc
call system%pltpenc_list%setup(0)
if (ntp > 0) then
tp%nplenc(1:ntp) = 0
tp%levelg(1:ntp) = -1
tp%levelm(1:ntp) = -1
tp%lmask(1:ntp) = .true.
tp%ldiscard(1:ntp) = .false.
nenc_old = system%pltpenc_list%nenc
call system%pltpenc_list%setup(0)
call system%pltpenc_list%setup(nenc_old)
system%pltpenc_list%nenc = 0
call system%pltpenc_list%setup(nenc_old)! This resizes the pl-tp encounter list to be the same size as it was the last step, to decrease the number of potential resize operations that have to be one inside the step
system%pltpenc_list%nenc = 0 ! Sets the true number of encounters back to 0 after resizing
end if

call system%pl_adds%setup(0, param)
Expand Down

0 comments on commit 9214858

Please sign in to comment.