Changing the Universal Gravitational Constant: A Java Applet

  • #1
6
2

Summary:

How to speed up an orbital mechanics model by changing parameters like the universal gravitational constant

Main Question or Discussion Point

Hello folks,

I am working on Java program just for fun to model an n-body problem using 3-dimension graphics. I'm looking for a way to speed up the model.
Suppose for example that I decide to increase the speeds of all objects by a factor of, say, 2. To compensate, I would also increase the universal gravitational constant by 2 squared = 4. Clearly the model would run faster, but would the behavior be the same? (i.e. Would orbits that were stable before remain stable?)
 
Last edited by a moderator:

Answers and Replies

  • #2
PeterDonis
Mentor
Insights Author
2019 Award
29,591
8,883
I'm looking for a way to speed up the model.
Meaning, to make it run faster? Or to make it simulate faster moving objects? They're not the same.

Suppose for example that I decide to increase the speeds of all objects by a factor of, say, 2.
If you wanted to simulate objects moving twice as fast, then yes, this is what you would do.

To compensate, I would also increase the universal gravitational constant by 2 squared = 4.
Why would you want to do this? I assume you want your model to simulate the correct laws of physics, not wrong ones.

Clearly the model would run faster
No, it wouldn't. It would simulate faster moving objects, but that's not the same as the model itself running faster. To run the model faster, you need a faster computer or a faster algorithm; how fast the model runs is not the same as how fast objects within the model move.
 
  • #3
6
2
Hi Peter,

Thank-you for you reply, and sorry if my question was a bit vague.

Ideally I would be using a supercomputer to run my model, but sadly I am on a limited budget. As an alternative, I'm wondering if I can simulate faster behavior by introducing parameters to speed up the bodies without destabilizing orbits that would otherwise have been stable.
 
  • #4
PeterDonis
Mentor
Insights Author
2019 Award
29,591
8,883
I'm wondering if I can simulate faster behavior by introducing parameters to speed up the bodies without destabilizing orbits that would otherwise have been stable.
First, as I said, you can simulate objects with faster speeds, but you can't just arbitrarily adjust any parameters you like, at least not if you want your model to be consistent with the laws of physics.

Second, as I said, simulating objects that are moving faster doesn't make the simulation itself run any faster.

Third, if what you actually want is to be able to simulate more time within the model in the same amount of computer time (for example, you want a 1 hour run to cover, say, two years of simulated time within the model instead of one), simulating objects that are moving faster is irrelevant--you will just be simulating one year's worth of faster moving objects. The only way to increase the amount of simulated time vs. computer time, if your computer power is fixed, is to increase the size of the time steps in your model. That makes the model able to simulate more model time in the same computer time, but it also decreases the model's accuracy. That is always a tradeoff that modelers have to make, of time vs. accuracy.
 
  • #5
6
2
Thanks again for your reply. I'd like to focus on your 3rd paragraph which I believe captures what is being asked. You wrote: "The only way to increase the amount of simulated time vs. computer time, if your computer power is fixed, is to increase the size of the time steps." I'd like to play devil's advocate and challenge your assertion that it is the only way. Are there possibly other creative ways that involve changing other variables besides the time step?

By the way, I agree about the time vs. accuracy tradeoff. I also agree that your recommended approach will work. I just wanted to explore some other alternatives to see if they are feasible (i.e. like adding multipliers to other variables like speed, etc.).
 
  • #6
PeterDonis
Mentor
Insights Author
2019 Award
29,591
8,883
Are there possibly other creative ways that involve changing other variables besides the time step?
Not if you want your simulation to be correct. As I said, you can't just arbitrarily change parameters if you want to be simulating the correct laws of physics.
 
  • Like
Likes Dragrath
  • #7
Vanadium 50
Staff Emeritus
Science Advisor
Education Advisor
2019 Award
24,537
7,418
I'm not sure what the benefit would be getting the wrong answer faster than the right answer.
 
  • Like
Likes Dragrath
  • #8
6
2
Assuming I go with the time-step approach, are there ways to mitigate the time-accuracy trade-off? (e.g. Take the average of the force at the beginning and end of the time interval)
 
  • #9
6
2
Hi Vanadium 50,
It's just a visual simulation. There's no question that I'm trying to answer. Nobody will mark this wrong. :smile:
 
  • #10
PeterDonis
Mentor
Insights Author
2019 Award
29,591
8,883
Assuming I go with the time-step approach, are there ways to mitigate the time-accuracy trade-off? (e.g. Take the average of the force at the beginning and end of the time interval)
There are various different possible algorithms, which have different properties. I don't know that there is any general rule.
 
  • #11
PeterDonis
Mentor
Insights Author
2019 Award
29,591
8,883
It's just a visual simulation.
If you don't care whether it's correct or not, obviously there are lots of ways to make it faster. But that would be off topic for a discussion in a physics forum. Here we only discuss correct ways of doing physics simulations, not "it looks plausible visually but isn't based on correct physics" ways.
 
  • Like
Likes Dragrath
  • #12
202
376
The only way to increase the amount of simulated time vs. computer time, if your computer power is fixed, is to increase the size of the time steps in your model.
I think what @Ashley Gates is proposing is identical to increasing the time step.
 
  • #13
6
2
I hope I haven't violated the terms of this forum. If so, perhaps I should reframe the problem as occurring in an alternate universe where G is some other value than 6.674e-11, and hence not violating any laws of physics in that universe. :smile:
 
  • #14
PeterDonis
Mentor
Insights Author
2019 Award
29,591
8,883
I think what @Ashley Gates is proposing is identical to increasing the time step.
That's what he means by "the time step approach", yes. But that's not the only approach he's proposed.
 
  • #15
PeterDonis
Mentor
Insights Author
2019 Award
29,591
8,883
perhaps I should reframe the problem as occurring in an alternate universe where G is some other value than 6.674e-11, and hence not violating any laws of physics in that universe.
We don't discuss hypothetical universes with hypothetical other laws of physics here (except possibly in the context of string theory "multiverse" discussions in the Beyond the Standard Model forum--but even those require actual references, not just personal speculations). We only discuss the actual universe with the actual laws of physics. I think we've covered that case sufficiently.

Thread closed.
 

Related Threads on Changing the Universal Gravitational Constant: A Java Applet

Replies
1
Views
973
Top