From 16077ede70fe8dc4c81a1c79808480e0880c967a Mon Sep 17 00:00:00 2001 From: David Minton Date: Tue, 27 Feb 2024 12:41:43 -0500 Subject: [PATCH] Refactored for line length limits --- src/swiftest/swiftest_module.f90 | 26 +++++++++++++------------- src/swiftest/swiftest_obl.f90 | 20 ++++++++++++-------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/swiftest/swiftest_module.f90 b/src/swiftest/swiftest_module.f90 index 1325cc1c4..0e0c40749 100644 --- a/src/swiftest/swiftest_module.f90 +++ b/src/swiftest/swiftest_module.f90 @@ -409,23 +409,23 @@ module swiftest ! These are concrete because they are the same implemenation for all integrators procedure :: make_impactors => swiftest_util_make_impactors_pl !! Make impactors out of the current kinship relationships - procedure :: discard => swiftest_discard_pl + procedure :: discard => swiftest_discard_pl !! Placeholder method for discarding massive bodies - procedure :: accel_int => swiftest_kick_getacch_int_pl + procedure :: accel_int => swiftest_kick_getacch_int_pl !! Compute direct cross (third) term heliocentric accelerations of massive bodies - procedure :: accel_non_spherical_cb => swiftest_obl_acc_pl + procedure :: accel_non_spherical_cb => swiftest_non_spherical_cb_acc_pl !! Compute the barycentric accelerations of bodies due to the oblateness of the central body - procedure :: setup => swiftest_util_setup_pl + procedure :: setup => swiftest_util_setup_pl !! A base constructor that sets the number of bodies and allocates and initializes all arrays ! procedure :: accel_tides => tides_kick_getacch_pl !! Compute the accelerations of bodies due to tidal interactions with the central body - procedure :: append => swiftest_util_append_pl + procedure :: append => swiftest_util_append_pl !! Appends elements from one structure to another - procedure :: h2b => swiftest_util_coord_h2b_pl + procedure :: h2b => swiftest_util_coord_h2b_pl !! Convert massive bodies from heliocentric to barycentric coordinates (position and velocity) - procedure :: b2h => swiftest_util_coord_b2h_pl + procedure :: b2h => swiftest_util_coord_b2h_pl !! Convert massive bodies from barycentric to heliocentric coordinates (position and velocity) - procedure :: vh2vb => swiftest_util_coord_vh2vb_pl + procedure :: vh2vb => swiftest_util_coord_vh2vb_pl !! Convert massive bodies from heliocentric to barycentric coordinates (velocity only) procedure :: vb2vh => swiftest_util_coord_vb2vh_pl !! Convert massive bodies from barycentric to heliocentric coordinates (velocity only) @@ -486,7 +486,7 @@ module swiftest !! Check to see if test particles should be discarded based on their positions relative to the massive bodies procedure :: accel_int => swiftest_kick_getacch_int_tp !! Compute direct cross (third) term heliocentric accelerations of test particles by massive bodies - procedure :: accel_non_spherical_cb => swiftest_obl_acc_tp + procedure :: accel_non_spherical_cb => swiftest_non_spherical_cb_acc_tp !! Compute the barycentric accelerations of bodies due to the oblateness of the central body procedure :: setup => swiftest_util_setup_tp !! A base constructor that sets the number of bodies and @@ -1593,21 +1593,21 @@ module subroutine swiftest_obl_acc(n, GMcb, j2rp2, j4rp4, rh, lmask, aobl, rot, !! Barycentric acceleration of central body (only needed if input bodies are massive) end subroutine swiftest_obl_acc - module subroutine swiftest_obl_acc_pl(self, nbody_system) + module subroutine swiftest_non_spherical_cb_acc_pl(self, nbody_system) implicit none class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object class(swiftest_nbody_system), intent(inout) :: nbody_system !! Swiftest nbody system object - end subroutine swiftest_obl_acc_pl + end subroutine swiftest_non_spherical_cb_acc_pl - module subroutine swiftest_obl_acc_tp(self, nbody_system) + module subroutine swiftest_non_spherical_cb_acc_tp(self, nbody_system) implicit none class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object class(swiftest_nbody_system), intent(inout) :: nbody_system !! Swiftest nbody system object - end subroutine swiftest_obl_acc_tp + end subroutine swiftest_non_spherical_cb_acc_tp module subroutine swiftest_obl_pot_system(self) implicit none diff --git a/src/swiftest/swiftest_obl.f90 b/src/swiftest/swiftest_obl.f90 index ae3f2cb32..c2ecbb51f 100644 --- a/src/swiftest/swiftest_obl.f90 +++ b/src/swiftest/swiftest_obl.f90 @@ -44,7 +44,8 @@ pure function matinv3(A) result(B) module subroutine swiftest_obl_rot_matrix(n, rot, rot_matrix, rot_matrix_inv) !! author: Kaustub P. Anand !! - !! Generate a rotation matrix and its inverse to rotate the coordinate frame to align the rotation axis along the z axis for correct spin calculation + !! Generate a rotation matrix and its inverse to rotate the coordinate frame to align the rotation axis along the z axis for + !! correct spin calculation !! implicit none @@ -95,7 +96,8 @@ module subroutine swiftest_obl_rot_matrix(n, rot, rot_matrix, rot_matrix_inv) continue end if - rot_matrix_inv(i, j) = rot_matrix_inv(i, j) + u(i) * u(j) * (1 - cos(theta)) + S_matrix(i, j) * sin(theta) ! Skew-symmetric matrix + Tensor product matrix + ! Skew-symmetric matrix + Tensor product matrix + rot_matrix_inv(i, j) = rot_matrix_inv(i, j) + u(i) * u(j) * (1 - cos(theta)) + S_matrix(i, j) * sin(theta) end do end do @@ -136,7 +138,8 @@ module subroutine swiftest_obl_acc(n, GMcb, j2rp2, j4rp4, rh, lmask, aobl, rot, real(DP), dimension(:,:), intent(out) :: aobl !! Barycentric acceleration of bodies due to central body oblateness real(DP), dimension(NDIM), intent(in) :: rot !! Central body rotation matrix real(DP), dimension(:), intent(in), optional :: GMpl !! Masses of input bodies if they are not test particles - real(DP), dimension(:), intent(out), optional :: aoblcb !! Barycentric acceleration of central body (only needed if input bodies are massive) + real(DP), dimension(:), intent(out), optional :: aoblcb + !! Barycentric acceleration of central body (only needed if input bodies are massive) ! Internals integer(I4B) :: i @@ -209,7 +212,7 @@ module subroutine swiftest_obl_acc(n, GMcb, j2rp2, j4rp4, rh, lmask, aobl, rot, end subroutine swiftest_obl_acc - module subroutine swiftest_obl_acc_pl(self, nbody_system) + module subroutine swiftest_non_spherical_cb_acc_pl(self, nbody_system) !! author: David A. Minton !! !! Compute the barycentric accelerations of massive bodies due to the oblateness of the central body @@ -244,10 +247,10 @@ module subroutine swiftest_obl_acc_pl(self, nbody_system) return - end subroutine swiftest_obl_acc_pl + end subroutine swiftest_non_spherical_cb_acc_pl - module subroutine swiftest_obl_acc_tp(self, nbody_system) + module subroutine swiftest_non_spherical_cb_acc_tp(self, nbody_system) !! author: David A. Minton !! !! Compute the barycentric accelerations of massive bodies due to the oblateness of the central body @@ -288,7 +291,7 @@ module subroutine swiftest_obl_acc_tp(self, nbody_system) end associate return - end subroutine swiftest_obl_acc_tp + end subroutine swiftest_non_spherical_cb_acc_tp module subroutine swiftest_obl_pot_system(self) @@ -328,7 +331,8 @@ end subroutine swiftest_obl_pot_system elemental function swiftest_obl_pot_one(GMcb, GMpl, j2rp2, j4rp4, zh, irh) result(oblpot) !! author: David A. Minton !! - !! Compute the contribution to the total gravitational potential due solely to the oblateness of the central body from a single massive body + !! Compute the contribution to the total gravitational potential due solely to the oblateness of the central body from a + !! single massive body !! Returned value does not include monopole term or terms higher than J4 !! !! Reference: MacMillan, W. D. 1958. The Theory of the Potential, (Dover Publications), 363.