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

Commit

Permalink
Testing ability to resolve collisions in the middle of the recursion …
Browse files Browse the repository at this point in the history
…step, like the original Swifter does.
  • Loading branch information
daminton committed Aug 12, 2021
1 parent 2114f46 commit f7d3255
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/modules/swiftest_globals.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module swiftest_globals
integer(I4B), parameter :: SYMBA = 8
integer(I4B), parameter :: RINGMOONS = 9

integer(I4B), parameter :: STRMAX = 128 !! Maximum size of character strings
integer(I4B), parameter :: STRMAX = 512 !! Maximum size of character strings

character(*), parameter :: ASCII_TYPE = 'ASCII' !! Symbolic name for ASCII file type
character(*), parameter :: REAL4_TYPE = 'REAL4' !! Symbolic name for binary file type REAL4
Expand Down
14 changes: 9 additions & 5 deletions src/symba/symba_collision.f90
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,10 @@ subroutine symba_collision_mergeaddsub(system, param, family, id_frag, Ip_frag,
allocate(plnew, mold=pl)
call plnew%setup(nfrag, param)
ibiggest = maxloc(pl%Gmass(family(:)), dim=1)


! Copy over identification, information, and physical properties of the new bodies from the fragment list
plnew%id(:) = id_frag(:)
system%maxid = system%maxid + nfrag
plnew%lcollision(:) = .false.
plnew%ldiscard(:) = .false.
plnew%xb(:,:) = xb_frag(:, :)
plnew%vb(:,:) = vb_frag(:, :)
do i = 1, nfrag
Expand Down Expand Up @@ -888,9 +887,14 @@ subroutine symba_collision_mergeaddsub(system, param, family, id_frag, Ip_frag,
plnew%k2 = pl%k2(ibiggest)
plnew%tlag = pl%tlag(ibiggest)
end if

call plnew%set_mu(cb)
pl%lmtiny(:) = pl%Gmass(:) > param%GMTINY
!Copy over or set integration parameters for new bodies
plnew%lcollision(:) = .false.
plnew%ldiscard(:) = .false.
plnew%lmtiny(:) = plnew%Gmass(:) > param%GMTINY
plnew%levelg(:) = pl%levelg(ibiggest)
plnew%levelm(:) = pl%levelm(ibiggest)

! Append the new merged body to the list and record how many we made
nstart = pl_adds%nbody + 1
Expand Down
2 changes: 2 additions & 0 deletions src/symba/symba_discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ module subroutine symba_discard_pl(self, system, param)
else
call plplcollision_list%resolve_mergers(system, param)
end if
! Destroy the collision list now that the collisions are resolved
call plplcollision_list%setup(0)
end if

if (any(pl%ldiscard(:))) then
Expand Down
4 changes: 2 additions & 2 deletions src/symba/symba_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ module recursive subroutine symba_step_recur_system(self, param, t, ireci)
lplpl_collision = plplenc_list%collision_check(system, param, t+dtl, dtl, ireci)
lpltp_collision = pltpenc_list%collision_check(system, param, t+dtl, dtl, ireci)

! if (lplpl_collision) call pl%discard(system, param)
! if (lpltp_collision) call tp%discard(system, param)
if (lplpl_collision) call pl%discard(system, param)
if (lpltp_collision) call tp%discard(system, param)
end if

call self%set_recur_levels(ireci)
Expand Down

0 comments on commit f7d3255

Please sign in to comment.