A fitting algorithm for solving inverse problems of heat conduction