Tuesday, March 02, 2021

[pogcxrnd] Random orbit

We consider picking a random elliptic orbit for a point satellite around a central point mass.  Inspired by the "grav" xscreensaver hack.

Previously.

Restrict orbits to the plane of the display.  (Or do 3D and project?)

Let the central mass have unit mass.  Randomly pick from a probability distribution the satellite's specific orbital energy, its total energy per unit mass.  Gravitational potential energy and kinetic energy both scale linearly with satellite mass, so we can divide it out, yielding specific gravitational potential energy (a.k.a. gravitational potential) and specific kinetic energy.  Assuming satellite mass is negligible compared to the central mass, motion is independent of satellite mass.  Gravitational potential energy is unbounded below (tiny orbits), so we need a distribution from which to sample; cannot sample uniformly.  Lower bound could be determined by pixel size: avoid orbits too small to see.  Also limit by animation refresh rate: avoid orbits too fast to see.  Total energy must be negative to keep the orbit elliptical, but consider restricting the upper bound to avoid extremely long periods.  Sample uniformly between bounds?  Or truncated Gaussian?

Pick a random point, probably from within an annulus (not too close, not too far from the central mass).  Calculate gravitational potential at that point and allocate the rest of the specific orbital energy to specific kinetic energy.  Reject and pick a different starting point if the available kinetic energy is negative.  (This can be optimized by sampling only within a feasible region.)  Uniformly pick a random direction and set the satellite off.  To compute position as a function of time for elliptic orbits, solve Kepler's Equation, probably with Newton's Method.

Perhaps reject orbits which go off screen a lot.  (How much is a lot?)

Extend this to a binary system: generate a random system of two masses in elliptic orbits around a stationary common center of mass (barycenter).  Start with a single unit mass at the center.  Uniformly pick a number between 0 and 1 to divide the starting central mass into two.  Pick a random total energy of the system, must be negative.  Place the lighter mass in a random location within a disc or annulus of interest.  This forces the location of the heavier mass because the barycenter must remain at the original center of mass.  Compute gravitational potential energy between the two particles using the standard formula.  Kinetic energy is total energy minus gravitational potential energy.  Resample if available kinetic energy is negative.  How does kinetic energy get divided between the two masses?  I'm pretty sure it is forced.  "Reduced mass" is likely useful.  Uniformly pick a random initial direction for the lighter mass and set the system in motion.  The heavier mass's motion is then fully constrained because the barycenter must remain stationary.  Are there forbidden initial directions for the lighter mass?

For both the single central mass and the binary cases, we can next scale the masses and velocities (probably kinetic energies) so that paths remain the same but the orbital period is faster or slower according to desired aesthetics.  Or, just speed up or slow down time in the simulation.

All of this is fairly straightforward, or seems to be.

No comments :