swiftest.Simulation.add_body#
- Simulation.add_body(name=None, a=None, e=None, inc=None, capom=None, omega=None, capm=None, rh=None, vh=None, mass=None, Gmass=None, radius=None, rhill=None, rot=None, Ip=None, rotphase=None, j2rp2=None, j4rp4=None, c_lm=None, align_to_central_body_rotation=False, **kwargs)[source]#
Adds a body (test particle or massive body) to the internal Dataset given a set of either orbital elements or cartesian state vectors.
If orbital elements are passed, cartesian state vectors are computed and vice versa, using the currently-assigned central body, so cannot both be passed. Input all angles in degrees and dimensional quantities in the unit system defined in the current Simulation instance.
This method will update the data attribute with the new body or bodies added to the existing Dataset.
- Parameters:
name (str or array-like of str, optional) – Name or names of Bodies. If none passed, name will be “Body{id}”
a (float or array-like of float, optional) – semimajor axis for param[‘IN_FORM’] == “EL”
e (float or array-like of float, optional) – eccentricity for param[‘IN_FORM’] == “EL”
inc (float or array-like of float, optional) – inclination for param[‘IN_FORM’] == “EL”
capom (float or array-like of float, optional) – longitude of ascending node for param[‘IN_FORM’] == “EL”
omega (float or array-like of float, optional) – argument of periapsis for param[‘IN_FORM’] == “EL”
capm (float or array-like of float, optional) – mean anomaly for param[‘IN_FORM’] == “EL”
rh ((n,3) array-like of float, optional) – Position vector array.
vh ((n,3) array-like of float, optional) – Velocity vector array.
mass (float or array-like of float, optional) – mass values if these are massive bodies (only one of mass or Gmass can be passed)
Gmass (float or array-like of float, optional) – G*mass values if these are massive bodies (only one of mass or Gmass can be passed)
radius (float or array-like of float, optional) – Radius values if these are massive bodies
rhill (float or array-like of float, optional) – Hill’s radius values if these are massive bodies
rot ((3) or (n,3) array-like of float, optional) – Rotation rate vectors if these are massive bodies with rotation enabled.
Ip ((3) or (n,3) array-like of float, optional) – Principal axes moments of inertia vectors if these are massive bodies with rotation enabled.
rotphase (float, optional) – rotation phase angle in degreesif these are massive bodies with rotation enabled
j2rp2 (float, optional) – Non-normalized J2 values (e.g. J2*R**2, where R is the body radius) if this is a central body (only one of J2 or c_lm can be passed)
j4rp4 (float, optional) – Non-normalized J4 values (e.g. J4*R**4, where R is the body radius) if this is a central body (only one of J4 or c_lm can be passed)
c_lm ((2,l_max+1,l_max+1) array-like of float, optional) – Spherical harmonics coefficients if this is a central body (only one of J2/J4 or c_lm can be passed)
align_to_central_body_rotation (bool, default False) – If True, the cartesian coordinates will be aligned to the rotation pole of the central body. This is only valid for when rotation is enabled.
- Returns:
None – Sets the data and init_cond instance variables each with a SwiftestDataset containing the body or bodies that were added