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

Commit

Permalink
Fixed hit and run disruption case
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Dec 29, 2022
1 parent 963bd11 commit 48821cd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/collision/collision_generate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,16 @@ module subroutine collision_generate_disruption_vel_vec(collider)
do concurrent(i = 1:nfrag)
j = fragments%origin_body(i)
vrot(:) = impactors%rot(:,j) .cross. (fragments%rc(:,i) - impactors%rc(:,j))
vmag = vesc * vscale(i) * mass_vscale(i)
if (lhitandrun) then
fragments%vc(:,i) = vmag * impactors%bounce_unit(:) * vsign(i) + vrot(:)
if (i == 1) then
fragments%vc(:,1) = impactors%vc(:,1)
else
vmag = .mag.impactors%vc(:,2) / (maxval(mass_vscale(:) * maxval(vscale(:))))
fragments%vc(:,i) = vmag * mass_vscale(i) * vscale(i) * impactors%bounce_unit(:) * vsign(i) + vrot(:)
end if
else
! Add more velocity dispersion to disruptions vs hit and runs.
vmag = vesc * vscale(i) * mass_vscale(i)
rimp(:) = fragments%rc(:,i) - impactors%rbimp(:)
vimp_unit(:) = .unit. rimp(:)
fragments%vc(:,i) = vmag * (impactors%bounce_unit(:) + vimp_unit(:)) * vsign(i) + vrot(:)
Expand All @@ -594,8 +599,8 @@ module subroutine collision_generate_disruption_vel_vec(collider)
ke_residual = fragments%ke_budget - (fragments%ke_orbit + fragments%ke_spin)
! Make sure we don't take away too much orbital kinetic energy, otherwise the fragment can't escape
ke_avail(:) = fragments%ke_orbit_frag(:) - impactors%Gmass(1)*impactors%mass(2)/fragments%vmag(:)
ke_per_dof = -ke_residual/nfrag
do concurrent(i = 1:nfrag, ke_avail(i) > ke_per_dof)
ke_per_dof = -ke_residual/(nfrag - 1)
do concurrent(i = 2:nfrag, ke_avail(i) > ke_per_dof)
fragments%vmag(i) = sqrt(2 * (fragments%ke_orbit_frag(i) - ke_per_dof)/fragments%mass(i))
fragments%vc(:,i) = fragments%vmag(i) * fragments%v_unit(:,i)
end do
Expand Down

0 comments on commit 48821cd

Please sign in to comment.