An enthalpy formulation for glaciers and ice sheets