This repository was archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bunch of mismatched interfaces and trying to troubleshoot energy growth during discards with the central body
- Loading branch information
Showing
8 changed files
with
149 additions
and
154 deletions.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,87 +1,53 @@ | ||
| !********************************************************************************************************************************** | ||
| ! | ||
| ! Unit Name : symba_discard_pl | ||
| ! Unit Type : subroutine | ||
| ! Project : Swiftest | ||
| ! Package : symba | ||
| ! Language : Fortran 90/95 | ||
| ! | ||
| ! Description : Check to see if planets should be discarded based on their positions or because they are unbound | ||
| ! | ||
| ! Input | ||
| ! Arguments : t : time | ||
| ! npl : number of planets | ||
| ! symba_pl1P : pointer to head of SyMBA planet structure linked-list | ||
| ! symba_pld1P : pointer to head of discard SyMBA planet structure linked-list | ||
| ! rmin : minimum allowed heliocentric radius | ||
| ! rmax : maximum allowed heliocentric radius | ||
| ! rmaxu : maximum allowed heliocentric radius for unbound planets | ||
| ! qmin : minimum allowed pericenter distance | ||
| ! qmin_coord : coordinate frame for qmin | ||
| ! qmin_alo : minimum semimajor axis for qmin | ||
| ! qmin_ahi : maximum semimajor axis for qmin | ||
| ! ldiscard : logical flag indicating that at least one body needs to be discarded this step | ||
| ! Terminal : none | ||
| ! File : none | ||
| ! | ||
| ! Output | ||
| ! Arguments : npl : number of planets | ||
| ! symba_pl1P : pointer to head of SyMBA planet structure linked-list | ||
| ! symba_pld1P : pointer to head of discard SyMBA planet structure linked-list | ||
| ! eoffset : energy offset | ||
| ! Terminal : none | ||
| ! File : none | ||
| ! | ||
| ! Invocation : CALL symba_discard_pl(t, npl, symba_pl1P, symba_pld1P, rmin, rmax, rmaxu, qmin, qmin_coord, | ||
| ! qmin_alo, qmin_ahi) | ||
| ! | ||
| ! Notes : Adapted from Hal Levison's Swift routine discard_massive5.f | ||
| ! | ||
| !********************************************************************************************************************************** | ||
| SUBROUTINE symba_discard_pl(t, npl, ntp, symba_plA, symba_tpA, rmin, rmax, rmaxu, qmin, qmin_coord, qmin_alo, qmin_ahi, ldiscard) | ||
| subroutine symba_discard_pl(t, npl, ntp, symba_plA, symba_tpA, rmin, rmax, rmaxu, & | ||
| qmin, qmin_coord, qmin_alo, qmin_ahi, discard_l_pl, discard_stat_list) | ||
| !! author: David A. Minton | ||
| !! | ||
| !! Check to see if planets should be discarded based on their positions or because they are unbound | ||
| !! | ||
| !! Adapted from David E. Kaufmann Swifter routine symba_discard_pl.f90 | ||
| !! Adapted from Martin Duncan and Hal Levison's Swift routine discard_massive5.f | ||
| use swiftest | ||
| use module_helio | ||
| use module_symba | ||
| use module_interfaces, except_this_one => symba_discard_pl | ||
| implicit none | ||
|
|
||
| ! Modules | ||
| USE swiftest | ||
| USE module_helio | ||
| USE module_symba | ||
| USE module_interfaces, EXCEPT_THIS_ONE => symba_discard_pl | ||
| IMPLICIT NONE | ||
| ! Arguments | ||
| integer(I4B), intent(inout) :: npl, ntp | ||
| real(DP), intent(in) :: t, rmin, rmax, rmaxu, qmin, qmin_alo, qmin_ahi | ||
| character(*), intent(in) :: qmin_coord | ||
| type(symba_pl), intent(inout) :: symba_plA | ||
| type(symba_tp), intent(inout) :: symba_tpa | ||
| logical, dimension(:), intent(out) :: discard_l_pl | ||
| integer(I4B), dimension(:), allocatable, intent(out) :: discard_stat_list | ||
|
|
||
| ! Arguments | ||
| INTEGER(I4B), INTENT(INOUT) :: npl, ntp | ||
| REAL(DP), INTENT(IN) :: t, rmin, rmax, rmaxu, qmin, qmin_alo, qmin_ahi | ||
| CHARACTER(*), INTENT(IN) :: qmin_coord | ||
| TYPE(symba_pl) :: symba_plA | ||
| TYPE(symba_tp) :: symba_tpA | ||
| LOGICAL(LGT), INTENT(INOUT) :: ldiscard | ||
| ! Internals | ||
| real(DP) :: msys | ||
| integer(I4B) :: i, ndiscard | ||
| logical :: ldiscard | ||
|
|
||
| ! Internals | ||
| REAL(DP) :: msys | ||
| ! Executable code | ||
| if ((rmin >= 0.0_DP) .or. (rmax >= 0.0_DP) .or. (rmaxu >= 0.0_DP) .or. ((qmin >= 0.0_DP) .and. (qmin_coord == "bary"))) & | ||
| call coord_h2b(npl, symba_plA%helio%swiftest, msys) | ||
| if ((rmin >= 0.0_DP) .or. (rmax >= 0.0_DP) .or. (rmaxu >= 0.0_DP)) & | ||
| call symba_discard_sun_pl(t, npl, ntp, msys, symba_plA%helio%swiftest, symba_tpa%helio%swiftest, rmin, rmax, rmaxu, ldiscard) | ||
| !if (qmin >= 0.0_DP) call symba_discard_peri_pl(t, npl, symba_plA, msys, qmin, qmin_alo, qmin_ahi, qmin_coord, ldiscard) | ||
| if (.not.ldiscard) return | ||
|
|
||
| ! Executable code | ||
| IF ((rmin >= 0.0_DP) .OR. (rmax >= 0.0_DP) .OR. (rmaxu >= 0.0_DP) .OR. ((qmin >= 0.0_DP) .AND. (qmin_coord == "BARY"))) & | ||
| CALL coord_h2b(npl, symba_plA%helio%swiftest, msys) | ||
| IF ((rmin >= 0.0_DP) .OR. (rmax >= 0.0_DP) .OR. (rmaxu >= 0.0_DP)) & | ||
| CALL symba_discard_sun_pl(t, npl, ntp, msys, symba_plA%helio%swiftest, symba_tpA%helio%swiftest, rmin, rmax, rmaxu, ldiscard) | ||
| !IF (qmin >= 0.0_DP) CALL symba_discard_peri_pl(t, npl, symba_plA, msys, qmin, qmin_alo, qmin_ahi, qmin_coord, ldiscard) | ||
| RETURN | ||
| ! We need to keep track of the bodies that are discarded via collision or escape from the central body separately from those that collide with each other. | ||
| associate(status => symba_plA%helio%swiftest%status) | ||
| discard_l_pl(1:npl) = (status(1:npl) == DISCARDED_RMIN) .or. (status(1:npl) == DISCARDED_PERI) .or. (status(1:npl) == DISCARDED_RMAX) .or. (status(1:npl) == DISCARDED_RMAXU) | ||
| ndiscard = count(discard_l_pl(1:npl)) | ||
| if (ndiscard > 0) then | ||
| if (allocated(discard_stat_list)) deallocate(discard_stat_list) | ||
| allocate(discard_stat_list(ndiscard)) | ||
| discard_stat_list = pack(status(1:npl), discard_l_pl) | ||
| where(discard_l_pl(1:npl)) | ||
| status(:) = ACTIVE | ||
| end where | ||
| end if | ||
| end associate | ||
|
|
||
| return | ||
|
|
||
| END SUBROUTINE symba_discard_pl | ||
| !********************************************************************************************************************************** | ||
| ! | ||
| ! Author(s) : David E. Kaufmann | ||
| ! | ||
| ! Revision Control System (RCS) Information | ||
| ! | ||
| ! Source File : $RCSfile$ | ||
| ! Full Path : $Source$ | ||
| ! Revision : $Revision$ | ||
| ! Date : $Date$ | ||
| ! Programmer : $Author$ | ||
| ! Locked By : $Locker$ | ||
| ! State : $State$ | ||
| ! | ||
| ! Modification History: | ||
| ! | ||
| ! $Log$ | ||
| !********************************************************************************************************************************** | ||
| end subroutine symba_discard_pl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.