In the process of developing oil fields, periodic disturbances are used to increase the flow rate of wells and the final oil recovery of formations by changing the mobility of oil and the filtration-capacity parameters of the porous medium. In an inhomogeneous medium, in the presence of dissipation and / or dispersion, harmonic oscillations created in the wellbores transform into sawtooth waves with periodic shock fronts, which change the dynamics of phase transitions and can lead to cavitation in liquid phases. Taking this circumstance into account will make it possible to adequately predict the dynamics of phase transitions and optimize the control of the oil production process.