Multi-Scale Model Formulation of a Porous Medium Biofilm Reactor and the Effects of Diffusion, Attachment, and Detachment on Reactor Performance