Lattice boltzmann simulation of open flows with heat transfer