From cbece6cb76628758a4f6cfb109eacec038e075d2 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Mon, 20 Mar 2023 11:05:07 -0400 Subject: [PATCH 1/3] Updated the sundiver test with more massive body to test for angular momentum conservation --- examples/solar_impact/sundiver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 examples/solar_impact/sundiver.py diff --git a/examples/solar_impact/sundiver.py b/examples/solar_impact/sundiver.py old mode 100644 new mode 100755 index 02e320f69..c279b4ec4 --- a/examples/solar_impact/sundiver.py +++ b/examples/solar_impact/sundiver.py @@ -46,9 +46,9 @@ q = 0.9 * swiftest.RSun * sim.M2DU a = 0.1 e = 1.0 - q / a -M = 1e-4 * swiftest.MEarth * sim.KG2MU +M = 2e0 * swiftest.MEarth * sim.KG2MU R = (3 * M / (4 * np.pi * density)) ** (1.0 / 3.0) -rot = 2 * sim.init_cond.sel(name="Earth")['rot'] +rot = 4 * sim.init_cond.sel(name="Earth")['rot'] sim.add_body(name="Sundiver", a=a, e=e, inc=0.0, capom=0.0, omega=0.0, capm=180.0, mass=M, radius=R, Ip=[0.4,0.4,0.4], rot=rot) sim.get_parameter() From 27392867712d36bdbd7bd256e851c22b65138518 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Mon, 20 Mar 2023 11:05:22 -0400 Subject: [PATCH 2/3] Added status check to vb2vh conversion --- src/swiftest/swiftest_util.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/swiftest/swiftest_util.f90 b/src/swiftest/swiftest_util.f90 index cc1b9e398..fcf130f83 100644 --- a/src/swiftest/swiftest_util.f90 +++ b/src/swiftest/swiftest_util.f90 @@ -494,7 +494,7 @@ module subroutine swiftest_util_coord_vb2vh_pl(self, cb) associate(pl => self, npl => self%nbody) cb%vb(:) = 0.0_DP do i = npl, 1, -1 - cb%vb(:) = cb%vb(:) - pl%Gmass(i) * pl%vb(:, i) / cb%Gmass + if (pl%status(i) /= INACTIVE) cb%vb(:) = cb%vb(:) - pl%Gmass(i) * pl%vb(:, i) / cb%Gmass end do do concurrent(i = 1:npl) pl%vh(:, i) = pl%vb(:, i) - cb%vb(:) From e5b28e479aceb9f6f0c8149b58c05841e4dff954 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Mon, 20 Mar 2023 11:19:23 -0400 Subject: [PATCH 3/3] Added the central body's contribution to orbital pre-collision angular momentum to the post-collision spin. --- src/symba/symba_discard.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/symba/symba_discard.f90 b/src/symba/symba_discard.f90 index aa1f52296..a46ce057d 100644 --- a/src/symba/symba_discard.f90 +++ b/src/symba/symba_discard.f90 @@ -186,7 +186,7 @@ subroutine symba_discard_conserve_energy_and_momentum(pl, nbody_system, param, i becb1 = -(3 * cb%Gmass * cb%mass) / (5 * cb%radius) ! Add planet angular momentum to central body accumulator - cb%dL(:) = Lpl(:) + cb%dL(:) + cb%dL(:) = Lpl(:) + cb%dL(:) + Lcb(:) ! Update rotation of central body to by consistent with its angular momentum if (param%lrotation) then drot0(:) = cb%L0(:)/ (cb%Ip(3) * cb%mass * cb%radius**2)