From 25fcfac18482aef67d44d4bebf17bba72027be15 Mon Sep 17 00:00:00 2001 From: anand43 Date: Mon, 30 Oct 2023 19:30:34 -0400 Subject: [PATCH] New expression for g_sph. I had the wrong conversion from spherical to cartesian. --- src/swiftest/swiftest_sph.f90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/swiftest/swiftest_sph.f90 b/src/swiftest/swiftest_sph.f90 index 69c57b5be..02412d207 100644 --- a/src/swiftest/swiftest_sph.f90 +++ b/src/swiftest/swiftest_sph.f90 @@ -71,14 +71,14 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi, theta, rh, c_lm, g_sph, ! cssc * m = first derivative of ccss with respect to phi ! m > 0 - g_sph(1) = g_sph(1) - GMcb * r_0**l / r_mag**(l + 1) * (-1.0_DP * cssc * m * plm / rh(2) & - - ccss * (dplm * sin(theta) / (rh(3) * cos(phi)) & - + plm * (l + 1) * rh(1) / r_mag**2)) ! g_x - g_sph(2) = g_sph(2) - GMcb * r_0**l / r_mag**(l + 1) * (cssc * m * plm / rh(1) & - - ccss * (dplm * sin(theta) / (rh(3) * sin(phi)) & - + plm * (l + 1) * rh(2) / r_mag**2)) ! g_y - g_sph(3) = g_sph(3) + GMcb * r_0**l / r_mag**(l + 1) * ccss * (dplm * sin(theta) / sqrt(r_mag**2 - rh(3)**2) & - + plm * (l + 1) * rh(3) / r_mag**2) ! g_z + g_sph(1) = g_sph(1) + GMcb * r_0**l / r_mag**(l + 2) * (cssc * m * plm * sin(phi) / sin(theta) & + - ccss * sin(theta) * cos(phi) & + * (dplm * cos(theta) + plm * (l + 1))) ! g_x + g_sph(2) = g_sph(2) - GMcb * r_0**l / r_mag**(l + 2) * (cssc * m * plm * cos(phi) / sin(theta) & + - ccss * sin(theta) * sin(phi) & + * (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