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

Commit

Permalink
Fixed bug that occurs when L_residual_best is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 13, 2023
1 parent 506bbb8 commit 704eb59
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/Fragmentation/Fragmentation_Movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def vec_props(self, c):

# Set fragmentation parameters
minimum_fragment_gmass = 0.01 * body_Gmass[style][1]
gmtiny = 0.010 * body_Gmass[style][1]
gmtiny = 0.10 * body_Gmass[style][1]
sim.set_parameter(collision_model="fraggle", encounter_save="both", gmtiny=gmtiny, minimum_fragment_gmass=minimum_fragment_gmass, nfrag_reduction=10.0)
sim.run(dt=5e-4, tstop=tstop[style], istep_out=1, dump_cadence=0)

Expand Down
2 changes: 2 additions & 0 deletions src/fraggle/fraggle_generate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu
vimp = .mag. (impactors%vc(:,2) - impactors%vc(:,1))

E_residual_best = huge(1.0_DP)
L_residual_best(:) = 0.0_DP
lfailure = .false.
dE_metric = huge(1.0_DP)
dE_best = huge(1.0_DP)
Expand Down Expand Up @@ -639,6 +640,7 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu
call collider_local%get_energy_and_momentum(nbody_system, param, phase="after")
L_residual(:) = (collider_local%L_total(:,2) - collider_local%L_total(:,1))
L_residual_unit(:) = .unit. L_residual(:)
if (nsteps == 1) L_residual_best(:) = L_residual(:)

! Use equipartition of spin kinetic energy to distribution spin angular momentum
do concurrent(i = istart:fragments%nbody)
Expand Down

0 comments on commit 704eb59

Please sign in to comment.