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

Commit

Permalink
Fixed a typo that would prevent test particle collisions from being r…
Browse files Browse the repository at this point in the history
…esolved. Added close approach flags to encounter check in SyMBA
  • Loading branch information
daminton committed Dec 13, 2022
1 parent ecdce0b commit befa1a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ module symba_classes

interface

module function symba_collision_check_encounter(self, system, param, t, dt, irec) result(lany_collision)
module subroutine symba_collision_check_encounter(self, system, param, t, dt, irec, lany_collision, lany_closest)
use swiftest_classes, only : swiftest_parameters
implicit none
class(symba_encounter), intent(inout) :: self !! SyMBA pl-tp encounter list object
Expand All @@ -216,8 +216,9 @@ module function symba_collision_check_encounter(self, system, param, t, dt, irec
real(DP), intent(in) :: t !! current time
real(DP), intent(in) :: dt !! step size
integer(I4B), intent(in) :: irec !! Current recursion level
logical :: lany_collision !! Returns true if cany pair of encounters resulted in a collision n
end function symba_collision_check_encounter
logical, intent(out) :: lany_collision !! Returns true if any pair of encounters resulted in a collision
logical, intent(out) :: lany_closest !! Returns true if any pair of encounters reached their closest approach without colliding
end subroutine symba_collision_check_encounter

module subroutine symba_collision_encounter_extract_collisions(self, system, param)
implicit none
Expand Down
11 changes: 5 additions & 6 deletions src/symba/symba_collision.f90
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ subroutine symba_collision_collider_message(pl, collidx, collider_message)
end subroutine symba_collision_collider_message


module function symba_collision_check_encounter(self, system, param, t, dt, irec) result(lany_collision)
module subroutine symba_collision_check_encounter(self, system, param, t, dt, irec, lany_collision, lany_closest)
!! author: David A. Minton
!!
!! Check for merger between massive bodies and test particles in SyMBA
Expand All @@ -278,8 +278,7 @@ module function symba_collision_check_encounter(self, system, param, t, dt, irec
real(DP), intent(in) :: t !! current time
real(DP), intent(in) :: dt !! step size
integer(I4B), intent(in) :: irec !! Current recursion level
! Result
logical :: lany_collision, lany_closest !! Returns true if cany pair of encounters resulted in a collision
logical, intent(out) :: lany_collision, lany_closest !! Returns true if cany pair of encounters resulted in a collision
! Internals
logical, dimension(:), allocatable :: lcollision, lclosest, lmask
real(DP), dimension(NDIM) :: xr, vr
Expand Down Expand Up @@ -396,7 +395,7 @@ module function symba_collision_check_encounter(self, system, param, t, dt, irec
end select

return
end function symba_collision_check_encounter
end subroutine symba_collision_check_encounter


pure elemental subroutine symba_collision_check_one(xr, yr, zr, vxr, vyr, vzr, Gmtot, rlim, dt, lvdotr, lcollision, lclosest)
Expand Down Expand Up @@ -985,7 +984,7 @@ module subroutine symba_resolve_collision_plplenc(self, system, param, t, dt, ir
integer(I4B), intent(in) :: irec !! Current recursion level
! Internals
real(DP) :: Eorbit_before, Eorbit_after
logical :: lplpl_collision
logical :: lplpl_collision, lplpl_closest
character(len=STRMAX) :: timestr
class(symba_parameters), allocatable :: tmp_param

Expand Down Expand Up @@ -1038,7 +1037,7 @@ module subroutine symba_resolve_collision_plplenc(self, system, param, t, dt, ir
deallocate(tmp_param)

! Check whether or not any of the particles that were just added are themselves in a collision state. This will generate a new plplcollision_list
lplpl_collision = plplenc_list%collision_check(system, param, t, dt, irec)
call plplenc_list%collision_check(system, param, t, dt, irec, lplpl_collision, lplpl_closest)

if (.not.lplpl_collision) exit
end do
Expand Down
6 changes: 3 additions & 3 deletions src/symba/symba_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ recursive module subroutine symba_step_recur_system(self, param, t, ireci)
! Internals
integer(I4B) :: j, irecp, nloops
real(DP) :: dtl, dth
logical :: lencounter
logical :: lencounter, lplpl_closest, lpltp_closest

select type(param)
class is (symba_parameters)
Expand Down Expand Up @@ -241,8 +241,8 @@ recursive module subroutine symba_step_recur_system(self, param, t, ireci)
end if

if (param%lclose) then
lplpl_collision = plplenc_list%collision_check(system, param, t+dtl, dtl, ireci)
lpltp_collision = pltpenc_list%collision_check(system, param, t+dtl, dtl, ireci)
call plplenc_list%collision_check(system, param, t+dtl, dtl, ireci, lplpl_collision, lplpl_closest)
call pltpenc_list%collision_check(system, param, t+dtl, dtl, ireci, lpltp_collision, lpltp_closest)

if (lplpl_collision) call plplenc_list%resolve_collision(system, param, t+dtl, dtl, ireci)
if (lpltp_collision) call pltpenc_list%resolve_collision(system, param, t+dtl, dtl, ireci)
Expand Down

0 comments on commit befa1a6

Please sign in to comment.