Mathematical modeling and numerical simulation of polythermal glaciers