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

Commit

Permalink
added collision_counter to symba_nbody_system, assigned collision_id
Browse files Browse the repository at this point in the history
  • Loading branch information
cwishard committed Sep 30, 2021
1 parent 192b758 commit 1c8d8b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ module symba_classes
class(symba_plplenc), allocatable :: plplenc_list !! List of massive body-massive body encounters in a single step
class(symba_plplenc), allocatable :: plplcollision_list !! List of massive body-massive body collisions in a single step
integer(I4B) :: irec !! System recursion level
integer(I4B) :: collision_counter !! Counter for number of collisions over total simulation
contains
procedure :: write_discard => symba_io_write_discard !! Write out information about discarded and merged planets and test particles in SyMBA
procedure :: initialize => symba_setup_initialize_system !! Performs SyMBA-specific initilization steps
Expand Down
7 changes: 4 additions & 3 deletions src/symba/symba_collision.f90
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
ncolliders = colliders%ncoll
nfrag = frag%nbody

system%collision_counter = system%collision_counter + 1
! Setup new bodies
allocate(plnew, mold=pl)
call plnew%setup(nfrag, param)
Expand Down Expand Up @@ -745,7 +746,7 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
plnew%status(1:nfrag) = NEW_PARTICLE
do i = 1, nfrag
write(newname, FRAGFMT) frag%id(i)
call plnew%info(i)%set_value(origin_type="Disruption", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i))
call plnew%info(i)%set_value(origin_type="Disruption", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i), collision_id=system%collision_counter)
end do
do i = 1, ncolliders
if (colliders%idx(i) == ibiggest) then
Expand All @@ -759,7 +760,7 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
plnew%status(1:nfrag) = NEW_PARTICLE
do i = 1, nfrag
write(newname, FRAGFMT) frag%id(i)
call plnew%info(i)%set_value(origin_type="Supercatastrophic", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i))
call plnew%info(i)%set_value(origin_type="Supercatastrophic", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i), collision_id=system%collision_counter)
end do
do i = 1, ncolliders
if (colliders%idx(i) == ibiggest) then
Expand All @@ -774,7 +775,7 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
plnew%status(1) = OLD_PARTICLE
do i = 2, nfrag
write(newname, FRAGFMT) frag%id(i)
call plnew%info(i)%set_value(origin_type="Hit and run fragment", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i))
call plnew%info(i)%set_value(origin_type="Hit and run fragment", origin_time=param%t, name=newname, origin_xh=plnew%xh(:,i), origin_vh=plnew%vh(:,i), collision_id=system%collision_counter)
end do
do i = 1, ncolliders
if (colliders%idx(i) == ibiggest) cycle
Expand Down

0 comments on commit 1c8d8b0

Please sign in to comment.