From e32bfa60cdddabf80230bb4d05feef28c1067ffd Mon Sep 17 00:00:00 2001 From: anand43 Date: Wed, 1 Nov 2023 15:18:45 -0400 Subject: [PATCH] Changed the normalization of the Legendre polynomial --- src/swiftest/swiftest_sph.f90 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/swiftest/swiftest_sph.f90 b/src/swiftest/swiftest_sph.f90 index 32187c62a..eb1c2dbc1 100644 --- a/src/swiftest/swiftest_sph.f90 +++ b/src/swiftest/swiftest_sph.f90 @@ -50,9 +50,9 @@ 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 @@ -60,8 +60,8 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi, theta, rh, c_lm, g_sph, ! 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) & @@ -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