Sedimentation and flow through porous media: Simulating dynamically coupled discrete and continuum phases.