When a system such as an ideal gas does work its internal energy is reduced. If compressed CO2 gas is released through a nozzle it will do work in expanding against air pressure and so its internal energy falls and the gas will cool and solidify.
If the system has work done on it its internal energy is increased. For example gas being compressed in a piston has its internal energy increased and so its temperature increases.
a system has work done on it its internal energy is increased.
If heat energy is transferred from the surroundings to a system then the system will increase its internal energy and the temperature of the system will increase. If the system expands when the heat is transferred (ie. the system does work) then the internal energy of the system will decrease by an amount equal to the work done.
Q is positive if heat is transferred to the system
Q is negative if heat is lost from the system
W is positive if work is done on the system
W is negative if work is done by the system
The internal energy is stored as PE in the interatomic bonds, continuously being stretched and compressed. It depends on the forces between the atoms and their separation. Where the intermolecular forces are weak the internal energy is nearly all KE and thus we see a link between kinetic theory, internal energy and temperature.
In an ideal gas only molecular KE is present. No work is done increasing the molecular separation (an ideal gas is assumed to have no forces of attraction between the molecules). Thus the internal energy of an ideal gas is independent of the volume of the gas and it will obey Boyle’s Law exactly.