A Multiscale Study of Foam: The Phase Behavior, Transport, and Rheology of Foam in Porous Media