When a porous ionic solid is placed in acid, the acid will dissolve surface material. When this dissolved material and the acid diffuse into the solid's pores, they can precipitate more solid. If the acid is buffered, the diffusing species can bring about precipitation in some regions and dissolution in others. When the porous solid contains several chemical species, the diffusion can precipitate one species and dissolve another. The results have implications for the demineralization of teeth.