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

Commit

Permalink
Fixed mu in helio drift step to be central body GMass
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jul 7, 2021
1 parent 693bf2e commit 304bfeb
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/helio/helio_drift.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ module subroutine helio_drift_pl(self, system, param, dt)
integer(I4B) :: i !! Loop counter
real(DP) :: rmag, vmag2, energy
integer(I4B), dimension(:),allocatable :: iflag !! Vectorized error code flag
real(DP), dimension(:), allocatable :: dtp
real(DP), dimension(:), allocatable :: dtp, mu

associate(pl => self, npl => self%nbody)
associate(pl => self, npl => self%nbody, cb => system%cb)
if (npl == 0) return

allocate(iflag(npl))
iflag(:) = 0
allocate(dtp(npl))
allocate(mu(npl))
mu = cb%Gmass

if (param%lgr) then
do i = 1,npl
Expand All @@ -40,7 +42,7 @@ module subroutine helio_drift_pl(self, system, param, dt)
dtp(:) = dt
end if

call drift_one(pl%mu(1:npl), pl%xh(1,1:npl), pl%xh(2,1:npl), pl%xh(3,1:npl), &
call drift_one(mu(1:npl), pl%xh(1,1:npl), pl%xh(2,1:npl), pl%xh(3,1:npl), &
pl%vb(1,1:npl), pl%vb(2,1:npl), pl%vb(3,1:npl), &
dtp(1:npl), iflag(1:npl))
if (any(iflag(1:npl) /= 0)) then
Expand Down Expand Up @@ -99,14 +101,16 @@ module subroutine helio_drift_tp(self, system, param, dt)
! Internals
integer(I4B) :: i !! Loop counter
real(DP) :: rmag, vmag2, energy
real(DP), dimension(:), allocatable :: dtp
real(DP), dimension(:), allocatable :: dtp, mu
integer(I4B), dimension(:),allocatable :: iflag !! Vectorized error code flag

associate(tp => self, ntp => self%nbody)
associate(tp => self, ntp => self%nbody, cb => system%cb)
if (ntp == 0) return
allocate(iflag(ntp))
allocate(dtp(ntp))
iflag(:) = 0
allocate(mu(ntp))
mu = cb%Gmass

if (param%lgr) then
do i = 1,ntp
Expand All @@ -118,7 +122,7 @@ module subroutine helio_drift_tp(self, system, param, dt)
else
dtp(:) = dt
end if
call drift_one(tp%mu(1:ntp), tp%xh(1,1:ntp), tp%xh(2,1:ntp), tp%xh(3,1:ntp), &
call drift_one(mu(1:ntp), tp%xh(1,1:ntp), tp%xh(2,1:ntp), tp%xh(3,1:ntp), &
tp%vh(1,1:ntp), tp%vh(2,1:ntp), tp%vh(3,1:ntp), &
dtp(1:ntp), iflag(1:ntp))
if (any(iflag(1:ntp) /= 0)) then
Expand Down

0 comments on commit 304bfeb

Please sign in to comment.