Numerical simulation of temperature-driven free surface flows, with application to laser melting and polishing