An efficient immersed boundary method for thermal flow problems with heat flux boundary conditions