Thermodynamics is largely a study of the equilibrium states of fluids having spatially uniform properties such as temperature, pressure, and density. The notion of equilibrium refers ultimately to the idea that the molecules composing the fluid are in a statistical equilibrium insofar as the distribution of molecular velocities and other characteristics is concerned. At first sight, it may seem that the laws of thermodynamics should be incompatible with the analysis of flowing fluids where the pressure varies everywhere and there very well might be spatial gradients of temperature and density. Nonetheless, by careful consideration of how the laws of thermodynamics pertain to material fluid elements, the relevancy and application of thermodynamics to flowing fluids can be well justified.
Changes to a thermodynamic system over time that maintain the equilibrium are reversible processes, whereas those that disrupt the equilibrium, say, by the addition of currents evident in a moving fluid, are irreversible. For a thermodynamic system, such as a fluid in a closed container, to remain in equilibrium despite outside influences, such as compression caused by the movement of a piston or the purposeful addition of heat, the mechanism by which the molecules adjust to the imposed changes must act faster than the changes themselves. In gases, with each molecule experiencing approximately 1010 molecular collisions per second, information about changing circumstances can spread extremely quickly throughout the gas. Apart from extreme conditions, as in a shock wave, the gas has the capacity to maintain equilibrium during the change of its gross properties such as pressure. Similarly, in a liquid, the strong intermolecular forces bring about rapid passage of information throughout the fluid that maintain equilibrium.
Although it is not expected that thermodynamic equilibrium is maintained within a moving fluid if it is taken as a whole, it is not unreasonable to expect that equilibrium can be maintained for individual material fluid elements if they are small enough.