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

Commit

Permalink
Made position finding more efficient
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 20, 2023
1 parent 7073413 commit 8df230d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/fraggle/fraggle_generate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ module subroutine fraggle_generate_disrupt(self, nbody_system, param, t, lfailur
real(DP) :: dE
real(DP), dimension(NDIM) :: dL
character(len=STRMAX) :: message
real(DP), parameter :: fail_scale_initial = 1.001_DP
real(DP), parameter :: fail_scale_initial = 1.01_DP
integer(I4B) :: nfrag_start

! The minimization and linear solvers can sometimes lead to floating point exceptions. Rather than halting the code entirely if this occurs, we
Expand Down Expand Up @@ -310,7 +310,7 @@ module subroutine fraggle_generate_pos_vec(collider, nbody_system, param, lfailu
real(DP), parameter :: cloud_size_scale_factor = 3.0_DP ! Scale factor to apply to the size of the cloud relative to the distance from the impact point.
! A larger value puts more space between fragments initially
real(DP) :: rbuffer ! Body radii are inflated by this scale factor to prevent secondary collisions
real(DP), parameter :: rbuffer_max = 1.2_DP
real(DP), parameter :: rbuffer_max = 1.02_DP
real(DP), parameter :: pack_density = 0.5236_DP ! packing density of loose spheres
rbuffer = 1.01_DP

Expand Down Expand Up @@ -415,12 +415,14 @@ module subroutine fraggle_generate_pos_vec(collider, nbody_system, param, lfailu
fragments%rmag(:) = .mag. fragments%rc(:,:)

! Check for any overlapping bodies.
loverlap(:) = .false.
!loverlap(:) = .false.
do j = 1, nfrag
if (.not.loverlap(j)) cycle
loverlap(j) = .false.
! Check for overlaps between fragments
do i = j + 1, nfrag
dis = .mag.(fragments%rc(:,j) - fragments%rc(:,i))
loverlap(i) = loverlap(i) .or. (dis <= rbuffer * (fragments%radius(i) + fragments%radius(j)))
loverlap(j) = loverlap(j) .or. (dis <= rbuffer * (fragments%radius(i) + fragments%radius(j)))
end do
! Check for overlaps with existing bodies that are not involved in the collision
do i = 1, npl
Expand Down

0 comments on commit 8df230d

Please sign in to comment.