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

Commit

Permalink
Adjust Fragmentation Movie parameters to get more typical collisions …
Browse files Browse the repository at this point in the history
…(which don't converge). Adjusted bounce
  • Loading branch information
daminton committed Jan 13, 2023
1 parent 0956918 commit fc6a7eb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
16 changes: 8 additions & 8 deletions examples/Fragmentation/Fragmentation_Movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
vel_vectors = {"disruption_headon" : [np.array([ 0.00, 6.280005, 0.0]),
np.array([ 0.00, -6.280005, 0.0])],
"disruption_off_axis" : [np.array([ 0.00, 6.280005, 0.0]),
np.array([ 0.50, -6.280005, 0.0])],
np.array([ 0.05, 4.28, 0.0])],
"supercatastrophic_headon": [np.array([ 0.00, 6.28, 0.0]),
np.array([ 0.00, -6.28, 0.0])],
"supercatastrophic_off_axis": [np.array([ 0.00, 6.28, 0.0]),
np.array([ 0.50, -6.28, 0.0])],
np.array([ 0.05, 5.28, 0.0])],
"hitandrun_disrupt" : [np.array([ 0.00, 6.28, 0.0]),
np.array([-1.45, -6.28, 0.0])],
"hitandrun_pure" : [np.array([ 0.00, 6.28, 0.0]),
Expand All @@ -76,12 +76,12 @@

rot_vectors = {"disruption_headon" : [np.array([0.0, 0.0, 0.0]),
np.array([0.0, 0.0, 0.0])],
"disruption_off_axis": [np.array([0.0, 0.0, -6.0e3]),
np.array([0.0, 0.0, 1.0e4])],
"disruption_off_axis": [np.array([0.0, 0.0, 0.0]),
np.array([0.0, 0.0, 0.0])],
"supercatastrophic_headon": [np.array([0.0, 0.0, 0.0]),
np.array([0.0, 0.0, 0.0])],
"supercatastrophic_off_axis": [np.array([0.0, 0.0, -6.0e3]),
np.array([0.0, 0.0, 1.0e4])],
"supercatastrophic_off_axis": [np.array([0.0, 0.0, 0.0]),
np.array([0.0, 0.0, 0.0])],
"hitandrun_disrupt" : [np.array([0.0, 0.0, 6.0e3]),
np.array([0.0, 0.0, 1.0e4])],
"hitandrun_pure" : [np.array([0.0, 0.0, 6.0e3]),
Expand All @@ -100,9 +100,9 @@
}

tstop = {"disruption_headon" : 5.0e-4,
"disruption_off_axis" : 5.0e-4,
"disruption_off_axis" : 2.0e-3,
"supercatastrophic_headon" : 5.0e-4,
"supercatastrophic_off_axis": 5.0e-4,
"supercatastrophic_off_axis": 2.0e-3,
"hitandrun_disrupt" : 2.0e-4,
"hitandrun_pure" : 2.0e-4,
"merge" : 2.0e-3,
Expand Down
7 changes: 5 additions & 2 deletions src/collision/collision_generate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module subroutine collision_generate_bounce(self, nbody_system, param, t)
real(DP), intent(in) :: t !! The time of the collision
! Internals
integer(I4B) :: i,j,nimp
real(DP), dimension(NDIM) :: vcom, rnorm
real(DP), dimension(NDIM) :: rcom, vcom, rnorm
logical, dimension(:), allocatable :: lmask

select type(nbody_system)
Expand All @@ -70,10 +70,13 @@ module subroutine collision_generate_bounce(self, nbody_system, param, t)
nimp = size(impactors%id(:))
do i = 1, nimp
j = impactors%id(i)
rcom(:) = pl%rb(:,j) - impactors%rbcom(:)
vcom(:) = pl%vb(:,j) - impactors%vbcom(:)
rnorm(:) = .unit. (impactors%rb(:,2) - impactors%rb(:,1))
rnorm(:) = .unit. rcom(:)
! Do the reflection
vcom(:) = vcom(:) - 2 * dot_product(vcom(:),rnorm(:)) * rnorm(:)
! Shift the positions so that the collision doesn't immediately occur again
pl%rb(:,j) = pl%rb(:,j) + 0.5_DP * pl%radius(j) * rnorm(:)
pl%vb(:,j) = impactors%vbcom(:) + vcom(:)
self%status = DISRUPTED
pl%status(j) = ACTIVE
Expand Down
10 changes: 6 additions & 4 deletions src/fraggle/fraggle_generate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module subroutine fraggle_generate(self, nbody_system, param, t)
real(DP), intent(in) :: t !! Time of collision
! Internals
integer(I4B) :: i, j, ibiggest, nfrag, nimp
real(DP), dimension(NDIM) :: vcom, rnorm
real(DP), dimension(NDIM) :: rcom, vcom, rnorm
character(len=STRMAX) :: message
logical :: lfailure

Expand Down Expand Up @@ -60,16 +60,18 @@ module subroutine fraggle_generate(self, nbody_system, param, t)
do i = 1, nimp
j = impactors%id(i)
vcom(:) = pl%vb(:,j) - impactors%vbcom(:)
rnorm(:) = .unit. (impactors%rb(:,2) - impactors%rb(:,1))
rcom(:) = pl%rb(:,j) - impactors%rbcom(:)
rnorm(:) = .unit. rcom(:)
! Do the reflection
vcom(:) = vcom(:) - 2 * dot_product(vcom(:),rnorm(:)) * rnorm(:)
self%fragments%vb(:,i) = impactors%vbcom(:) + vcom(:)
self%fragments%rb(:,i) = pl%rb(:,j)
self%fragments%mass(i) = pl%mass(j)
self%fragments%Gmass(i) = pl%Gmass(j)
self%fragments%radius(i) = pl%radius(j)
self%fragments%rot(:,i) = pl%rot(:,j)
self%fragments%Ip(:,i) = pl%Ip(:,j)
! Ensure that the bounce doesn't happen again
self%fragments%rb(:,i) = pl%rb(:,j) + 0.5_DP * self%fragments%radius(i) * rnorm(:)
end do
end if

Expand Down Expand Up @@ -302,7 +304,7 @@ module subroutine fraggle_generate_pos_vec(collider)
else if (lsupercat) then
rdistance = 0.5_DP * sum(impactors%radius(:))
else
rdistance = 10 * impactors%radius(2)
rdistance = 2 * impactors%radius(2)
end if
! Give the fragment positions a random value that is scaled with fragment mass so that the more massive bodies tend to be closer to the impact point
! Later, velocities will be scaled such that the farther away a fragment is placed from the impact point, the higher will its velocity be.
Expand Down

0 comments on commit fc6a7eb

Please sign in to comment.