Closed tigerchenlu98 closed 8 months ago
Amazing. Thank you! I don't understand it fully yet... will look at it tomorrow.
Very well spotted! The issue was that when BS accepts a step, it overwrites the initial y array by swapping a pointer, rather than copying all the individual values (because it's faster). And yes, to the other issue regarding the time during collisions! Thank you!
Hey Hanno, this one was quite tricky but think I figured it out!
1) Some issues with the scope of nbody_ode. After a merge (and seemingly only after a merge), only the local variable nbody_ode is updated, not the global r->odes[0]. To be honest I don't entirely understand why your code didn't work, everything looked fine to me - but I reassign y within the loop now and it seems to work.
2) Unrelated bug, but realized over the course of debugging that it's important to still update the actual r->t variable during the bs step. collision_resolve checks the last time of collision against the current simulation time, so this fails if the collision happens during the first call of bs_step.