Hover over the menu bar to pick a physics animation.

Animation of Breathing at the Molecular Level

This animation will show how lungs breathe. Some people may feel that the depiction is crude but this is necessary because any more complexity would detract from the lesson being taught.

Two types of breathing are frequently done:
1. Chest breathing where we expand our upper torso by our chest muscles.
2. Diaphragmatic breathing where we expand our lower torso by our diaphragm muscles.
We will animate the second type of breathing where the viscera other than the lungs move down which increases the volume of the lung, creating a slight vacuum for air to move in.

Please see: Diaphragm Breathing

Calculations

I chose to make the lungs and outer compartment (the room) which contains the air rectangular (parallelepipeds) instead of circular cylinders. Here the parallelepipeds which usually have parallelograms for sides instead have rectangles. In particular this is a square cuboid Thus we have two rectangular structures where the outer one is fully enclosed but the inner one has a hole at the top that I call the throat. Atoms hitting the rectangular sides simply have the normal component of their velocities reversed. Atoms hitting within the open throat go right through with no change in velocity. The atoms at the top of the lung that hit outside the throat do have the z component (`v_z`) of their velocities reversed. The logic of which atoms hitting the lung top need to have their `v_z` reversed is complicated. Here is what I used:

if((`|x|ltr_(Lung)` and `|y|ltr_(Lung)` and `|x|gt(tw)/2` ) or (`|y|ltr_(Lung)` and `|x|ltr_(Lung)` and `|y|gt(tw)/2`))
then reflect.

where `r_(Lung)` is the half width of the lung and `tw` is the full width of the throat and reflect just means that `v_z` should be reversed if the z coordinate of the atom contacts the top of the lung from either above of below the top.

Information