Mechanics and granular materials: theory and simulations