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

Commit

Permalink
Solved an edge case where a merged body involved in an additional enc…
Browse files Browse the repository at this point in the history
…ounter gets lost from the old encounter list
  • Loading branch information
daminton committed Aug 20, 2021
1 parent b2a9fc0 commit a252b6f
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/symba/symba_collision.f90
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ module function symba_collision_casemerge(system, param, family, x, v, mass, rad
! Result
integer(I4B) :: status !! Status flag assigned to this outcome
! Internals
integer(I4B) :: i, j, ibiggest, nfamily
integer(I4B) :: i, j, k, ibiggest, nfamily
real(DP) :: volume_new, pe
real(DP), dimension(NDIM) :: xc, vc, xcrossv
real(DP), dimension(2) :: vol
Expand Down Expand Up @@ -283,8 +283,27 @@ module function symba_collision_casemerge(system, param, family, x, v, mass, rad
param%Ecollisions = param%Ecollisions + pe
param%Euntracked = param%Euntracked - pe

! Update any encounter lists that have the removedbodies in them so that they instead point to the new
do k = 1, system%plplenc_list%nenc
do j = 1, nfamily
i = family(j)
if (i == ibiggest) cycle
if (system%plplenc_list%id1(k) == pl%id(i)) then
system%plplenc_list%id1(k) = pl%id(ibiggest)
system%plplenc_list%index1 = i
end if
if (system%plplenc_list%id2(k) == pl%id(i)) then
system%plplenc_list%id2(k) = pl%id(ibiggest)
system%plplenc_list%index2 = i
end if
if (system%plplenc_list%id1(k) == system%plplenc_list%id2(k)) system%plplenc_list%status(k) = INACTIVE
end do
end do


status = MERGED
call symba_collision_mergeaddsub(system, param, family, id_frag, Ip_frag, m_frag, rad_frag, xb_frag, vb_frag, rot_frag, status)


end select

Expand Down

0 comments on commit a252b6f

Please sign in to comment.