We consider a dilute gas of granular material inside a box, kept in a
stationary state by shaking. A wall separates the box into two identical
compartments, save for a small hole at some finite height h. As the gas is
cooled, a second order phase transition occurs, in which the particles
preferentially occupy one side of the box. We develop a quantitative theory of
this clustering phenomenon and find good agreement with numerical simulations