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

Commit

Permalink
Added Swifter vs Swiftest comparison for RMVS
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed May 15, 2023
1 parent a0df181 commit fb15c36
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
!solar_impact
!Swifter_Swiftest
!swiftest_performance
!rmvs_swifter_comparison
3 changes: 3 additions & 0 deletions examples/rmvs_swifter_comparison/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!.gitignore
!1pl_1tp_encounter
3 changes: 3 additions & 0 deletions examples/rmvs_swifter_comparison/1pl_1tp_encounter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!.gitignore
!init_cond.py
38 changes: 38 additions & 0 deletions examples/rmvs_swifter_comparison/1pl_1tp_encounter/init_cond.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
import numpy as np
import swiftest

# Simple initial conditions of a circular planet with one test particle in a close encounter state
# Simulation start, stop, and output cadence times
t_0 = 0 # simulation start time
deltaT = 0.25 * swiftest.JD2S / swiftest.YR2S # simulation step size
end_sim = 0.15
t_print = deltaT #output interval to print results

iout = int(np.ceil(t_print / deltaT))

radius = np.double(4.25875607065041e-05)
Gmass = np.double(0.00012002693582795244940133)
apl = np.longdouble(1.0)
atp = np.longdouble(1.01)
vpl = np.longdouble(2 * np.pi)
vtp = np.longdouble(2 * np.pi / np.sqrt(atp))

p_pl = np.array([apl, 0.0, 0.0], dtype=np.double)
v_pl = np.array([0.0, vpl, 0.0], dtype=np.double)

p_tp = np.array([atp, 0.0, 0.0], dtype=np.double)
v_tp = np.array([0.0, vtp, 0.0], dtype=np.double)

rhill = np.double(apl * 0.0100447248332378922085)

sim = swiftest.Simulation(simdir="swiftest_sim",init_cond_format="XV", general_relativity=False, integrator="RMVS")
sim.clean()
sim.add_solar_system_body(["Sun"])
sim.add_body(name=["Planet"], rh=[p_pl], vh=[v_pl], Gmass=[Gmass], radius=[radius], rhill=[rhill])
sim.add_body(name=["TestParticle"], rh=[p_tp], vh=[v_tp])
sim.set_parameter(tstart=t_0, tstop=end_sim, dt=deltaT, istep_out=iout, dump_cadence=0)
sim.save()

sim.set_parameter(simdir="swifter_sim",codename="Swifter",init_cond_file_type="ASCII",output_format="XV",output_file_type="REAL8")
sim.save()

0 comments on commit fb15c36

Please sign in to comment.