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

Commit

Permalink
Restricted angular momentum conservation
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 2, 2023
1 parent 62aedd2 commit a68813a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/fraggle/fraggle_generate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu
logical, intent(out) :: lfailure !! Did the velocity computation fail?
! Internals
real(DP), parameter :: ENERGY_SUCCESS_METRIC = 1.0e-4_DP !! Relative energy error to accept as a success (success also must be energy-losing in addition to being within the metric amount)
real(DP), parameter :: MOMENTUM_SUCCESS_METRIC = 1.0e-12_DP !! Relative angular momentum error to accept as a success (should be *much* stricter than energy)
real(DP) :: MOMENTUM_SUCCESS_METRIC = epsilon(1.0_DP) !! Relative angular momentum error to accept as a success (should be *much* stricter than energy)
integer(I4B) :: i, j, loop, try, istart, nfrag, nsteps, nsteps_best
logical :: lhitandrun, lsupercat
real(DP), dimension(NDIM) :: vimp_unit, rimp, vrot, L_residual, L_residual_unit, dL, drot, rot_new
Expand Down Expand Up @@ -604,7 +604,7 @@ module subroutine fraggle_generate_vel_vec(collider, nbody_system, param, lfailu
angmtm: do j = 1, MAXTRY
call collider_local%get_energy_and_momentum(nbody_system, param, phase="after")
L_residual(:) = (collider_local%L_total(:,2) - collider_local%L_total(:,1))
dL_metric = .mag.L_residual(:) / .mag.collider_local%L_total(:,1)
dL_metric = .mag.L_residual(:) / .mag.(collider_local%L_total(:,1))

if (dL_metric <= MOMENTUM_SUCCESS_METRIC) exit angmtm
L_residual_unit(:) = .unit. L_residual(:)
Expand Down

0 comments on commit a68813a

Please sign in to comment.