A wall function approach in lattice Boltzmann method: algorithm and validation using turbulent channel flow