4
$\begingroup$

I try to simulate a solar system with planets (with random mass) placed randomly around a sun with a mass $X \times \text{solar mass}$.

The simulation is going well when I use real data (sun,earth,moon for instance), but now I'd like to simulate randomly generated system.

My problem is that I didn't succeed in calculating linear velocity of planet.

On internet, I only found formulas to calculate linear velocity when we know the angular velocity, this mean knowing the time the planet make to do a revolution , which I don't want to determine.

I want, knowing only the distance and the two mass (and direction of velocity vector), be able to calculate the linear velocity vector.

I don't really have more information to provide, if you need something, just ask for it.

$\endgroup$
7
  • 2
    $\begingroup$ The distance, the two masses, and the direction of the velocity vector simply do not determine the magnitude of the velocity. You need something more. $\endgroup$
    – Joe
    Jan 30, 2013 at 13:46
  • $\begingroup$ And what do i need ? $\endgroup$
    – eephyne
    Jan 30, 2013 at 14:02
  • $\begingroup$ Either one of: the angular velocity, the angular momentum, the period (time it takes to make one revolution), orbit eccentricity, distance of shortest approach, and there are many more possible parameters. $\endgroup$
    – Joe
    Jan 30, 2013 at 14:14
  • $\begingroup$ What @Joe said, you need one more piece of information. Also, I'm not quite clear on whether you're asking for a way to get your initial conditions (which is a good question), or whether you're asking for equations to update the velocity at each timestep (in which case you may be off to a shaky start - calculating the velocity from your parameters - +1 more of course - is likely to introduce a systematic error). If I had to pick one extra parameter to assign, I think I'd go with eccentricity (given your desire to make things random, it seems the most naturally randomizable). $\endgroup$
    – Kyle Oman
    Jan 30, 2013 at 14:25
  • $\begingroup$ Also curious as to what kind of integration method you're using. This (en.wikipedia.org/wiki/Leapfrog_integration) is usually my weapon of choice for a quick and dirty simulation as it's pretty good at conserving energy for ~periodic orbits. There are, of course, many other good choices, and the one you pick may affect how you want to calculate the velocity. $\endgroup$
    – Kyle Oman
    Jan 30, 2013 at 14:27

2 Answers 2

4
$\begingroup$

As mentioned in the comments, you need one more piece of information to determine the magnitude of the velocity.

You said that you might use the eccentricity, so in that case you can use the formula given here and deduce a quadratic equation on the velocity which yields:

$$ v= \sqrt{\frac{G M}{r \sin(\alpha)} (1 \pm \epsilon)}, $$

where $G$ is the gravitational constant, $r$ is the distance between the two masses, $M$ is the bigger mass (I assumed here that one mass is much bigger than the other), $\alpha$ is the angle between the velocity vector and the radius, and $\epsilon$ is the eccentricity.

Note that since we had a quadratic equation, you still have two options for the velocity, both consistent with the given eccentricity.

$\endgroup$
2
  • $\begingroup$ This is perfect ! thanks a lot. Just to be sure , the α is always PI/2 or -PI/2 , no ? $\endgroup$
    – eephyne
    Jan 30, 2013 at 16:37
  • 1
    $\begingroup$ No! $\alpha$ can be anything from 0 to $\pi / 2$. Remember this is not restricted to a circular orbit. I did assume $\alpha$ is positive, otherwise just take its absolute value. $\endgroup$
    – Joe
    Jan 30, 2013 at 16:43
2
$\begingroup$

I assume that you want to have stable orbits. Then you know that the centrifugal force equals the gravitational force:

GmM/r² = mv²/r

with G = Newtons constant, r the distance and m the mass of the planet and M the mass of the central object. Since you know the distance and the mass of the central object (the mass of the planet cancels out) you can calculate v. v² =GM/r

$\endgroup$
12
  • 1
    $\begingroup$ This is only for a perfectly circular orbit, and the OP did not pose such a restriction. $\endgroup$
    – Joe
    Jan 30, 2013 at 14:23
  • $\begingroup$ Sorry, this was not clear for me $\endgroup$
    – Noldig
    Jan 30, 2013 at 14:26
  • $\begingroup$ that's one of the formulas I found but when i apply it , I got extremly high result (eg: for earth fixed vector is 29.783 and generated with your formula : 941690.7474866967) $\endgroup$
    – eephyne
    Jan 30, 2013 at 14:28
  • $\begingroup$ @eephyne - note that one of the parameters I mentioned in my comment is the orbit eccentricity. When you use this formula you're restricting yourself to a circular orbit, meaning you take the eccentricity to be zero. $\endgroup$
    – Joe
    Jan 30, 2013 at 14:42
  • 1
    $\begingroup$ @eephyne: for an elliptical orbit see en.wikipedia.org/wiki/Elliptic_orbit and en.wikipedia.org/wiki/Orbit_equation. $\endgroup$ Jan 30, 2013 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.