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

Commit

Permalink
Fixed bug that was causing the number of fragments to be computed inc…
Browse files Browse the repository at this point in the history
…orrectly when it grew to be very large
  • Loading branch information
daminton committed Feb 20, 2023
1 parent 2b5ac9f commit d374379
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/fraggle/fraggle_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ module subroutine fraggle_util_set_mass_dist(self, param)
beta = 2.85_DP ! From Leinhardt & Stewart (2012)
Mslr = impactors%mass_dist(iMslr)

mfrag = Mslr
do while (mremaining > 0.0_DP)
mfrag = (nfrag)**(-3._DP / BETA) * impactors%mass_dist(iMslr)
nfragmax = ceiling(NFRAGMAX_UNSCALED / param%nfrag_reduction)
do i = 1, nfragmax
mfrag = (nfrag)**(-3._DP / BETA) * Mslr
mfrag = max(mfrag, min_mfrag)
mremaining = mremaining - mfrag
nfrag = nfrag + 1
if (mremaining < 0.0_DP) exit
end do
nfragmax = ceiling(NFRAGMAX_UNSCALED / param%nfrag_reduction)
nfrag = max(min(ceiling(nfrag / param%nfrag_reduction), nfragmax), NFRAGMIN)

call self%setup_fragments(nfrag)
Expand Down

0 comments on commit d374379

Please sign in to comment.