From 312abf920eb8b73e332403a5d6e44ad48f12c988 Mon Sep 17 00:00:00 2001 From: anand43 Date: Fri, 9 Feb 2024 16:57:58 -0500 Subject: [PATCH] Fixed typos and made relevant changes to account for now unitless rotphase --- src/swiftest/swiftest_drift.f90 | 2 +- src/swiftest/swiftest_module.f90 | 8 ++++---- src/swiftest/swiftest_sph.f90 | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/swiftest/swiftest_drift.f90 b/src/swiftest/swiftest_drift.f90 index c67e03be5..c6f2a4c99 100644 --- a/src/swiftest/swiftest_drift.f90 +++ b/src/swiftest/swiftest_drift.f90 @@ -593,7 +593,7 @@ module subroutine swiftest_drift_cb_rotphase_update(self, param, dt) 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) / (2 * PI) ! phase angle calculated in radians and then scaled by 2pi to be unitless + self%rotphase = MOD(self%rotphase + (.mag. self%rot(:)) * dt * param%TU2S / (2 * PI), 1.0_DP) ! 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_module.f90 b/src/swiftest/swiftest_module.f90 index 3cc49ada3..72c029a30 100644 --- a/src/swiftest/swiftest_module.f90 +++ b/src/swiftest/swiftest_module.f90 @@ -212,7 +212,7 @@ module swiftest real(DP), dimension(NDIM) :: agr = 0.0_DP !! Acceleration due to post-Newtonian correction real(DP), dimension(NDIM) :: Ip = 0.0_DP !! Unitless principal moments of inertia (I1, I2, I3) / (MR**2). Principal axis rotation assumed. real(DP), dimension(NDIM) :: rot = 0.0_DP !! Body rotation vector in inertial coordinate frame (units rad / TU) - real(DP) :: rotphase = 0.0_DP !! Body rotation phase about the rotation pole (0 to 2*pi) + real(DP) :: rotphase = 0.0_DP !! Body rotation phase about the rotation pole (0 to 1) real(DP) :: k2 = 0.0_DP !! Tidal Love number real(DP) :: Q = 0.0_DP !! Tidal quality factor real(DP) :: tlag = 0.0_DP !! Tidal phase lag angle @@ -547,7 +547,7 @@ end subroutine swiftest_drift_one 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 ! Arguments @@ -1857,11 +1857,11 @@ end subroutine swiftest_coarray_cocollect_tp #endif interface - module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi_cb, rh, c_lm, g_sph, GMpl, aoblcb) + module subroutine swiftest_sph_g_acc_one(GMcb, r_0, rotphase, rh, c_lm, g_sph, GMpl, aoblcb) implicit none 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) :: rotphase !! rotation phase of the central body 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 diff --git a/src/swiftest/swiftest_sph.f90 b/src/swiftest/swiftest_sph.f90 index 3f6b7f40c..29eaa18b6 100644 --- a/src/swiftest/swiftest_sph.f90 +++ b/src/swiftest/swiftest_sph.f90 @@ -16,7 +16,7 @@ contains - module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi_cb, rh, c_lm, g_sph, GMpl, aoblcb) + module subroutine swiftest_sph_g_acc_one(GMcb, r_0, rotphase, rh, c_lm, g_sph, GMpl, aoblcb) !! author: Kaustub P. Anand !! !! Calculate the acceleration terms for one pair of bodies given c_lm, theta, phi, r @@ -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 (from 0 to 1) + real(DP), intent(in) :: rotphase !! rotation phase of the central body 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 @@ -38,7 +38,7 @@ module subroutine swiftest_sph_g_acc_one(GMcb, r_0, phi_cb, rh, c_lm, g_sph, GMp integer :: l_max !! max Spherical Harmonic l order value integer(I4B) :: N, lmindex !! Length of Legendre polynomials and index at a given l, m real(DP) :: r_mag !! magnitude of rh - real(DP) :: phi, phi_bar !! Azimuthal/Phase angle (radians) wrt coordinate axes, and central body rotation phase + real(DP) :: phi, phi_cb, phi_bar !! Azimuthal/Phase angle (radians) wrt coordinate axes, and central body rotation phase real(DP) :: theta !! Inclination/Zenith angle (radians) real(DP) :: plm, plm1 !! Associated Legendre polynomials at a given l, m real(DP) :: ccss, cssc !! See definition in source code @@ -47,7 +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 + phi_cb = rotphase * 2 * PI ! scale the phase to a phase angle 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