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

Commit

Permalink
New expression for g_sph. I had the wrong conversion from spherical t…
Browse files Browse the repository at this point in the history
…o cartesian.
  • Loading branch information
anand43 committed Oct 30, 2023
1 parent 7b19426 commit 25fcfac
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/swiftest/swiftest_sph.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 25fcfac

Please sign in to comment.