Modeling foamy oil flow in porous media