A surface energy exchange model of glacier melt and net mass balance