A method is given for diverting acids in matrix acidizing and acid
fracturing. The acids are diverted with a diverting agent that is an
energized or foamed acidic viscoelastic surfactant system that contains a
viscoelastic surfactant that gels and increases in viscosity when the
acid in the foamed acidic viscoelastic surfactant system is spent. The
method provides a synergistic combination of the diverting capabilities
of foams and the diverting capabilities of viscoelastic gel systems. The
resistance to flow of the gelled foamed viscoelastic surfactant system is
greater than expected from a foam or a viscoelastic gel system alone.