Simulation of transient wall pumping, fuelling effects and density control in tokamaks