Dynamics of erosion and deposition in tokamaks