When a porous solid is placed in acid, the solid dissolves at its surface. However, the same solid can precipitate or dissolve in pores inside the solid. The internal precipitation is a consequence of a nonlinear solubility product amplified by fast chemical kinetics. The internal dissolution can be enhanced by unequal diffusion coefficients. Both precipitation and dissolution can occur simultaneously but in different regions, mimicking the patterns of mineral found in teeth.