From 214e7bab1e9b416a9bcade3723f26e3c4d3b6730 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Wed, 25 Jan 2023 18:31:40 -0500 Subject: [PATCH] More tweaks to ensure repeatability on restart --- src/helio/helio_util.f90 | 4 ++-- src/swiftest/swiftest_util.f90 | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/helio/helio_util.f90 b/src/helio/helio_util.f90 index 7d887a6b2..94b464502 100644 --- a/src/helio/helio_util.f90 +++ b/src/helio/helio_util.f90 @@ -22,9 +22,9 @@ module subroutine helio_util_setup_initialize_system(self, param) class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters call swiftest_util_setup_initialize_system(self, param) - call self%pl%h2b(self%cb) - call self%tp%h2b(self%cb) call self%pl%sort("mass", ascending=.false.) + call self%pl%vh2vb(self%cb) + call self%tp%h2b(self%cb) ! Make sure that the discard list gets allocated initially call self%tp_discards%setup(0, param) diff --git a/src/swiftest/swiftest_util.f90 b/src/swiftest/swiftest_util.f90 index c1efe888f..1c7a40cb1 100644 --- a/src/swiftest/swiftest_util.f90 +++ b/src/swiftest/swiftest_util.f90 @@ -3038,6 +3038,22 @@ module subroutine swiftest_util_snapshot_system(self, param, nbody_system, t, ar ! Internals class(swiftest_nbody_system), allocatable :: snapshot + ! To allow for runs to be restarted in a bit-identical way, we'll need to run the same coordinate conversion routines we would run upon restarting + select type(pl => nbody_system%pl) + class is (whm_pl) + call pl%h2j(nbody_system%cb) + class is (helio_pl) + call pl%vh2vb(nbody_system%cb) + end select + + select type(tp => nbody_system%tp) + class is (helio_tp) + select type(cb => nbody_system%cb) + class is (helio_cb) + call tp%vh2vb(vbcb = -cb%ptbeg) + end select + end select + ! Take a minimal snapshot wihout all of the extra storage objects allocate(snapshot, mold=nbody_system) allocate(snapshot%cb, source=nbody_system%cb )