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

Commit

Permalink
Checked for 1/0 term when sin_theta = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
anand43 committed Nov 16, 2023
1 parent 9675e14 commit d8e23dc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/swiftest/swiftest_sph.f90
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,16 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi, theta, rh, c_lm, g_sph,
! Condensed form

! fac0 = -(m * cos_tmp * plm / sin_tmp - plm1) / sin_tmp ! dplm
fac1 = m * plm / sin_theta
fac2 = plm * (l + m + 1) * sin_theta + plm1 * cos_theta
fac3 = fac2 - fac1
! fac3 = plm * (l + m + 1) * cos_theta
! fac4 = plm1 * sin_theta
if(sin_theta .eq. 0) then
fac1 = 0.0_DP
else
fac1 = m * plm / sin_theta
end if

fac2 = plm * (l + m + 1) * sin_theta + plm1 * cos_theta
fac3 = fac2 - fac1
r_fac = -GMcb * r_0**l / r_mag**(l + 2)

! g_sph(:) = 0.0_DP
Expand Down

0 comments on commit d8e23dc

Please sign in to comment.