Viscosity is related to energy dissipation (conversion of mechanical energy into thermal energy). How that? Multiplying the (dynamic) viscosity (unit Pa s) with the shear rate (unit 1/s) yields the shear stress (shear force per area = shear energy per volume, unit Pa). Since we are dealing with plastic instead of elastic deformation, the shear energy is ‘decaying’ by relaxation at the molecular level. The shear energy is replenished by continuing shear. Multiplying again with the shear rate yields the power per volume (unit Pa/s).
What is the mechanism of disspation? Let’s first talk about condensed matter (as opposed to gases). The relaxation takes place by conformational changes into less strained configurations. The change isn’t smooth but more or less uphill and downhill on the energy ‘landscape’ (potential energy over configuration space). Downhill movements are fast and this is exciting vibrations. More or less corrugation of the energy landscape leads to higher/lower viscosity.
For different substances, there is no correlation with density. Compare, for example, two almost-n-alkanes C30 and C60 (with the same small fraction of short side chains to reduce the melting point). At, say, 100 °C, the density is almost equal while the viscosity is much larger for the longer chains.
For gases, the shear stress develops by transport of momentum between adjacent layers. The Kinematic Theory of Gases predicts that the dynamic viscosity does not depend on density (at constant temperature). The argument is as follows: Particles from a higher layer and particles from a lower layer collide in a middle layer. The spacing between the layers is about the mean free path, so that the colliding particles do stem from the two outer layers. Before the collision, the relative speed of the two particles has a systematic component equal to the velocity difference between the outer layers. That component is directed. After the collision, the relative speed is the same, but the direction is (almost) random. The surplus of kinetic energy has been thermalized. Now, when the density is lowered two times, the rate of collisions per particle decreases by a factor of two, and per unit volume by a factor of four. But the mean free path between collisions increases by a factor of two, as is the velocity difference between the outer layers. The surplus in kinetic energy (proportional to the square of the velocity difference) increases by a factor of four, which cancels the decrease in collision rate. So the dissipation rate does not depend on density.
Now think of carbon dioxide above the critical temperature. You can control the density via the pressure from gas-like to liquid-like without a phase transition. At high enough pressure, energy barriers emerge hindering the movements. This is the point where viscosity becomes strongly dependent on density.
It should be mentioned that a given corrugation of the energy landscape can be made much shallower than the mean thermal energy by raising the temperature. Then the rate of lokal conformation changes is much higher than the shear rate, and the shear stress becomes low again. That is the reason for the liquid outer core of the earth has a rather low viscosity (close to that of water), while the density is 10 to 12 g/cm³, roughly 50 % higher than the same mixture at normal pressure (and manageable temperature).
Thank you for the two previous answers of Santosh Kumar Singh and Carlos Araújo Queiroz
I remember that dynamic viscosity is equal to product of kinematic viscosity and density.
Personally, I discover some correlation between the two Arrhenius parameters related to the dynamic viscosity for some classical fluids.
I discover that we can estimate roughly the boiling point from the activation energy which is the energy necessary for the transition of molecules from a layer to an adjacent one, as I know!
Unfortunately, I'm not really specialized in this field, but if you can correlate these findings with the precedent discussions, you can reach interesting original conclusions!