Modeling molecules is solids, liquids, and gases

Posted May 12, 2021 by mbuhl

Here is a model to simulate the forces between molecules.  It was written to show to middle school students, but it could be used at other levels too.  In particular, parts of the code are fairly involved.  Asking students to make any meaningful changes to the model is probably a high school or even college level assignment.


The model here does a really good job showing the difference between how molecules move in a solid liquid and gas.  You can see molecules collisions, where molecules approach each other and bounce off without touching.  I found that a good excuse to talked briefly about intermolecular forces,  By changing the heating, you can see the molecules change phase too.



While there is nothing major, there are a few limitations this model has.  At some point I hope to fix some of these.

1.  It is really slow.  The program could probably be optimized more, but as is if there are more than about 20 molecules it starts going really slow.

2.  Energy isn't strictly conserved, and does fluctuate a little.  This is just a result of the numerical algorithms used.

3.  Gravity was added, so if the particles form a liquid or solid they will eventually fall to the bottom of the screen.  However, for the life of me I cannot see where that is included in the code.

4.  The molecular forces used are actually a bit stronger than the ones in nature.

5.  Technically, the "Temperature" graph is actually measuring the average speed of the molecules, and not the true temperature.

Log in or register to view attachments and related links, and/or join the discussion