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

Commit

Permalink
Updated test case to have self-consistent values of everything
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 27, 2024
1 parent 8923eb8 commit 59ea228
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions examples/spherical_harmonics_cb/J2_test_tp.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@

# Central Body Parameters (Chariklo parameters from Leiva, et al (2017) (Jacobi Ellipsoid model))
cb_mass = 6.1e18 # kg
cb_radius = 123 # km
cb_a = 157 # km
cb_b = 139 # km
cb_c = 86 # km
cb_volume = 4.0 / 3 * np.pi * cb_radius**3 # km^3
cb_a = 160 # km
cb_b = 160 # km
cb_c = 90 # km
cb_volume = 4.0 / 3 * np.pi * cb_a*cb_b*cb_c**3 # km^3
cb_density = cb_mass / cb_volume
cb_T_rotation = 7.004 / 24.0 # converting from hours to julian days (TU)
cb_rot = [[0, 0, 360.0 / cb_T_rotation]] # degrees/d
Expand All @@ -56,7 +55,7 @@
# calculates the reference radius. If lref_radius = True, the function returns the reference radius used.
# We recommend setting passing and setting a reference radius. Coefficients are geodesy (4-pi) normalised.

c_lm, cb_radius = swiftest.clm_from_ellipsoid(mass = cb_mass, density = cb_density, a = cb_a, b = cb_b, c = cb_c, lmax = 6, lref_radius = True, ref_radius = cb_radius)
c_lm, cb_radius = swiftest.clm_from_ellipsoid(mass = cb_mass, density = cb_density, a = cb_a, b = cb_b, c = cb_c, lmax = 6, lref_radius = True)

# extracting only the J2 terms
tmp20 = c_lm[0, 2, 0] # c_20 = -J2
Expand All @@ -71,16 +70,16 @@

sim_shgrav.clean()
# Use the shgrav version where you input a set of spherical harmonics coefficients
sim_shgrav.add_body(name = 'Chariklo', mass = cb_mass, rot = cb_rot, radius = cb_radius, c_lm = c_lm)
sim_shgrav.add_body(name = 'OblateBody', mass = cb_mass, rot = cb_rot, radius = cb_radius, c_lm = c_lm)
sim_shgrav.add_body(name=name_tp, a=a_tp, e=e_tp, inc=inc_tp, capom=capom_tp, omega=omega_tp, capm=capm_tp)
sim_shgrav.run(tstart=0.0, tstop=10.0, dt=0.001, tstep_out=10.0, dump_cadence=0, integrator='whm')
sim_shgrav.run(tstart=0.0, tstop=10.0, dt=0.01, tstep_out=10.0, dump_cadence=0, integrator='whm')

# Use the original "oblate" version where you pass J2 (and/or J4)
sim_obl = swiftest.Simulation(simdir="obl", DU2M = 1e3, TU='d', MU='kg')
sim_obl.clean()
sim_obl.add_body(name = 'Chariklo', mass = cb_mass, rot = cb_rot, radius = cb_radius, J2 = j2rp2)
sim_obl.add_body(name = 'OblateBody', mass = cb_mass, rot = cb_rot, radius = cb_radius, J2 = j2rp2)
sim_obl.add_body(name=name_tp, a=a_tp, e=e_tp, inc=inc_tp, capom=capom_tp, omega=omega_tp, capm=capm_tp)
sim_obl.run(tstart=0.0, tstop=10.0, dt=0.001, tstep_out=10.0, dump_cadence=0, integrator='whm')
sim_obl.run(tstart=0.0, tstop=10.0, dt=0.01, tstep_out=10.0, dump_cadence=0, integrator='whm')

diff_vars = ['a','e','inc','capom','omega','capm','rh','vh']
ds_diff = sim_shgrav.data[diff_vars] - sim_obl.data[diff_vars]
Expand Down

0 comments on commit 59ea228

Please sign in to comment.