The contraction of the diaphragm causes an increase in the height of the thoracic cavity. Contraction of the intercostal muscles causes the diameter of the thoracic cavity to increase. The increased thoracic cavity volume brings a volume increase in intrapulmonary volume, which causes a drop in pressure relative to atmospheric pressure. Air rushes into lungs along this pressure gradient until intrapulmonary and atmospheric pressure are equal.