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

Commit

Permalink
Fixed a potential divide by zero bug
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 23, 2023
1 parent 2423034 commit d466f96
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/collision/collision_regime.f90
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,16 @@ subroutine collision_regime_LS12_SI(Mcb, m1, m2, rad1, rad2, rh1, rh2, vb1, vb2,
Mlr = max((1.0_DP - Qr / Qrd_pstar / 2.0_DP) * Mtot, min_mfrag) ! [kg] # LS12 eq (5)
end if
Mbig = max(m1,Mlr)
Msmall = mtot - Mbig
Mslr_hitandrun = max(calc_Qrd_rev(Msmall, Mbig, Mint, den1, den2, Vimp, c_star), min_mfrag)
if (regime == COLLRESOLVE_REGIME_HIT_AND_RUN ) then
Mslr = Mslr_hitandrun
Msmall = Mtot - Mbig
if (Msmall < min_mfrag) then
regime = COLLRESOLVE_REGIME_MERGE
else
Mslr = max(Mtot * (3.0_DP - BETA) * (1.0_DP - N1 * Mlr / Mtot) / (N2 * BETA), min_mfrag) !LS12 eq (37)
Mslr_hitandrun = max(calc_Qrd_rev(Msmall, Mbig, Mint, den1, den2, Vimp, c_star), min_mfrag)
if (regime == COLLRESOLVE_REGIME_HIT_AND_RUN ) then
Mslr = Mslr_hitandrun
else
Mslr = max(Mtot * (3.0_DP - BETA) * (1.0_DP - N1 * Mlr / Mtot) / (N2 * BETA), min_mfrag) !LS12 eq (37)
end if
end if

Mresidual = Mtot - Mlr - Mslr
Expand Down

0 comments on commit d466f96

Please sign in to comment.