diff --git a/src/swiftest/swiftest_drift.f90 b/src/swiftest/swiftest_drift.f90 index 864c745ec..c67e03be5 100644 --- a/src/swiftest/swiftest_drift.f90 +++ b/src/swiftest/swiftest_drift.f90 @@ -583,15 +583,17 @@ end subroutine swiftest_drift_kepu_stumpff module subroutine swiftest_drift_cb_rotphase_update(self, param, dt) !! Author : Kaustub Anand !! subroutine to update the rotation phase of the central body - !! Units: Radians + !! Units: None + !! !! initial 0 is set at the x-axis + !! phase is stored and calculated in a unitless manner, i.e., a phase of 0, 0.5, 1 = 0, pi, 2pi radians = 0, 180, 360 degrees ! Arguments class(swiftest_cb), intent(inout) :: self !! Swiftest central body data structure class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters real(DP), intent(in) :: dt !! Stepsize - self%rotphase = MOD(self%rotphase + (.mag. self%rot(:)) * dt * param%TU2S, 2 * PI) ! radians + self%rotphase = MOD(self%rotphase + (.mag. self%rot(:)) * dt * param%TU2S, 2 * PI) / (2 * PI) ! phase angle calculated in radians and then scaled by 2pi to be unitless end subroutine swiftest_drift_cb_rotphase_update diff --git a/src/swiftest/swiftest_sph.f90 b/src/swiftest/swiftest_sph.f90 index 4c7d6bd7c..3f6b7f40c 100644 --- a/src/swiftest/swiftest_sph.f90 +++ b/src/swiftest/swiftest_sph.f90 @@ -26,7 +26,7 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi_cb, rh, c_lm, g_sph, GMp ! Arguments real(DP), intent(in) :: GMcb !! GMass of the central body real(DP), intent(in) :: r_0 !! radius of the central body - real(DP), intent(in) :: phi_cb !! rotation phase of the central body + real(DP), intent(in) :: phi_cb !! rotation phase of the central body (from 0 to 1) real(DP), intent(in), dimension(:) :: rh !! distance vector of body real(DP), intent(in), dimension(:, :, :) :: c_lm !! Spherical Harmonic coefficients real(DP), intent(out), dimension(NDIM) :: g_sph !! acceleration vector @@ -47,6 +47,7 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi_cb, rh, c_lm, g_sph, GMp real(DP) :: fac1, fac2, r_fac !! calculation factors g_sph(:) = 0.0_DP + phi_cb = phi_cb * 2 * PI ! scale the phase by 2pi radians theta = atan2(sqrt(rh(1)**2 + rh(2)**2), rh(3)) phi = atan2(rh(2), rh(1)) phi_bar = MOD(phi - phi_cb, 2 * PI) ! represents the phase difference between the central body's and the particle's phase