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

Commit

Permalink
Restored some floating point operations to make them closer to the Sw…
Browse files Browse the repository at this point in the history
…ifter version
  • Loading branch information
daminton committed May 16, 2023
1 parent ca9eaa4 commit 9adbcfe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/swiftest/swiftest_kick.f90
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ pure module subroutine swiftest_kick_getacch_int_one_tp(rji2, xr, yr, zr, GMpl,
! Internals
real(DP) :: fac

fac = GMpl * sqrt(1.0_DP / (rji2*rji2*rji2))
fac = GMpl / (rji2*sqrt(rji2))
ax = ax - fac * xr
ay = ay - fac * yr
az = az - fac * zr
Expand Down
2 changes: 1 addition & 1 deletion src/swiftest/swiftest_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2609,7 +2609,7 @@ module subroutine swiftest_util_snapshot_system(self, param, nbody_system, t, ar
end select
end select

call nbody_system%pl%set_rhill(nbody_system%cb)
if (.not.param%lrhill_present) call nbody_system%pl%set_rhill(nbody_system%cb)

! Take a minimal snapshot wihout all of the extra storage objects
allocate(snapshot, mold=nbody_system)
Expand Down
5 changes: 2 additions & 3 deletions src/whm/whm_kick.f90
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,13 @@ function whm_kick_getacch_ah0(mu, rhp, n) result(ah0)
! Result
real(DP), dimension(NDIM) :: ah0
! Internals
real(DP) :: fac, r2, ir3h, irh
real(DP) :: fac, r2, ir3h
integer(I4B) :: i

ah0(:) = 0.0_DP
do i = 1, n
r2 = dot_product(rhp(:, i), rhp(:, i))
irh = 1.0_DP / sqrt(r2)
ir3h = irh / r2
ir3h = 1.0_DP / (r2 * sqrt(r2))
fac = mu(i) * ir3h
ah0(:) = ah0(:) - fac * rhp(:, i)
end do
Expand Down

0 comments on commit 9adbcfe

Please sign in to comment.