Basic thermodynamic attributes of mass and energy conservation are clearly outlined in the First Law of Thermodynamics. First law basically dictates that the overall mass and overall energy (in any of their forms) can not be created or destroyed in a process.
In an open system, where we have continuous flow of mass, two (2) equations for each mass balance and energy balance can be written as follows:
min - mout = Δm ... (1) mass balance
Ein - Eout + ΔE = Q - W ...(2) energy balance
Equation (1) represents the conservation of mass, where m represents the mass flow and Δm is the change in internal system mass.
On the other hand, equation (2) represents the conservation of energy, where E is the overall energy flowing into or out of the system, ΔE is the change in energy stored in the system, Q is the heat added to the system and W is the work produced from the system.
The terms on the left side of equation (2) represent stored energy entering or leaving the system, named after letter E. Stored energy components typically consist of: system's internally stored energy, kinetic energy and potential energy. The terms on the right side are the heat transferred to the system, Q, and the work done by the system, W.
Typical diagram illustrating various thermodynamic processes
The conservation of energy states that a balance exists between energy, work and heat entering and leaving a thermodynamic system. This balance of energy flow is referred to as The first Law of Thermodynamics.