diff --git a/src/util/util_sort.f90 b/src/util/util_sort.f90 index c81ced32d..c08343cee 100644 --- a/src/util/util_sort.f90 +++ b/src/util/util_sort.f90 @@ -25,6 +25,10 @@ module subroutine util_sort_body(self, sortby, ascending) select case(sortby) case("id") call util_sort(direction * body%id(1:n), ind(1:n)) + case("status") + call util_sort(direction * body%status(1:n), ind(1:n)) + case("ir3h") + call util_sort(direction * body%ir3h(1:n), ind(1:n)) case("a") call util_sort(direction * body%a(1:n), ind(1:n)) case("e") @@ -35,7 +39,7 @@ module subroutine util_sort_body(self, sortby, ascending) call util_sort(direction * body%capom(1:n), ind(1:n)) case("mu") call util_sort(direction * body%mu(1:n), ind(1:n)) - case("lfirst", "nbody","xh", "vh", "xb", "vb", "ah", "aobl", "atide", "agr") + case("lfirst", "nbody", "ldiscard", "xh", "vh", "xb", "vb", "ah", "aobl", "atide", "agr") write(*,*) 'Cannot sort by ' // trim(adjustl(sortby)) // '. Component not sortable!' case default write(*,*) 'Cannot sort by ' // trim(adjustl(sortby)) // '. Component not found!' diff --git a/src/whm/whm_setup.f90 b/src/whm/whm_setup.f90 index 940ba0b26..733adc871 100644 --- a/src/whm/whm_setup.f90 +++ b/src/whm/whm_setup.f90 @@ -53,8 +53,8 @@ module subroutine whm_util_set_mu_eta_pl(self, cb) !! Sets the Jacobi mass value eta for all massive bodies implicit none ! Arguments - class(whm_pl), intent(inout) :: self !! Swiftest system object - class(swiftest_cb), intent(inout) :: cb !! Swiftest central body particle data structure + class(whm_pl), intent(inout) :: self !! WHM system object + class(swiftest_cb), intent(inout) :: cb !! Swiftest central body object ! Internals integer(I4B) :: i @@ -82,6 +82,9 @@ module subroutine whm_setup_initialize_system(self, param) class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters call setup_initialize_system(self, param) + ! First we need to make sure that the massive bodies are sorted by heliocentric distance before computing jacobies + call util_set_ir3h(self%pl) + call self%pl%sort("ir3h", ascending=.false.) ! Make sure that the discard list gets allocated initially call self%tp_discards%setup(self%tp%nbody) call self%pl%set_mu(self%cb)