Flow through a porous medium with mass removal and diffusion