Presenting a mathematical model for seismic response of the water pipes buried in the soil is the main contribution of this study. The structure is subjected to far-fault earthquake load. The pipe is conveying water mixed by nanoparticles where the Navier–Stokes equation is used for considering the interaction of fluid and pipe. The surrounding soil medium is simulated by spring elements. Utilizing the cylindrical shell element, the pipe is modeled mathematically and the motion equation of the structure is derived by Hamilton's principal. Based on Galerkin and Newmark methods, the dynamic deflection of the structure is calculated. The effects of different parameters such as fluid velocity, soil medium, volume percent of nanoparticle in fluid, boundary condition and geometrical parameters of the pipe are shown on the dynamic deflection of the structure. Numerical results indicate that water pipe buried in the solid has lower dynamic deflection with respect to the pipe without soil foundation.