Granular media composed of elongated particles rearrange and order vertically upon vertical vibration. We perform pseudo-two-dimensional discrete element model simulations and show that this phenomenon takes place also with no help from vertical walls. We analyze quantitatively the sizes of voids forming during vibrations and consider a void-filling mechanism to explain the observed vertical ordering. Void filling can explain why short rods are less prone to align vertically than long ones. We cannot however explain, invoking just void-filling, the existence of an optimum acceleration to promote vertical ordering and its dependence on particle length. We finally introduce a novel interpretation of the phenomenon, by considering the energetic barriers that particles have to overcome to exit a horizontal or a vertical lattice. By comparing these energetic thresholds with the peak mean particle fluctuant kinetic energy, we identify three different regimes. In the intermediate regime a vertical lattice is stable, while a horizontal is not. This interpretation succeeds in reconciling both dependencies on vibration acceleration and on particle length.