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

Commit

Permalink
Changed the naming scheme behavior for disruptions. For non-supercat,…
Browse files Browse the repository at this point in the history
… the largest body keeps its id and name
  • Loading branch information
daminton committed Dec 7, 2022
1 parent be401c7 commit ea48c5f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/Fragmentation/Fragmentation_Movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __init__(self, sim, animfile, title, style, nskip=1):
self.body_color_list = {'Initial conditions': 'xkcd:windows blue',
'Disruption': 'xkcd:baby poop',
'Supercatastrophic': 'xkcd:shocking pink',
'Hit and run fragment': 'xkcd:blue with a hint of purple',
'Hit and run fragmention': 'xkcd:blue with a hint of purple',
'Central body': 'xkcd:almost black'}

# Set up the figure and axes...
Expand Down
41 changes: 17 additions & 24 deletions src/symba/symba_collision.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module function symba_collision_casedisruption(system, param, colliders, frag)
! Result
integer(I4B) :: status !! Status flag assigned to this outcome
! Internals
integer(I4B) :: i, nfrag
integer(I4B) :: i, ibiggest, nfrag
logical :: lfailure
character(len=STRMAX) :: message

Expand Down Expand Up @@ -63,11 +63,16 @@ module function symba_collision_casedisruption(system, param, colliders, frag)
select case(frag%regime)
case(COLLRESOLVE_REGIME_DISRUPTION)
status = DISRUPTION
ibiggest = colliders%idx(maxloc(system%pl%Gmass(colliders%idx(:)), dim=1))
frag%id(1) = system%pl%id(ibiggest)
frag%id(2:nfrag) = [(i, i = param%maxid + 1, param%maxid + nfrag - 1)]
param%maxid = frag%id(nfrag)
case(COLLRESOLVE_REGIME_SUPERCATASTROPHIC)
status = SUPERCATASTROPHIC
frag%id(1:nfrag) = [(i, i = param%maxid + 1, param%maxid + nfrag)]
param%maxid = frag%id(nfrag)
end select
frag%id(1:nfrag) = [(i, i = param%maxid + 1, param%maxid + nfrag)]
param%maxid = frag%id(nfrag)

call symba_collision_mergeaddsub(system, param, colliders, frag, status)
end if

Expand Down Expand Up @@ -720,7 +725,7 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
logical, dimension(system%pl%nbody) :: lmask
class(symba_pl), allocatable :: plnew, plsub
character(*), parameter :: FRAGFMT = '("Newbody",I0.7)'
character(len=NAMELEN) :: newname
character(len=NAMELEN) :: newname, origin_type

select type(pl => system%pl)
class is (symba_pl)
Expand Down Expand Up @@ -757,23 +762,6 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
call plnew%set_rhill(cb)

select case(status)
case(DISRUPTION)
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=system%t, name=newname, &
origin_rh=plnew%rh(:,i), &
origin_vh=plnew%vh(:,i), collision_id=param%maxid_collision)
end do
do i = 1, ncolliders
if (colliders%idx(i) == ibiggest) then
iother = ismallest
else
iother = ibiggest
end if
call pl%info(colliders%idx(i))%set_value(status="Disruption", discard_time=system%t, &
discard_rh=pl%rh(:,i), discard_vh=pl%vh(:,i), discard_body_id=iother)
end do
case(SUPERCATASTROPHIC)
plnew%status(1:nfrag) = NEW_PARTICLE
do i = 1, nfrag
Expand All @@ -792,19 +780,24 @@ subroutine symba_collision_mergeaddsub(system, param, colliders, frag, status)
discard_rh=pl%rh(:,i), discard_vh=pl%vh(:,i), &
discard_body_id=iother)
end do
case(HIT_AND_RUN_DISRUPT)
case(DISRUPTION,HIT_AND_RUN_DISRUPT)
if (status == DISRUPTION) then
write(origin_type,*) "Disruption"
else if (status == HIT_AND_RUN_DISRUPT) then
write(origin_type,*) "Hit and run fragmention"
end if
call plnew%info(1)%copy(pl%info(ibiggest))
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=system%t, name=newname, &
call plnew%info(i)%set_value(origin_type=origin_type, origin_time=system%t, name=newname, &
origin_rh=plnew%rh(:,i), origin_vh=plnew%vh(:,i), &
collision_id=param%maxid_collision)
end do
do i = 1, ncolliders
if (colliders%idx(i) == ibiggest) cycle
iother = ibiggest
call pl%info(colliders%idx(i))%set_value(status="Hit and run fragmention", discard_time=system%t, &
call pl%info(colliders%idx(i))%set_value(status=origin_type, discard_time=system%t, &
discard_rh=pl%rh(:,i), discard_vh=pl%vh(:,i), &
discard_body_id=iother)
end do
Expand Down

0 comments on commit ea48c5f

Please sign in to comment.