The internal energy balance starts with subtracting the mechanical energy balance from the total energy balance
${{d} \over {dt}}\iiint \limits _{CV}{\rho {\hat {u}}}dV=\sum \limits _{in,i}{{\dot {m}}_{i}}{\hat {u}}_{i}\sum \limits _{out,j}{{\dot {m}}_{j}}{\hat {u}}_{j}+{\dot {Q}}+{\dot {E}}_{compression}+{\dot {E}}_{viscous}$

(1)

where ${\dot {E}}_{compression}$ is the rate of reversible conversion of mechanical energy into internal energy due to compression of the fluid and is defined as
${\dot {E}}_{compression}=\iiint \limits _{CV}{P\left({\nabla \cdot {\bf {v}}}\right)}dV$

(2)

This term is positive if the fluid is under compression and negative if the fluid is under expansion; it is zero if the fluid is incompressible. The viscous loss term ${\dot {E}}_{viscous}$ is the irreversible conversion of mechanical energy into internal energy due to viscous dissipation.
${\dot {E}}_{viscous}=\iiint \limits _{CV}{\left({{\boldsymbol {\tau }}:\nabla {\bf {v}}}\right)dV}$

(3)

Its precise form depends on the constitutive equation to describe viscosity. For instance, for an incompressible Newtonian, fluid in cylindrical coordinates ${\boldsymbol {\tau }}:\nabla {\bf {v}}$ has the following form:
$\left({\boldsymbol {\tau }}:\nabla {\bf {v}}\right)=2\mu \left[{{\left({{\partial v_{r}} \over {\partial r}}\right)}^{2}+{\left({{{1} \over {r}}{{\partial v_{\theta }} \over {\partial \theta }}+{{v_{r}} \over {r}}}\right)}^{2}+{\left({{\partial v_{z}} \over {\partial z}}\right)}^{2}}\right]+\mu {\left[{r{{\partial } \over {\partial r}}\left({{v_{\theta }} \over {r}}\right)+{{1} \over {r}}{{\partial v_{r}} \over {\partial \theta }}}\right]}^{2}+\mu {\left[{{{1} \over {r}}{{\partial v_{z}} \over {\partial \theta }}+{{\partial v_{_{\theta }}} \over {\partial z}}}\right]}^{2}+{\mu }{\left[{{{{\partial v}_{r}} \over {\partial z}}+{{{\partial v}_{z}} \over {\partial r}}}\right]}^{\rm {2}}$

(4)

which is the sum of the square of the velocity gradients multiplied by the viscosity, which is always a positive value. If the fluid is inviscid (no viscosity) or has no velocity gradients, the viscous loss term will also be zero. The viscous loss terms can be determined if the flow profile is completely known (i.e. by solving the NavierStokes equations). However, this is only feasible for laminar flow. Most flows in practice are turbulent, and we do not know the exact flow profile. Hence, the values of such terms come from experiments, and we will use correlations to determine the viscous loss.
Control volumes with one inlet and one outlet
For control volumes with one inlet and one outlet, ${\dot {m}}_{in}={\dot {m}}_{out}={\dot {m}}$ the mechanical energy balance can be written as
${{d} \over {dt}}\iiint \limits _{CV}{{\rm {\rho }}{\hat {u}}}dV={\dot {m}}\left({{\hat {u}}_{2}{\hat {u}}_{1}}\right)+{\dot {Q}}+{\dot {E}}_{compression}+{\dot {E}}_{viscous}$

(5)

where subscript 2 denotes the outlet and subscript 1 denotes the inlet. If the density, pressure, and velocity of the fluid do not vary over the crosssection of the control volume, Equation (2) can be directly integrated as
${\dot {E}}_{compression}={\dot {m}}\left({{{P_{2}} \over {\rho _{2}}}{{P_{1}} \over {\rho _{1}}}}\right){\dot {m}}\int _{2}^{1}{{1} \over {\rho }}dP$

(6)

and the internal energy balance becomes
${{d} \over {dt}}\iiint \limits _{CV}{{\rm {\rho }}{\hat {u}}}dV={\dot {m}}\left({{\hat {h}}_{2}{\hat {h}}_{1}}\right){\dot {m}}\int _{1}^{2}{{1} \over {\rho }}dP+{\dot {Q}}+{\dot {E}}_{viscous}$

(7)

where ${\hat {h}}={\hat {u}}+P/\rho$
It should be noted that the specific internal energy of a fluid at constant volume is ${\hat {u}}=c_{v}T$ and the specific enthalpy change of the fluid is related to the change in temperature and pressure
${{\hat {h}}_{2}}{{\hat {h}}_{1}}=\int _{1}^{2}{{c_{p}}dT}+\int _{1}^{2}{\left[{{1 \over \rho }T{{\left({{\partial \left({1/\rho }\right)} \over {\partial T}}\right)}_{p}}}\right]dP}$

(8)

and the internal energy balance can be written as
${{d} \over {dt}}\iiint \limits _{CV}{\left({{\rm {\rho }}c_{v}T}\right)}dV={\dot {m}}\left({\int _{1}^{2}{c_{p}dT}\int _{1}^{2}{T{\left({{\partial \left({1/\rho }\right)} \over {\partial T}}\right)}_{P}dP}}\right)+{\dot {Q}}+{\dot {E}}_{viscous}$

(9)

For an incompressible fluid with a heat capacity that is independent of temperature, the internal energy balance simplifies to
${{d} \over {dt}}\iiint \limits _{CV}{\left({{\rm {\rho }}c_{v}T}\right)}dV={\dot {m}}c_{p}\left({T_{2}T_{1}}\right)+{\dot {Q}}+{\dot {E}}_{viscous}$

(10)

See also