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

Commit

Permalink
Changed the normalization of the Legendre polynomial
Browse files Browse the repository at this point in the history
  • Loading branch information
anand43 committed Nov 1, 2023
1 parent c0afdf1 commit e32bfa6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/swiftest/swiftest_sph.f90
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi, theta, rh, c_lm, g_sph,
allocate(p(N),p_deriv(N))

if(cos(theta) > epsilon(0.0_DP)) then
call PlmON_d1(p, p_deriv, l_max, cos(theta)) ! Orthonormalized Associated Legendre Polynomials and the 1st Derivative
call PLegendreA_d1(p, p_deriv, l_max, cos(theta)) ! Unnormalized Associated Legendre Polynomials and the 1st Derivative
else
call PlmON_d1(p, p_deriv, l_max, 0.0_DP)
call PLegendreA_d1(p, p_deriv, l_max, 0.0_DP)
end if

do l = 1, l_max ! skipping the l = 0 term; It is the spherical body term
do m = 0, l

! Associated Legendre Polynomials
lmindex = PlmIndex(l, m)
plm = p(lmindex) ! p_l,m
dplm = p_deriv(lmindex) ! d(p_l,m)
plm = p(lmindex) ! p_l,m
dplm = p_deriv(lmindex) ! d(p_l,m)

! C_lm and S_lm with Cos and Sin of m * phi
ccss = c_lm(m+1, l+1, 1) * cos(m * phi) &
Expand All @@ -79,6 +79,7 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi, theta, rh, c_lm, g_sph,
* (dplm * cos(theta) + plm * (l + 1))) ! g_y
g_sph(3) = g_sph(3) - GMcb * r_0**l / r_mag**(l + 2) * ccss * (-1.0_DP * dplm * sin(theta)**2 &
+ plm * (l + 1) * cos(theta)) ! g_z

end do
end do

Expand Down

0 comments on commit e32bfa6

Please sign in to comment.