We have studied two approaches to the modeling of bubbly and cavitating fluids. The first approach is based on the direct numerical simulation of gas bubbles using the interface tracking technique. The second one uses a homogeneous description of bubbly fluid properties. Two techniques are complementary and can be applied to resolve different spatial scales in simulations. Numerical simulations of the dynamics of linear and shock waves in bubbly fluids have been performed and compared with experiments and theoretical predictions. Two techniques are being applied to study hydrodynamic processes in liquid mercury targets for new generation accelerators.