Space-dependent diffusion of hydrogen in carbon nanotubes