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

Commit

Permalink
Merge branch 'debug' into IntelAdvisor
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Dec 10, 2021
2 parents f4a58c6 + bf82f65 commit 860d34b
Show file tree
Hide file tree
Showing 16 changed files with 192 additions and 117 deletions.
67 changes: 18 additions & 49 deletions examples/helio_gr_test/swiftest_relativity.ipynb

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions examples/symba_energy_momentum/param.sun.in
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
!Parameter file for the SyMBA-RINGMOONS test
T0 0.0
TSTOP 3.0e-2
TSTOP 3.0e-1
DT 1e-3
CB_IN cb.in
PL_IN sun.in
TP_IN tp.in
IN_TYPE ASCII
ISTEP_OUT 1
ISTEP_DUMP 1
BIN_OUT bin.sun.dat
BIN_OUT bin.sun.nc
PARTICLE_OUT particle.sun.dat
OUT_TYPE REAL8
OUT_FORM XV ! osculating element output
OUT_TYPE NETCDF_DOUBLE
OUT_FORM XVEL ! osculating element output
OUT_STAT REPLACE
ISTEP_DUMP 1 ! system dump cadence
CHK_CLOSE yes ! check for planetary close encounters
CHK_RMIN 0.005
CHK_RMAX 1e2
CHK_EJECT -1.0 ! ignore this check
CHK_QMIN -1.0 ! ignore this check
ENC_OUT enc.sun.dat
DISCARD_OUT discard.sun.dat
EXTRA_FORCE no ! no extra user-defined forces
BIG_DISCARD no ! output all planets if anything discarded
RHILL_PRESENT no ! Hill's sphere radii in input file
Expand All @@ -30,6 +28,5 @@ MU2KG 1.98908e30
TU2S 3.1556925e7
DU2M 1.49598e11
ENERGY yes
ENERGY_OUT energy.sun.out
ROTATION yes
SEED 8 1230834 2346113 123409874 -123121105 -767545 -534058022 343309814 -12535638
4 changes: 2 additions & 2 deletions examples/symba_swifter_comparison/8pl_16tp_encounters/cb.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Sun
0.00029591220819207774
0.004650467260962157
4.7535806948127355e-12
-2.2473967953572827e-18
0.0
0.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Sun
0.00029591220819207774
0.004650467260962157
4.7535806948127355e-12
-2.2473967953572827e-18
0.0
0.0
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ FRAGMENTATION NO
ROTATION NO
TIDES NO
ENERGY NO
GR NO
GR YES
GMTINY 1e-12
ENCOUNTER_CHECK SORTSWEEP
ENCOUNTER_CHECK TRIANGULAR
INTERACTION_LOOPS TRIANGULAR
3 changes: 1 addition & 2 deletions src/discard/discard.f90
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ subroutine discard_pl_tp(tp, system, param)
write(idstrj, *) pl%id(j)
write(timestr, *) param%t
write(*, *) "Test particle " // trim(adjustl(tp%info(i)%name)) // " (" // trim(adjustl(idstri)) // ")" &
// " too close to massive body " // trim(adjustl(pl%info(i)%name)) // &
" (" // trim(adjustl(idstrj)) &
// " too close to massive body " // trim(adjustl(pl%info(j)%name)) // " (" // trim(adjustl(idstrj)) // ")" &
// " at t = " // trim(adjustl(timestr))
tp%ldiscard(i) = .true.
call tp%info(i)%set_value(status="DISCARDED_PLR", discard_time=param%t, discard_xh=tp%xh(:,i), &
Expand Down
23 changes: 13 additions & 10 deletions src/helio/helio_gr.f90
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module pure subroutine helio_gr_kick_getacch_tp(self, param)
end subroutine helio_gr_kick_getacch_tp


module pure subroutine helio_gr_p4_pl(self, param, dt)
module pure subroutine helio_gr_p4_pl(self, system, param, dt)
!! author: David A. Minton
!!
!! Position kick to massive bodies due to p**4 term in the post-Newtonian correction
Expand All @@ -65,11 +65,12 @@ module pure subroutine helio_gr_p4_pl(self, param, dt)
!! Adapted from David A. Minton's Swifter routine routine gr_helio_p4.f90
implicit none
! Arguments
class(helio_pl), intent(inout) :: self !! Swiftest particle object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
class(helio_pl), intent(inout) :: self !! Swiftest particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
! Internals
integer(I4B) :: i
integer(I4B) :: i

if (self%nbody == 0) return

Expand All @@ -82,7 +83,8 @@ module pure subroutine helio_gr_p4_pl(self, param, dt)
return
end subroutine helio_gr_p4_pl

module pure subroutine helio_gr_p4_tp(self, param, dt)

module pure subroutine helio_gr_p4_tp(self, system, param, dt)
!! author: David A. Minton
!!
!! Position kick to test particles due to p**4 term in the post-Newtonian correction
Expand All @@ -91,11 +93,12 @@ module pure subroutine helio_gr_p4_tp(self, param, dt)
!! Adapted from David A. Minton's Swifter routine routine gr_helio_p4.f90
implicit none
! Arguments
class(helio_tp), intent(inout) :: self !! Swiftest particle object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
class(helio_tp), intent(inout) :: self !! Swiftest particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
! Internals
integer(I4B) :: i
integer(I4B) :: i

if (self%nbody == 0) return

Expand Down
12 changes: 6 additions & 6 deletions src/helio/helio_step.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module subroutine helio_step_pl(self, system, param, t, dt)
implicit none
! Arguments
class(helio_pl), intent(inout) :: self !! Helio massive body particle data structure
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nboody system
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Stepsize
Expand All @@ -54,10 +54,10 @@ module subroutine helio_step_pl(self, system, param, t, dt)
end if
call pl%lindrift(cb, dth, lbeg=.true.)
call pl%kick(system, param, t, dth, lbeg=.true.)
if (param%lgr) call pl%gr_pos_kick(param, dth)
if (param%lgr) call pl%gr_pos_kick(system, param, dth)
call pl%drift(system, param, dt)
call pl%kick(system, param, t + dt, dth, lbeg=.false.)
if (param%lgr) call pl%gr_pos_kick(param, dth)
if (param%lgr) call pl%gr_pos_kick(system, param, dth)
call pl%lindrift(cb, dth, lbeg=.false.)
call pl%vb2vh(cb)
end select
Expand All @@ -78,7 +78,7 @@ module subroutine helio_step_tp(self, system, param, t, dt)
implicit none
! Arguments
class(helio_tp), intent(inout) :: self !! Helio test particle data structure
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nboody system
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Stepsize
Expand All @@ -97,10 +97,10 @@ module subroutine helio_step_tp(self, system, param, t, dt)
end if
call tp%lindrift(cb, dth, lbeg=.true.)
call tp%kick(system, param, t, dth, lbeg=.true.)
if (param%lgr) call tp%gr_pos_kick(param, dth)
if (param%lgr) call tp%gr_pos_kick(system, param, dth)
call tp%drift(system, param, dt)
call tp%kick(system, param, t + dt, dth, lbeg=.false.)
if (param%lgr) call tp%gr_pos_kick(param, dth)
if (param%lgr) call tp%gr_pos_kick(system, param, dth)
call tp%lindrift(cb, dth, lbeg=.false.)
call tp%vb2vh(vbcb = -cb%ptend)
end select
Expand Down
2 changes: 1 addition & 1 deletion src/modules/fraggle_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ module subroutine fraggle_placeholder_step(self, system, param, t, dt)
use swiftest_classes, only : swiftest_nbody_system, swiftest_parameters
implicit none
class(fraggle_fragments), intent(inout) :: self !! Helio massive body particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nboody system
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Stepsiz
Expand Down
24 changes: 13 additions & 11 deletions src/modules/helio_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,22 @@ module pure subroutine helio_gr_kick_getacch_tp(self, param)
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
end subroutine helio_gr_kick_getacch_tp

module pure subroutine helio_gr_p4_pl(self, param, dt)
use swiftest_classes, only : swiftest_parameters
module pure subroutine helio_gr_p4_pl(self, system, param, dt)
use swiftest_classes, only : swiftest_parameters, swiftest_nbody_system
implicit none
class(helio_pl), intent(inout) :: self !! Swiftest particle object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
class(helio_pl), intent(inout) :: self !! Swiftest particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
end subroutine helio_gr_p4_pl

module pure subroutine helio_gr_p4_tp(self, param, dt)
use swiftest_classes, only : swiftest_parameters
module pure subroutine helio_gr_p4_tp(self, system, param, dt)
use swiftest_classes, only : swiftest_parameters, swiftest_nbody_system
implicit none
class(helio_tp), intent(inout) :: self !! Swiftest particle object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
class(helio_tp), intent(inout) :: self !! Swiftest particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
end subroutine helio_gr_p4_tp

module subroutine helio_kick_getacch_pl(self, system, param, t, lbeg)
Expand Down Expand Up @@ -191,7 +193,7 @@ module subroutine helio_step_pl(self, system, param, t, dt)
use swiftest_classes, only : swiftest_nbody_system, swiftest_parameters
implicit none
class(helio_pl), intent(inout) :: self !! Helio massive body particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nboody system
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
real(DP), intent(in) :: t !! Current simulation time
real(DP), intent(in) :: dt !! Stepsize
Expand Down
23 changes: 23 additions & 0 deletions src/modules/symba_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module symba_classes
procedure :: discard => symba_discard_pl !! Process massive body discards
procedure :: drift => symba_drift_pl !! Method for Danby drift in Democratic Heliocentric coordinates. Sets the mask to the current recursion level
procedure :: encounter_check => symba_encounter_check_pl !! Checks if massive bodies are going through close encounters with each other
procedure :: gr_pos_kick => symba_gr_p4_pl !! Position kick due to p**4 term in the post-Newtonian correction
procedure :: accel_int => symba_kick_getacch_int_pl !! Compute direct cross (third) term heliocentric accelerations of massive bodiess, with no mutual interactions between bodies below GMTINY
procedure :: accel => symba_kick_getacch_pl !! Compute heliocentric accelerations of massive bodies
procedure :: setup => symba_setup_pl !! Constructor method - Allocates space for the input number of bodies
Expand Down Expand Up @@ -113,6 +114,7 @@ module symba_classes
contains
procedure :: drift => symba_drift_tp !! Method for Danby drift in Democratic Heliocentric coordinates. Sets the mask to the current recursion level
procedure :: encounter_check => symba_encounter_check_tp !! Checks if any test particles are undergoing a close encounter with a massive body
procedure :: gr_pos_kick => symba_gr_p4_tp !! Position kick due to p**4 term in the post-Newtonian correction
procedure :: accel => symba_kick_getacch_tp !! Compute heliocentric accelerations of test particles
procedure :: setup => symba_setup_tp !! Constructor method - Allocates space for the input number of bodies
procedure :: append => symba_util_append_tp !! Appends elements from one structure to another
Expand Down Expand Up @@ -272,6 +274,7 @@ module subroutine symba_drift_tp(self, system, param, dt)
end subroutine symba_drift_tp

module function symba_encounter_check_pl(self, param, system, dt, irec) result(lany_encounter)
use swiftest_classes, only : swiftest_nbody_system
implicit none
class(symba_pl), intent(inout) :: self !! SyMBA test particle object
class(swiftest_parameters), intent(inout) :: param !! Current swiftest run configuration parameters
Expand All @@ -282,6 +285,7 @@ module function symba_encounter_check_pl(self, param, system, dt, irec) result(l
end function symba_encounter_check_pl

module function symba_encounter_check(self, param, system, dt, irec) result(lany_encounter)
use swiftest_classes, only : swiftest_parameters
implicit none
class(symba_encounter), intent(inout) :: self !! SyMBA pl-pl encounter list object
class(swiftest_parameters), intent(inout) :: param !! Current swiftest run configuration parameters
Expand All @@ -292,6 +296,7 @@ module function symba_encounter_check(self, param, system, dt, irec) result(lany
end function symba_encounter_check

module function symba_encounter_check_tp(self, param, system, dt, irec) result(lany_encounter)
use swiftest_classes, only : swiftest_parameters
implicit none
class(symba_tp), intent(inout) :: self !! SyMBA test particle object
class(swiftest_parameters), intent(inout) :: param !! Current swiftest run configuration parameters
Expand All @@ -301,6 +306,24 @@ module function symba_encounter_check_tp(self, param, system, dt, irec) result(l
logical :: lany_encounter !! Returns true if there is at least one close encounter
end function symba_encounter_check_tp

module pure subroutine symba_gr_p4_pl(self, system, param, dt)
use swiftest_classes, only : swiftest_parameters, swiftest_nbody_system
implicit none
class(symba_pl), intent(inout) :: self !! SyMBA massive body object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
end subroutine symba_gr_p4_pl

module pure subroutine symba_gr_p4_tp(self, system, param, dt)
use swiftest_classes, only : swiftest_parameters, swiftest_nbody_system
implicit none
class(symba_tp), 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
real(DP), intent(in) :: dt !! Step size
end subroutine symba_gr_p4_tp

module function symba_collision_casedisruption(system, param, colliders, frag) result(status)
use fraggle_classes, only : fraggle_colliders, fraggle_fragments
implicit none
Expand Down
18 changes: 10 additions & 8 deletions src/modules/whm_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,22 @@ module pure subroutine whm_gr_kick_getacch_tp(self, param)
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
end subroutine whm_gr_kick_getacch_tp

module pure subroutine whm_gr_p4_pl(self, param, dt)
module pure subroutine whm_gr_p4_pl(self, system, param, dt)
use swiftest_classes, only : swiftest_parameters
implicit none
class(whm_pl), intent(inout) :: self !! WHM massive body object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
class(whm_pl), intent(inout) :: self !! WHM massive body object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
end subroutine whm_gr_p4_pl

module pure subroutine whm_gr_p4_tp(self, param, dt)
module pure subroutine whm_gr_p4_tp(self, system, param, dt)
use swiftest_classes, only : swiftest_parameters
implicit none
class(whm_tp), intent(inout) :: self !! WHM test particle object
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
class(whm_tp), intent(inout) :: self !! WHM test particle object
class(swiftest_nbody_system), intent(inout) :: system !! Swiftest nbody system
class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters
real(DP), intent(in) :: dt !! Step size
end subroutine whm_gr_p4_tp

!> Reads WHM massive body object in from file
Expand Down
Loading

0 comments on commit 860d34b

Please sign in to comment.