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

Commit

Permalink
Fixed up typos and mismatched intents, allowing the discards to alter…
Browse files Browse the repository at this point in the history
… param%rmin
  • Loading branch information
daminton committed Aug 4, 2021
1 parent ffd42d7 commit cfedcd5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/discard/discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module subroutine discard_system(self, param)
implicit none
! Arguments
class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
! Internals
logical :: lany_discards

Expand All @@ -36,7 +36,7 @@ module subroutine discard_pl(self, system, param)
! Arguments
class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameter
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameter

if (self%nbody == 0) return
self%ldiscard(:) = .false.
Expand All @@ -56,7 +56,7 @@ module subroutine discard_tp(self, system, param)
! Arguments
class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameter
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameter

associate(tp => self, ntp => self%nbody, cb => system%cb, pl => system%pl, npl => system%pl%nbody)
if ((ntp == 0) .or. (npl ==0)) return
Expand Down
2 changes: 1 addition & 1 deletion src/modules/rmvs_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module subroutine rmvs_discard_tp(self, system, param)
implicit none
class(rmvs_tp), intent(inout) :: self !! RMVS test particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine rmvs_discard_tp

module function rmvs_encounter_check_tp(self, system, dt) result(lencounter)
Expand Down
8 changes: 4 additions & 4 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ subroutine abstract_discard_body(self, system, param)
import swiftest_body, swiftest_nbody_system, swiftest_parameters
class(swiftest_body), intent(inout) :: self !! Swiftest body object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine abstract_discard_body

subroutine abstract_accel(self, system, param, t, lbeg)
Expand Down Expand Up @@ -384,20 +384,20 @@ module subroutine discard_pl(self, system, param)
implicit none
class(swiftest_pl), intent(inout) :: self !! Swiftest massive body object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameter
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameter
end subroutine discard_pl

module subroutine discard_system(self, param)
implicit none
class(swiftest_nbody_system), intent(inout) :: self !! Swiftest system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine discard_system

module subroutine discard_tp(self, system, param)
implicit none
class(swiftest_tp), intent(inout) :: self !! Swiftest test particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine discard_tp

module pure subroutine drift_all(mu, x, v, n, param, dt, mask, iflag)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ module subroutine symba_discard_pl(self, system, param)
implicit none
class(symba_pl), intent(inout) :: self !! SyMBA test particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
end subroutine symba_discard_pl

module subroutine symba_drift_pl(self, system, param, dt)
Expand Down
2 changes: 1 addition & 1 deletion src/rmvs/rmvs_discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module subroutine rmvs_discard_tp(self, system, param)
! Arguments
class(rmvs_tp), intent(inout) :: self !! RMVS test particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
! Internals
integer(I4B) :: i

Expand Down
24 changes: 12 additions & 12 deletions src/symba/symba_discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,25 @@ subroutine symba_discard_conserve_mtm(pl, system, param, ipl, lescape_body)
! Add planet mass to central body accumulator
if (lescape_body) then
system%Mescape = system%Mescape + pl%mass(ipl)
do i = 1, npl
do i = 1, pl%nbody
if (i == ipl) cycle
pe = pe - pl%mass(i) * pl%mass(ipl) / norm2(xb(:, ipl) - xb(:, i))
pe = pe - pl%mass(i) * pl%mass(ipl) / norm2(pl%xb(:, ipl) - pl%xb(:, i))
end do

Ltot(:) = 0.0_DP
do i = 1, npl
Lpl(:) = mass(i) * pl%xb(:,i) .cross. pl%vb(:, i)
do i = 1, pl%nbody
Lpl(:) = pL%mass(i) * pl%xb(:,i) .cross. pl%vb(:, i)
Ltot(:) = Ltot(:) + Lpl(:)
end do
Ltot(:) = Ltot(:) + cb%mass * cb%xb(:) .cross. cb%vb(:)
call pl%b2h(cb)
oldstat = status(ipl)
oldstat = pl%status(ipl)
pl%status(ipl) = INACTIVE
call pl%h2b(cb)
pl%status(ipl) = oldstat
do i = 1, npl
do i = 1, pl%nbody
if (i == ipl) cycle
Lpl(:) = mass(i) * pl%xb(:,i) .cross. pl%vb(:, i)
Lpl(:) = pl%mass(i) * pl%xb(:,i) .cross. pl%vb(:, i)
Ltot(:) = Ltot(:) - Lpl(:)
end do
Ltot(:) = Ltot(:) - cb%mass * cb%xb(:) .cross. cb%vb(:)
Expand Down Expand Up @@ -198,9 +198,9 @@ subroutine symba_discard_nonplpl_conservation(pl, system, param)
!! we need to track the conserved quantities with the system bookkeeping terms.
implicit none
! Arguments
class(symba_pl), intent(inout) :: pl !! SyMBA test particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(symba_pl), intent(inout) :: pl !! SyMBA test particle object
class(symba_nbody_system), intent(inout) :: system !! SyMBA nbody system object
class(symba_parameters), intent(inout) :: param !! Current run configuration parameters
! Internals
integer(I4B) :: i, ndiscard, dstat
logical :: lescape
Expand Down Expand Up @@ -284,7 +284,7 @@ module subroutine symba_discard_pl(self, system, param)
! Arguments
class(symba_pl), intent(inout) :: self !! SyMBA test particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters

select type(system)
class is (symba_nbody_system)
Expand All @@ -310,7 +310,7 @@ module subroutine symba_discard_pl(self, system, param)

if (any(pl%ldiscard(:))) then
call symba_discard_nonplpl_conservation(self, system, param)
call pl%rearray(self, system, param)
!call pl%rearray(self, system, param)
end if

end associate
Expand Down

0 comments on commit cfedcd5

Please sign in to comment.