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

Commit

Permalink
Fixed issue where encounters were not being recorded correctly in tri…
Browse files Browse the repository at this point in the history
…angular mode
  • Loading branch information
daminton committed Sep 17, 2021
1 parent d701f5d commit d22e607
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ module swiftest_classes
integer(I4B) :: nenc !! Total number of encounters
logical, dimension(:), allocatable :: lvdotr !! relative vdotr flag
integer(I4B), dimension(:), allocatable :: status !! status of the interaction
integer(I8B), dimension(:), allocatable :: kidx !! index value of the encounter from the master k_plpl encounter list
integer(I4B), dimension(:), allocatable :: index1 !! position of the first body in the encounter
integer(I4B), dimension(:), allocatable :: index2 !! position of the second body in the encounter
integer(I4B), dimension(:), allocatable :: id1 !! id of the first body in the encounter
Expand Down
3 changes: 0 additions & 3 deletions src/setup/setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ module subroutine setup_encounter(self, n)

if (allocated(self%lvdotr)) deallocate(self%lvdotr)
if (allocated(self%status)) deallocate(self%status)
if (allocated(self%kidx)) deallocate(self%kidx)
if (allocated(self%index1)) deallocate(self%index1)
if (allocated(self%index2)) deallocate(self%index2)
if (allocated(self%id1)) deallocate(self%id1)
Expand All @@ -101,7 +100,6 @@ module subroutine setup_encounter(self, n)

allocate(self%lvdotr(n))
allocate(self%status(n))
allocate(self%kidx(n))
allocate(self%index1(n))
allocate(self%index2(n))
allocate(self%id1(n))
Expand All @@ -114,7 +112,6 @@ module subroutine setup_encounter(self, n)

self%lvdotr(:) = .false.
self%status(:) = INACTIVE
self%kidx(:) = 0_I8B
self%index1(:) = 0
self%index2(:) = 0
self%id1(:) = 0
Expand Down
10 changes: 6 additions & 4 deletions src/symba/symba_encounter_check.f90
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,19 @@ module function symba_encounter_check_pl(self, param, system, dt, irec) result(l
else
nplm = pl%nplm
call symba_encounter_check_all_triangular(npl, nplm, pl%xh, pl%vh, pl%rhill, dt, irec, lvdotr, index1, index2, nenc)
call move_alloc(lvdotr, plplenc_list%lvdotr)
call move_alloc(index1, plplenc_list%index1)
call move_alloc(index2, plplenc_list%index2)
lany_encounter = nenc > 0
if (lany_encounter) then
call move_alloc(lvdotr, plplenc_list%lvdotr)
call move_alloc(index1, plplenc_list%index1)
call move_alloc(index2, plplenc_list%index2)
end if
end if

if (lany_encounter) then
do k = 1, nenc
i = plplenc_list%index1(k)
j = plplenc_list%index2(k)
call util_index_eucl_ij_to_k(npl, i, j, kenc)
plplenc_list%kidx(k) = kenc
plplenc_list%id1(k) = pl%id(plplenc_list%index1(k))
plplenc_list%id2(k) = pl%id(plplenc_list%index2(k))
plplenc_list%status(k) = ACTIVE
Expand Down
3 changes: 2 additions & 1 deletion src/symba/symba_kick.f90
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ module subroutine symba_kick_getacch_pl(self, system, param, t, lbeg)
ah_enc(:,:) = 0.0_DP
nplplenc = int(plplenc_list%nenc, kind=I8B)
allocate(k_plpl_enc(2,nplplenc))
k_plpl_enc(:,1:nplplenc) = pl%k_plpl(:,plplenc_list%kidx(1:nplplenc))
k_plpl_enc(1,1:nplplenc) = plplenc_list%index1(1:nplplenc)
k_plpl_enc(2,1:nplplenc) = plplenc_list%index2(1:nplplenc)
call kick_getacch_int_all_flat_pl(npl, nplplenc, k_plpl_enc, pl%xh, pl%Gmass, pl%radius, ah_enc)
pl%ah(:,1:npl) = pl%ah(:,1:npl) - ah_enc(:,1:npl)
end if
Expand Down
1 change: 0 additions & 1 deletion src/util/util_copy.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module subroutine util_copy_encounter(self, source)
self%nenc = n
self%lvdotr(1:n) = source%lvdotr(1:n)
self%status(1:n) = source%status(1:n)
self%kidx(1:n) = source%kidx(1:n)
self%index1(1:n) = source%index1(1:n)
self%index2(1:n) = source%index2(1:n)
self%id1(1:n) = source%id1(1:n)
Expand Down
1 change: 0 additions & 1 deletion src/util/util_spill.f90
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ module subroutine util_spill_encounter(self, discards, lspill_list, ldestructive
associate(keeps => self)
call util_spill(keeps%lvdotr, discards%lvdotr, lspill_list, ldestructive)
call util_spill(keeps%status, discards%status, lspill_list, ldestructive)
call util_spill(keeps%kidx, discards%kidx, lspill_list, ldestructive)
call util_spill(keeps%index1, discards%index1, lspill_list, ldestructive)
call util_spill(keeps%index2, discards%index2, lspill_list, ldestructive)
call util_spill(keeps%id1, discards%id1, lspill_list, ldestructive)
Expand Down

0 comments on commit d22e607

Please sign in to comment.