Energy balance
The energy balance within a defined system is based on the principle of conservation of energy. According to this principle, the total energy of the system is a constant quantity; however, the form of energy might be changed. For the energy balance in thermodynamics, the sum of all types of energies i.e. potential energy, internal energy, kinetic energy etc. is constant
Variables used on this page
Definition  Variable  Additional Information 

Enthalpy  is the specific enthalpy (enthalpy per unit mass).
 
Internal energy  is specific internal energy (internal energy per unit mass).  
Pressure  The applied perpendicular force per unit area  
Flow velocity  Velocity is a vector. Average velocity in a single component system often reported as a scalar and is . Often the brackets are not used for average velocity. In multicomponent systems, both a mass average velocity vector and a molar average velocity vector can be defined .  
Specific Kinetic Energy  Energy per unit mass due to bulk motion  
Gravity  Actually acceleration due to gravity. A vector, in principle, it is normal to earth's surface  
Elevation  The elevation is a distance (length) above or below a fixed reference point  
Total Specific Energy  A conserved intrinsic quantity  
Density  Mass per unit volume  
Shaft Work  Energy transferred though mechanical contact. Positive if work is done one the system. is work per unit time (power) and is work per unit mass (specific energy).  
Volumetric flow rate 
 
Mass flow rate  or more generally
 
Unit normal  The unit normal is orthogonal (or normal, or perpendicular) to a differential surface of area dA. 
First law of thermodynamics for control volumes
The total energy is the sum of internal energy, kinetic energy, and potential energy, and the macroscopic total energy represents the first law of thermodynamics applied to a flowing system. It contains both thermal energy and mechanical energy terms, however, it does not restrict how energy is partitioned between the thermal and mechanical terms. The energy balance applied to a control volume is

(1) 
If the control volume has welldefined inlets and outlets, the total energy across the control surface due to both bulk fluid flow and conduction can be integrated and Equation (1) can be expressed as

(2) 
We can further simplify the above expression by using a kinetic energy correction factor

(3) 
As mentioned above, the total energy balance does not restrict how energy is distributed between the internal energy/heat and mechanical energy (kinetic and potential)/shaft work terms. Hence, while a process may satisfy Equation (3) it can still violate the second law of thermodynamics if the overall entropy decreases. To circumvent this issue, we can break the overall energy balance into two independent equations:
What is the mechanical energy balance? This is a special subcase of the of total energy balance for a flowing a system that involves only the kinetic and potential terms of the total energy balance. The mechanical energy balance is not a conservation law, but it does provide a direct conection between pressure, flow velocity, and elevation. It is used when pressure drop must be determined.
What is the internal energy balance? This a special subcase of the of total energy balance for a flowing a system that involves only the thermal energy terms of the total energy balance and is used in problems involving heat transfer. The internal energy balance, for instance, can be used to find the temperature increase of a flowing fluid due to viscous dissipation or due to heat transfer across the system boundary.
The sum of the mechanical energy balance and the internal energy balance, in turn, is the total energy balance.