Inverse reconstruction of initial and boundary conditions of a heat transfer problem with accurate final state