We consider a dilute gas of granular material inside a box, kept in a stati
onary state by vertical vibrations. A wall separates the box into two ident
ical compartments, save for a small hole at some finite height h. As the ga
s is cooled, a second order phase transition occurs, in which the particles
preferentially occupy one side of the box. We develop a quantitative theor
y of this clustering phenomenon and find good agreement with numerical simu
lations.