Micromechanical investigation of granular ratcheting using a discrete model of polygonal particles