Mathematical Modeling of Foam Flooding