Do orbital dynamics scale linearly?

  • #1
I need to scale my solar system model and it's not working. I'm making an augmented reality app that shows a sample solar system rotating. It works great! (Thanks to this $7 program https://assetstore.unity.com/packages/tools/physics/gravity-and-orbits-solar-system-105300 . The Unity engine is free).

However I need to scale my solar system to support the AR functionality. I have a planet in the middle and smaller planets rotating in a semi-stable orbit. When I scale everything down by 50% (the objects, distances, mass, initial velocity) it's no longer a stable orbit. They crash into the center planet within one orbit. Should this work this way?

Would solar system where everything is exactly 50% smaller still produce stable orbits? Am I missing something with regards to scaling my physical model or should I not expect things to scale linearly?

Thanks!
 

Answers and Replies

  • #4
berkeman
Mentor
59,007
9,101
Did you look at the equation? Are you familiar with the equations for circular motion and centripetal force? Not trying to be cryptic -- if you do not know any of these things, it will be hard to explain the answer that you are looking for. It's not a straight scaling for everything all together. You want to scale things so the orbital dynamics look similar.
 
  • #5
berkeman
Mentor
59,007
9,101
BTW, how do you want to scale time in your scaling? Do you want the orbital periods to be the same even though things are smaller? Or can the orbital times scale with the orbital sizes?
 
  • #6
Hi and thanks for your replies. I will study up on circular motion and centripetal force. It's been a while since college physics class.

That's a good point about time. I want the orbital periods to be the same. I just need to be able to scale everything so the user can choose the right size based on their camera distance to the AR solar system I'm rendering.

Here's the code I'm using. The center planet is the only generator. The orbits were too chaotic if I let all the objects interact with each other. The "affected" List contains the rigidbodies of the orbiters.

Do you know how I should scale the mass of the objects?

newMass = orginalMass * scaleFactor; // this doesn't work

newMass = Math.Power(orginalMass * scaleFactor, 3); // cubing the products doesn't work either


JavaScript:
          // for each of the generators we create a force
         for (int ii=0; ii<generators.Count;ii++)
         {
             // for each of the affected objects
             for (int jj=0; jj<affected.Count;jj++)
             {
                 //check that is not the same object
                 if(generators[ii].name!=affected[jj].name)
                 {
                     //we obtain the force value and it vector
                     float distance= (generators[ii].position-affected[jj].position).magnitude;
                     Vector3 directionForce=(generators[ii].position-affected[jj].position)/distance;
                     float forceValue=(generators[ii].mass*affected[jj].mass)/Mathf.Pow(distance,2);

                     Debug.Log("Force "+generators[ii].name+"-->"+affected[jj].name+"  value = "+forceValue);

                     /*debug values for checking the force
                     Debug.Log (distance);
                     Debug.Log (directionForce);
                     Debug.Log (forceValue);
                     */
                     forces [jj] += Gfactor * forceValue * directionForce;
                 }
             }
         }

         // apply force
         for (int jj = 0; jj < affected.Count; jj++)
         {
             if (affected [jj]) {
                 affected [jj].AddForce (forces [jj]);
             }

             //reset force
             forces [jj] = new Vector3 ();
         }
     }
 
Last edited by a moderator:
  • #7
35,248
11,499
If you reduce all distances by a factor x, all velocities by a factor x and all masses by a factor x3 you should get the same result.
 
  • Like
Likes jedishrfu and berkeman
  • #8
Hi and thanks! That got the scaled down results much closer with the x3 !

I'm still missing something that I should be scaling though, as the 0.5 result orbits are still not stable as the 1.0 scale results. There seems to be too much force and they get sucked towards the center and go elliptical. Should Angular Drag be scaled too? It's a constant now.

The formula from that code is something like:

directionForce = centerPosition / distance;
forceValue = (centerMass * SatelliteMass) / Math.Pow(distance, 2);
force = GFactor * forceValue * directionForce;

Then apply force to the Unity physics engine's rigidbody for each orbiting object.


Thanks for fixing the code formatting above!
 
Last edited:
  • #9
35,248
11,499
What is "angular drag"?

The scaling is designed to keep the laws of physics the same.

If something is "sucked into the center" then something else went wrong, because every scaling should still lead to conic sections (elliptical, circular, parabolic or hyperbolic).

Maybe a problem with the integration method?
 
  • #10
Angular Drag is a setting exposed on the Unity physics engine's Rigidbody component. https://docs.unity3d.com/ScriptReference/Rigidbody-angularDrag.html They also expose mass and drag. I have tried several values for it and it doesn't seem to change the path much. I tried scaling it and not much effect either way.

What do you mean by the integration method? What the Unity physics engine is doing with the force added to the Rigidbody?

I'm not sure what else might need to be scaled. Thanks for your help!
 
  • #11
12,477
6,262
do you know which ode solver is used by unity for this example?

There are several common ones chosen based on whether things are periodic or not. What sometimes happens is that error is introduced with each iteration either positive or negative. You see it as the planet spiraling inward or outward ie energy added or energy lost. By trying a solver that is geared for periodic motion the energy added and subtracted oscillates keeping the simulation relatively accurate.

Some of the ones I recall are Euler, Euler-Richardson..., Runge-Kutta ala ode45 or ode23...

Eulers method tends to add or take away energy with each iteration but with smaller steps the changes are correspondingly smaller ie it’s more accurate over time. Range-Kutta 4th order always seemed to be the most widely used one. I think it’s stepsize varied during the simulation though.
 
  • #13
Problem solved. It was scaling mass by scaleFactor3 and not scaling the direction vector. Works great at any scale now. Thanks for everyone's help!!!
 
  • #14
12,477
6,262
That's great thanks for sharing your answer. It will help future posters with similar issues in the Unity world.

I had some students play with Unity a few years ago and its an awesome game engine. We simulated a trip flying through a deep water canyon using real ocean depth data using the Oculus Rift on a mac-mini and a variant on the Android tablet from pretty much the same code.

Perhaps you could write a PF Insights article on your implementation. I'm sure others here would be interested in reading it. There's no money in it only likes by happy readers.

https://www.physicsforums.com/insights/
 
  • #15
Sounds like a cool Unity project! It's really amazing how easy those types of simulations are with a game engine like Unity. In the old days of game programming it took a lot more work. It's hard to believe it's free to use. Thanks for the invitation to write an insights blog post. I'll take a stab at it. Where do I submit it?
 
  • #17
35,248
11,499
As a side remark: This scaling lead to an interesting problem in astronomy.

The mass of an object scales with the cube of its radius. If you change the distance and its radius by the same amount (as done here) you keep its angular diameter the same. The time stays the same as well, and the apparent magnitude doesn't change either. For a long time these two things were the only observables. So how do you measure distances, e. g. between Sun and Earth? None of the readily observable things depend on it!
Venus transits were the first reliable method - using parallax between two observers on Earth (where you know the distance between them). Today we can do direct measurements with radar and tons of spacecraft, of course.
 
  • #18
Hi Jedishrfu, I uploaded a couple messages to that application page. Including a link to a google doc with a draft of the blog post but have not heard anything back.
 
  • #19
12,477
6,262
I think the site owner does the approvals and he’s on extended travel this month.

You can PM him though at @Greg Bernhardt to see if it can be expedited. I will open a report for him as well.
 
  • #21
12,477
6,262
Just to let you know I’m still waiting on Greg. I’m guessing will be end of July before we hear back. He was traveling overseas and said he’d have limited internet access.
 

Related Threads on Do orbital dynamics scale linearly?

Replies
3
Views
4K
Replies
2
Views
1K
Replies
6
Views
4K
  • Last Post
Replies
3
Views
2K
Replies
3
Views
848
  • Last Post
Replies
7
Views
4K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
8
Views
1K
  • Last Post
Replies
2
Views
4K
Top