Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collision Test Fix #746

Merged
merged 1 commit into from
Jan 26, 2024
Merged

Conversation

tigerchenlu98
Copy link
Contributor

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.

@hannorein
Copy link
Owner

Amazing. Thank you! I don't understand it fully yet... will look at it tomorrow.

@hannorein
Copy link
Owner

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!

@hannorein hannorein merged commit 2f4b841 into hannorein:newTRACE4 Jan 26, 2024
15 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants