This paper presents a numerical study of the angle of repose, a most important macroscopic parameter in characterizing granular materials, by means of a modified distinct element method. Emphasis is given to the effect of variables related to factors such as particle characteristics, material properties, and geometrical constraints. The results show that sliding and rolling frictions are the primary reasons for the formation of a sandpile; particle size and container thickness significantly influence the angle of repose; and the angle of repose is not so sensitive to density, Poisson's ratio, damping coefficient, and Young's modulus. Increasing rolling friction coefficient or sliding friction coefficient increases the angle of repose. Conversely, increasing particle size or container thickness decreases the angle of repose. The underlying mechanisms for these effects are discussed in terms of particle-particle and particle-wall interactions.