Discrete Hamilton's equations for viscous compressible fluid dynamics