Discrete-element modeling of granular materials