hannorein / rebound

💫 An open-source multi-purpose N-body code.
https://rebound.readthedocs.io/
GNU General Public License v3.0
852 stars 219 forks source link

OpenGL and restarting simulations with planetesimal disks #237

Closed silburt closed 7 years ago

silburt commented 7 years ago

If OpenGL = 1 and I run a simulation (e.g. star, 2 planets), save it as a binary, and then restart the simulation adding a disk of planetesimals, the simulation will crash with the following error message: "Trace/BPT trap: 5"

However, if I conduct the same experiment with OpenGL = 0, everything seems to work no problem. Furthermore, if OpenGL = 1 and I restart the simulation without adding any planetesimals (i.e. start a sim, save as binary, restart sim), things also seem to work without any problems. So I wonder if adding new bodies is not being updated in the OpenGL visualization?

hannorein commented 7 years ago

I guess that should be working. But I haven't tried it out much with varying particle numbers.

hannorein commented 7 years ago

Hm. I cannot reproduce this. I tried it out with both the WHFast and SEI integrators and it seems to work for me. Can you post a minimal example that shows this issue (remove everything that is not necessary to reproduce this. Thanks!

silburt commented 7 years ago

Here's a simple (as I can make it) example which crashes when openGL is enabled but runs fine when it's disabled. Furthermore, it works fine if no planetesimals are added. No arguments to set, just compile and run. Saved it in a zip since github doesn't support .c files.

problem_simple.c.zip

silburt commented 7 years ago

In case it runs fine for you - when I run this with lldb, I get the following output:

librebound.so was compiled with optimization - stepping may behave oddly; variables may not be available. Process 42792 stopped

hannorein commented 7 years ago

Is that really the minimal example? ;-)

The error message looks like a race condition...