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

Commit

Permalink
Put a limiter on the outer loop to keep Fraggle from churning away ne…
Browse files Browse the repository at this point in the history
…edlessly when nfrag is very large
  • Loading branch information
daminton committed Feb 13, 2023
1 parent 5af4b8d commit f8066b9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/fraggle/fraggle_generate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,8 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu
real(DP), parameter :: hitandrun_vscale = 0.25_DP
real(DP) :: vmin_guess
real(DP) :: vmax_guess
integer(I4B), parameter :: MAXINNER = 20
integer(I4B), parameter :: MAXLOOP = 20
integer(I4B), parameter :: MAXTRY = 10
integer(I4B), parameter :: MAXANGMTM = 1000
class(collision_fraggle), allocatable :: collider_local
character(len=STRMAX) :: message
Expand All @@ -555,7 +556,7 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu
dE_best = huge(1.0_DP)
nsteps_best = 0
nsteps = 0
outer: do try = 1, nfrag - istart - 1
outer: do try = 1, min(nfrag - istart - 1, MAXTRY)
associate(fragments => collider_local%fragments)
if (allocated(vsign)) deallocate(vsign); allocate(vsign(fragments%nbody))
if (allocated(vscale)) deallocate(vscale); allocate(vscale(fragments%nbody))
Expand Down Expand Up @@ -611,7 +612,7 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu
call fragments%set_coordinate_system()

E_residual = huge(1.0_DP)
inner: do loop = 1, MAXINNER
inner: do loop = 1, MAXLOOP
nsteps = nsteps + 1
mfrag = sum(fragments%mass(istart:fragments%nbody))

Expand Down

0 comments on commit f8066b9

Please sign in to comment.