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

Commit

Permalink
Updated version properly
Browse files Browse the repository at this point in the history
  • Loading branch information
MintoDA1 authored and MintoDA1 committed Oct 2, 2023
1 parent 13da5c7 commit cbb8f5a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "swiftest"
version = "2023.9.10"
version = "2023.10.0"
authors=[
{name = 'David A. Minton', email='daminton@purdue.edu'},
{name = 'Carlisle Wishard'},
Expand Down
2 changes: 1 addition & 1 deletion src/globals/globals_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module globals
integer(I4B), parameter :: UPPERCASE_OFFSET = iachar('A') - iachar('a') !! ASCII character set parameter for lower to upper
!! conversion - offset between upper and lower

character(*), parameter :: VERSION = "2023.9.4" !! Swiftest version
character(*), parameter :: VERSION = "2023.9.10" !! Swiftest version

!> Symbolic name for integrator types
character(*), parameter :: UNKNOWN_INTEGRATOR = "UKNOWN INTEGRATOR"
Expand Down
40 changes: 23 additions & 17 deletions tests/test_swiftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

class TestSwiftest(unittest.TestCase):

def test01_gen_ic(self):
def test_gen_ic(self):
"""
Tests that Swiftest is able to successfully generate a set of initial conditions in a file without any exceptions being raised
"""
Expand All @@ -50,22 +50,24 @@ def test01_gen_ic(self):

# Add the modern planets and the Sun using the JPL Horizons Database.
sim.add_solar_system_body(major_bodies)

# Display the run configuration parameters.
param = sim.get_parameter(verbose=False)
sim.save()

for f in file_list:
self.assertTrue(os.path.exists(f))
return


def test02_read_ic(self):
def test_read_ic(self):
"""
Tests that Swiftest is able to read a set of pre-existing initial conditions files and that they contain the correct data
"""
print("\ntest_read_ic: Test whether we can read back initial conditions files created by test_gen_ic")
sim = swiftest.Simulation(read_param=True)
sim = swiftest.Simulation()
sim.clean()

# Add the modern planets and the Sun using the JPL Horizons Database.
sim.add_solar_system_body(major_bodies)
sim.save()
# Check if all names in Dataset read in from file match the expected list of names
self.assertTrue((major_bodies == sim.init_cond['name']).all(), msg="Name mismatch in Dataset")

Expand All @@ -74,36 +76,40 @@ def test02_read_ic(self):
return


def test03_integrators(self):
def test_integrators(self):
"""
Tests that Swiftest is able to integrate a collection of massive bodies and test particles with all available integrators
"""
print("\ntest_integrators: Tests that Swiftest is able to integrate a collection of massive bodies and test particles with all available integrators")
sim = swiftest.Simulation(read_param=True)
sim = swiftest.Simulation()

# Add the modern planets and the Sun using the JPL Horizons Database.
sim.add_solar_system_body(major_bodies)

# Add 10 user-defined test particles.
ntp = 10

name_tp = [f"TestParticle_{i:02}" for i in range(1,ntp+1)]
a_tp = rng.uniform(0.3, 1.5, ntp)
e_tp = rng.uniform(0.0, 0.2, ntp)
inc_tp = rng.uniform(0.0, 10, ntp)
capom_tp = rng.uniform(0.0, 360.0, ntp)
omega_tp = rng.uniform(0.0, 360.0, ntp)
capm_tp = rng.uniform(0.0, 360.0, ntp)
name_tp = [f"TestParticle_{i:02}" for i in range(1,ntp+1)]
a_tp = rng.uniform(0.3, 1.5, ntp)
e_tp = rng.uniform(0.0, 0.2, ntp)
inc_tp = rng.uniform(0.0, 10, ntp)
capom_tp = rng.uniform(0.0, 360.0, ntp)
omega_tp = rng.uniform(0.0, 360.0, ntp)
capm_tp = rng.uniform(0.0, 360.0, ntp)

integrators= ["whm","helio","rmvs","symba"]
sim.add_body(name=name_tp, a=a_tp, e=e_tp, inc=inc_tp, capom=capom_tp, omega=omega_tp, capm=capm_tp)
sim.set_parameter(tstart=0.0, tstop=0.02, dt=0.01, istep_out=1, dump_cadence=0)
integrators= ["whm","helio","rmvs","symba"]
for i in integrators:
try:
sim.clean()
sim.run(integrator=i)
except:
self.fail(f"Failed with integrator {i}")
return

def test04_conservation(self):
def test_conservation(self):
"""
Tests that Swiftest conserves mass, energy, and momentum to within acceptable tolerances.
"""
Expand Down Expand Up @@ -163,7 +169,7 @@ def fit_func(x,slope,b):
self.assertLess(np.abs(GM_final),GM_limit, msg=f"Mass Error of {GM_final:.2e} higher than threshold value of {GM_limit:.2e}")
return

def test05_gr(self):
def test_gr(self):
"""
Tests that GR is working correctly by computing the precession of Mercury's longitude of periapsis and comparing it to
values obtained from the JPL/Horizons ephemeris service
Expand Down

0 comments on commit cbb8f5a

Please sign in to comment.