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

Commit

Permalink
Fixed typos and made relevant changes to account for now unitless rot…
Browse files Browse the repository at this point in the history
…phase
  • Loading branch information
anand43 committed Feb 9, 2024
1 parent bc38920 commit 312abf9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/swiftest/swiftest_drift.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/swiftest/swiftest_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/swiftest/swiftest_sph.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 312abf9

Please sign in to comment.