Comments (6)
You need to think about what the primary object should be when calculating orbital elements. Right now you use the star (sim.particles[0]). But there are also planets in the system which pull on the star. Calculate the centre of mass of the star and all planets interior to STARMAN. Then use that as the primary when calculating orbital parameters for STARMAN. This procedure is referred to as Jacobi coordinates. It will reduce the spikes but not completely get rid of them because there will still be other interactions with planets that affect the instantaneous orbital elements. I hope this helps.
from rebound.
I'll close this issue for now but feel free to reopen it if you have further questions.
from rebound.
Hi, thanks for your answer, I have tried to do calculate the center of mass including the star and the planets and use this as reference but I don't get how I can later use orbit = sim.particles[-1].calculate_orbit(primary=com)
to have accurate orbital elements if the primary is not the sun. I have tried it and get a = 4000 AU and even negative semi major axis.
from rebound.
That suggests the centre of mass you calculate is not correct. How do you calculate it?
from rebound.
This is my code
sim = rebound.Simulation()
sim.add(["Sun","Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune"],date="2018-02-10 00:00")
sim.save("ss.bin")
sim.move_to_com()
com = sim.calculate_com()
sim = rebound.Simulation("ss.bin")
sim.add("SpaceX Roadster")
sim.dt = sim.particles[1].P/60. # small fraction of Mercury's period
sim.integrator = "mercurius"
tmax = 1e3
N = 100000
times = np.linspace(0.,2.*np.pi*tmax,N)
for i,t in enumerate(times):
sim.integrate(t,exact_finish_time=0)
orbit = sim.particles[-1].calculate_orbit(primary=com)
I skipped a few lines to make it easier for you
from rebound.
As I wrote before you need to calculate the centre of mass of all the planets interior to the spacecraft. You can do something like this:
sim = rebound.Simulation()
sim.add(["Sun","Mercury","Venus","Earth"],date="2018-02-10 00:00")
com_inner = sim.calculate_com()
sim.add(["Mars","Jupiter","Saturn","Uranus","Neptune"],date="2018-02-10 00:00")
sim.add("SpaceX Roadster")
sim.save("ss.bin")
a = sim.particles[-1].calculate_orbit(primary=com_inner).a
By the way, these lines don't make sense in your code
sim.save("ss.bin")
sim.move_to_com()
com = sim.calculate_com()
sim = rebound.Simulation("ss.bin")
If you first move the simulation to the centre of mass frame, then the centre of mass will be zero. No need to calculate it! Even more confusingly, you are then loading a simulation which was saved before you moved to the com. I suggest you go through the code line by line and try to understand what it does. Coordinate systems and especially orbital elements can be confusing!
from rebound.
Related Issues (20)
- The Aarseth (1985) timestep criterion is incorrectly implemented HOT 1
- Raise exception when two particles are further apart than a set amount HOT 6
- A wrong variable name in the documentation HOT 6
- A weird behavior when integrating as system with Mercurius HOT 11
- Different integrators obtain different orbits HOT 3
- `configure_ghostboxes` has no effect HOT 2
- Attribute error Question HOT 3
- Inconsistency in solution across inclination HOT 16
- Adding particles via Horizons system HOT 3
- There are quite significant differences in the orbital elements of asteroids and their clones HOT 9
- Soft sphere implementation HOT 3
- MEGNO time evolution HOT 17
- WHFast512 on macOS system HOT 1
- run solar system with and without planet to planet gravity forces HOT 1
- MOID calculation at a given timestep HOT 6
- How to read the binary file output? HOT 8
- how to read snapshots in a loop HOT 4
- viewing a SA from the command line ("sadump") HOT 6
- There don't appear to be any reference docs? HOT 3
- TRACE crashes after adding 2 particles after a merger event (on ARM-based Mac; [edit:] on Linux, too) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rebound.