Variational Methods for Continuum Models of Granular Materials