I'm afraid I haven't explained this very well, so I've gotten you terribly confused. So I'm going to try an entirely different approach. I'm going to introduce an analog system to our fluid in a tube that exhibits qualitatively all the key features of our fluid, including mass (inertia), compression/expansion, and viscous dissipation.
Consider a horizontal tube, closed at both ends, with a series of n equally spaced frictionless pistons situated along the cylinder axis, each with mass m. Each piston is connected to its two immediately neighboring pistons by a massless spring of spring constant k. The two pistons at the very ends of the cylinder are connected to the closed ends of the cylinder by a spring of spring constant k. This is case A. The pistons of mass m are analogous to the distributed mass of the fluid. The springs are analogous to the distributed compression/expansion behavior of the fluid. Now, at time zero, each of the pistons is given an initial velocity of v0. This corresponds to the initial velocity of the fluid at the time that the valves are closed. The total kinetic energy of the pistons at this time is ##nm\frac{v^2}{2}##. As time progresses, the total elastic energy stored in the springs plus the sum of the potential energies of the n pistons will be equal to this same value, and it will never change. The way that the velocities of the pistons and the elastic energy of the springs is distributed at any time is immaterial. This corresponds to the case where the fluid viscosity is zero.
Case B: Now consider the same model as above, but instead of just a spring being attached between each pair of pistons, there is also a damper. There are also dampers connected between the two pistons at the very ends and the closed ends of the cylinder. In this case, as time progresses, the viscous response of the dampers dissipates the sum of the kinetic energies of the pistons and the elastic energies stored in the springs. So, even though the total mechanical energy still starts out as ##nm\frac{v^2}{2}##, as time progresses the total mechanical energy decays to zero. At infinite time, the springs are at their unextended length, the velocities of all the pistons is zero, and the pistons are all equally spaced.
During the deformations in these two models, there will be regions where some of the springs are compressed and some of the springs are extended. This corresponds respectively to increased density and decreased density. But, in the end, the density is again uniform.
Are you able to understand these two cases and how they relate to your fluid problem?
Chet