lukepolson / youtube_channel

Notebooks for the python tutorials of my youtube channel. See specific youtube video for link to specifc notebook.
934 stars 834 forks source link

conservation of energy in multibody boltzmann simulation #12

Open guoci opened 1 year ago

guoci commented 1 year ago

I printed out the sum of squares of velocities in the simulation and observed the total energy varies over time. image https://github.com/lukepolson/youtube_channel/blob/main/Python%20GPU/multibody_boltzmann.ipynb

guoci commented 12 months 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 image