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

Commit

Permalink
Fixed issues related to central body initial conditions. Now it expli…
Browse files Browse the repository at this point in the history
…citly sets rh, vh, and orbital elements if it detects a central body is being passed
  • Loading branch information
daminton committed Feb 27, 2024
1 parent cb999dc commit c01f007
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions swiftest/init_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,16 @@ def solar_system_horizons(name: str,
if param['ROTATION']:
Ip = Ipsun
rot = rotcb
if param['IN_FORM'] == 'XV':
rh = np.array([0.0, 0.0, 0.0])
vh = np.array([0.0, 0.0, 0.0])
elif param['IN_FORM'] == 'EL':
a = np.nan
e = np.nan
inc = np.nan
capom = np.nan
omega = np.nan
capm = np.nan
else: # Fetch solar system ephemerides from Horizons
if ephemeris_id is None:
ephemeris_id = name
Expand Down
13 changes: 13 additions & 0 deletions swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -2635,6 +2635,19 @@ def input_to_clm_array(val, n):
if is_central_body:
if a is not None or e is not None or inc is not None or capom is not None or omega is not None or capm is not None:
raise ValueError("Orbital elements cannot be passed for a central body.")
if nbodies > 1:
raise ValueError("Only one central body may be passed.")
if rh is None:
rh = np.zeros((1,3))
if vh is None:
vh = np.zeros((1,3))
a = np.nan
e = np.nan
inc = np.nan
capom = np.nan
omega = np.nan
capm = np.nan


dsnew = init_cond.vec2xr(self.param, name=name, a=a, e=e, inc=inc, capom=capom, omega=omega, capm=capm, id=id,
Gmass=Gmass, radius=radius, rhill=rhill, Ip=Ip, rh=rh, vh=vh,rot=rot, j2rp2=J2, j4rp4=J4, c_lm=c_lm, rotphase=rotphase, time=time)
Expand Down

0 comments on commit c01f007

Please sign in to comment.