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

Commit

Permalink
Refactored for line length limits
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 27, 2024
1 parent 74742cf commit 16077ed
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
26 changes: 13 additions & 13 deletions src/swiftest/swiftest_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions src/swiftest/swiftest_obl.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 16077ed

Please sign in to comment.