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

Commit

Permalink
Merge branch 'master' into FastEncounterCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Sep 27, 2021
2 parents dffa823 + 8cb1433 commit 11dc4dd
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 20 deletions.
Binary file modified examples/rmvs_swifter_comparison/1pl_1tp_encounter/cb.swiftest.in
Binary file not shown.
24 changes: 18 additions & 6 deletions examples/rmvs_swifter_comparison/1pl_1tp_encounter/init_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
swiftest_pl = "pl.swiftest.in"
swiftest_tp = "tp.swiftest.in"
swiftest_cb = "cb.swiftest.in"
swiftest_bin = "bin.swiftest.dat"
swiftest_bin = "bin.swiftest.nc"
swiftest_enc = "enc.swiftest.dat"

MU2KG = swiftest.MSun
Expand All @@ -39,8 +39,8 @@
rmax = 1000.0

npl = 1
plid = 2
tpid = 100
plid = 1
tpid = 2

radius = np.double(4.25875607065041e-05)
Gmass = np.double(0.00012002693582795244940133)
Expand All @@ -60,7 +60,7 @@
#Make Swifter files
plfile = open(swifter_pl, 'w')
print(npl+1, f'! Planet input file generated using init_cond.py',file=plfile)
print(1,GMSun,file=plfile)
print(0,GMSun,file=plfile)
print('0.0 0.0 0.0',file=plfile)
print('0.0 0.0 0.0',file=plfile)
print(plid,"{:.23g}".format(Gmass),rhill, file=plfile)
Expand Down Expand Up @@ -106,9 +106,19 @@
sys.stdout = sys.__stdout__

#Now make Swiftest files
NAMELEN = 32
cbname = "Sun"
plname = "Planet"
tpname = "TestParticle"

cbname = cbname.ljust(NAMELEN)
plname = plname.ljust(NAMELEN)
tpname = tpname.ljust(NAMELEN)

cbfile = FortranFile(swiftest_cb, 'w')
Msun = np.double(1.0)
cbfile.write_record(0)
cbfile.write_record(cbname)
cbfile.write_record(np.double(GMSun))
cbfile.write_record(np.double(rmin))
cbfile.write_record(np.double(swiftest.J2Sun))
Expand All @@ -119,6 +129,7 @@
plfile.write_record(npl)

plfile.write_record(plid)
plfile.write_record(plname)
plfile.write_record(p_pl[0])
plfile.write_record(p_pl[1])
plfile.write_record(p_pl[2])
Expand All @@ -133,6 +144,7 @@
ntp = 1
tpfile.write_record(ntp)
tpfile.write_record(tpid)
tpfile.write_record(tpname)
tpfile.write_record(p_tp[0])
tpfile.write_record(p_tp[1])
tpfile.write_record(p_tp[2])
Expand All @@ -154,8 +166,8 @@
print(f'ISTEP_OUT {iout:d}')
print(f'ISTEP_DUMP {iout:d}')
print(f'BIN_OUT {swiftest_bin}')
print(f'OUT_TYPE REAL8')
print(f'OUT_FORM XV')
print(f'OUT_TYPE NETCDF_DOUBLE')
print(f'OUT_FORM XVEL')
print(f'OUT_STAT REPLACE')
print(f'RHILL_PRESENT yes')
print(f'CHK_CLOSE yes')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ TP_IN tp.swiftest.in
IN_TYPE REAL8
ISTEP_OUT 1
ISTEP_DUMP 1
BIN_OUT bin.swiftest.dat
OUT_TYPE REAL8
OUT_FORM XV
BIN_OUT bin.swiftest.nc
OUT_TYPE NETCDF_DOUBLE
OUT_FORM XVEL
OUT_STAT REPLACE
RHILL_PRESENT yes
CHK_CLOSE yes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
2 ! Planet input file generated using init_cond.py
1 39.476926408897625196
0 39.476926408897625196
0.0 0.0 0.0
0.0 0.0 0.0
2 0.00012002693582795244940133 0.010044724833237892
1 0.00012002693582795244940133 0.010044724833237892
4.25875607065041e-05
1.0 0.0 0.0
0.0 6.283185307179586 0.0
Binary file modified examples/rmvs_swifter_comparison/1pl_1tp_encounter/pl.swiftest.in
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1
100
2
1.01 0.0 0.0
0.0 6.252003053624663 0.0
Binary file modified examples/rmvs_swifter_comparison/1pl_1tp_encounter/tp.swiftest.in
Binary file not shown.
19 changes: 11 additions & 8 deletions src/kick/kick.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ module subroutine kick_getacch_int_pl(self, param)
character(len=STRMAX) :: tstr, nstr, cstr, mstr, lstyle
character(len=1) :: schar


if (param%ladaptive_interactions) then
if (lfirst) then
write(itimer%loopname, *) "kick_getacch_int_pl"
write(itimer%looptype, *) "INTERACTION"
call itimer%time_this_loop(param, self, self%nplpl)
lfirst = .false.
if (self%nplpl > 0) then
if (lfirst) then
write(itimer%loopname, *) "kick_getacch_int_pl"
write(itimer%looptype, *) "INTERACTION"
call itimer%time_this_loop(param, self, self%nplpl)
lfirst = .false.
else
if (itimer%check(param, self%nplpl)) call itimer%time_this_loop(param, self, self%nplpl)
end if
else
if (itimer%check(param, self%nplpl)) call itimer%time_this_loop(param, self, self%nplpl)
param%lflatten_interactions = .false.
end if
end if

Expand All @@ -37,7 +40,7 @@ module subroutine kick_getacch_int_pl(self, param)
call kick_getacch_int_all_triangular_pl(self%nbody, self%nbody, self%xh, self%Gmass, self%radius, self%ah)
end if

if (param%ladaptive_interactions) then
if (param%ladaptive_interactions .and. self%nplpl > 0) then
if (itimer%is_on) call itimer%adapt(param, self, self%nplpl)
end if

Expand Down

0 comments on commit 11dc4dd

Please sign in to comment.