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

Commit

Permalink
Converted another while loop to a do
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Sep 28, 2023
1 parent f859be1 commit 4a6b2f8
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/swiftest/swiftest_sph.f90
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,16 @@ module subroutine swiftest_sph_g_acc_pl_all(self, nbody_system)
associate(pl => self, npl => self%nbody, cb => nbody_system%cb, rh => self%rh)
cb%aobl(:) = 0.0_DP

! do i = 1, npl, pl%lmask(i)
do while ((i .lt. npl) .and. pl%lmask(i))
r_mag = .mag. rh(1:3,i)
theta = atan2(sqrt(rh(1,i)**2 + rh(2,i)**2), rh(3,i))
phi = atan2(rh(2,i), rh(1,i)) - cb%rotphase ! CALCULATE CB PHASE VALUE FOR PHI

call swiftest_sph_g_acc_one(cb%Gmass, r_mag, phi, theta, rh(:,i), cb%c_lm, g_sph, pl%Gmass, cb%aobl)
pl%ah(:, i) = pl%ah(:, i) + g_sph(:) - cb%aobl(:)
pl%aobl(:, i) = g_sph(:)

i = i + 1
do i = 1, npl
if (pl%lmask(i)) then
r_mag = .mag. rh(:,i)
theta = atan2(sqrt(rh(1,i)**2 + rh(2,i)**2), rh(3,i))
phi = atan2(rh(2,i), rh(1,i)) - cb%rotphase ! CALCULATE CB PHASE VALUE FOR PHI

call swiftest_sph_g_acc_one(cb%Gmass, r_mag, phi, theta, rh(:,i), cb%c_lm, g_sph, pl%Gmass, cb%aobl)
pl%ah(:, i) = pl%ah(:, i) + g_sph(:) - cb%aobl(:)
pl%aobl(:, i) = g_sph(:)
end if
end do
end associate
return
Expand Down

0 comments on commit 4a6b2f8

Please sign in to comment.