Numerical simulation of comet nuclei I. Water-ice comets