Formation and interaction of foams with porous materials