Open guoci opened 1 year ago
I have figured out the reason. at each iteration of the simulation, a particle can have multiple collisions. This results in the velocities being updated incorrectly. I modified the code to allow for only one collision for a particle and resolved the issue. Code at: https://github.com/guoci/youtube_channel/commit/5db3e7cb5e60f75d3a656970681becbc883ed69f
I printed out the sum of squares of velocities in the simulation and observed the total energy varies over time. https://github.com/lukepolson/youtube_channel/blob/main/Python%20GPU/multibody_boltzmann.ipynb