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

Commit

Permalink
Started building infrastructure for the SyMBA integrator
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Jul 9, 2021
1 parent 99017ad commit 8b32ff2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ lib:
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
make libdir
cd $(SWIFTEST_HOME)/src/symba; \
rm -f Makefile.Defines Makefile; \
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
ln -s $(SWIFTEST_HOME)/Makefile .; \
make libdir
cd $(SWIFTEST_HOME)/src/user; \
rm -f Makefile.Defines Makefile; \
ln -s $(SWIFTEST_HOME)/Makefile.Defines .; \
Expand Down Expand Up @@ -197,6 +202,7 @@ clean:
cd $(SWIFTEST_HOME)/src/orbel; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/rmvs; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/setup; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/symba; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/user; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/util; rm -f Makefile.Defines Makefile *.gc*
cd $(SWIFTEST_HOME)/src/whm; rm -f Makefile.Defines Makefile *.gc*
Expand Down
2 changes: 2 additions & 0 deletions src/modules/rmvs_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module rmvs_classes
integer(I4B) :: ipleP !! index value of encountering planet
logical :: lplanetocentric = .false. !! Flag that indicates that the object is a planetocentric set of masive bodies used for close encounter calculations
contains
private
procedure, public :: discard => rmvs_discard_tp !! Check to see if test particles should be discarded based on pericenter passage distances with respect to planets encountered
procedure, public :: encounter_check => rmvs_encounter_check_tp !! Checks if any test particles are undergoing a close encounter with a massive body
procedure, public :: fill => rmvs_fill_tp !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
Expand All @@ -89,6 +90,7 @@ module rmvs_classes
class(rmvs_nbody_system), dimension(:), allocatable :: planetocentric
logical :: lplanetocentric = .false. !! Flag that indicates that the object is a planetocentric set of masive bodies used for close encounter calculations
contains
private
procedure, public :: fill => rmvs_fill_pl !! "Fills" bodies from one object into another depending on the results of a mask (uses the MERGE intrinsic)
procedure, public :: setup => rmvs_setup_pl !! Constructor method - Allocates space for number of particles
procedure, public :: spill => rmvs_spill_pl !! "Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic)
Expand Down
39 changes: 39 additions & 0 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module symba_classes
!> Helio central body particle class
type, public, extends(helio_cb) :: symba_cb
contains
private
end type symba_cb

!********************************************************************************************************************************
Expand All @@ -33,6 +34,9 @@ module symba_classes
!! Helio massive body particle class
type, public, extends(helio_pl) :: symba_pl
contains
private
procedure, public :: discard => symba_discard_pl !! Process massive body discards
procedure, public :: encounter_check => symba_encounter_check_pl !! Checks if massive bodies are going through close encounters with each other
end type symba_pl

!********************************************************************************************************************************
Expand All @@ -42,9 +46,44 @@ module symba_classes
!! Helio test particle class
type, public, extends(helio_tp) :: symba_tp
contains
private
procedure, public :: discard => symba_discard_tp !! process test particle discards
procedure, public :: encounter_check => symba_encounter_check_tp !! Checks if any test particles are undergoing a close encounter with a massive body
end type symba_tp

interface
module subroutine symba_discard_pl(self, system, param)
use swiftest_classes, only : swiftest_nbody_system, swiftest_parameters
implicit none
class(symba_pl), 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
end subroutine symba_discard_pl

module subroutine symba_discard_tp(self, system, param)
use swiftest_classes, only : swiftest_nbody_system, swiftest_parameters
implicit none
class(symba_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
end subroutine symba_discard_tp

module function symba_encounter_check_pl(self, system, dt) result(lencounter)
implicit none
class(symba_pl), intent(inout) :: self !! RMVS test particle object
class(symba_nbody_system), intent(inout) :: system !! RMVS nbody system object
real(DP), intent(in) :: dt !! step size
logical :: lencounter !! Returns true if there is at least one close encounter
end function symba_encounter_check_pl

module function symba_encounter_check_tp(self, system, dt) result(lencounter)
implicit none
class(symba_tp), intent(inout) :: self !! RMVS test particle object
class(symba_nbody_system), intent(inout) :: system !! RMVS nbody system object
real(DP), intent(in) :: dt !! step size
logical :: lencounter !! Returns true if there is at least one close encounter
end function symba_encounter_check_tp

module subroutine symba_step_system(self, param, t, dt)
use swiftest_classes, only : swiftest_parameters
implicit none
Expand Down
4 changes: 1 addition & 3 deletions src/symba/symba_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ module subroutine symba_step_system(self, param, t, dt)
class is (symba_pl)
select type(tp => self%tp)
class is (symba_tp)
lencounter_pl = pl%encounter_check(system, dt)
lencounter_tp = tp%encounter_check(system, dt)
lencounter = lencounter_pl .or. lencounter_tp
lencounter = pl%encounter_check(self, dt) .or. tp%encounter_check(self, dt)
if (lencounter) then
call self%interp(param, t, dt)
else
Expand Down

0 comments on commit 8b32ff2

Please sign in to comment.