The study of thermodynamics really took off at the end of the Industrial Revolution. Kind of like parachute pants and mullets in the 1980s, only more useful.
Need a fun refresher on the Industrial Revolution? Check out this video.
Before heat engines became an important part of how we manufacture things (and how people make big bucks), studying the laws of thermodynamics was sort of a nerdy-scientist-sitting-in-his-laboratory kind of thing to do. "Let's think about heat, temperature, and energy until our heads start spinning, just to better understand how the universe works," thought the scientists of yore. That's a noble undertaking, but clearly not for everyone.
Then came the Industrial Revolution. Suddenly, we humans no longer made everything by hand. Machines, such as the steam engine, did a lot of the work for us. We could then manufacture ten, twenty, fifty times as much in a day as we could before. Underlying all of this productivity and oodles and oodles of profit was what? Everyone's favorite engine, Thomas the Tank Engine. Well, no. The other favorite engine, the heat engine.
The importance of the heat engine to the Industrial Revolution gave all of the thermodynamic brain gymnasts a tangible (and again, can we say profitable?) purpose: to make better and better heat engines.
Heat engines work by turning heat into mechanical work. Heat is input into the engine, by, for example, heating steam, and that input of heat is turned into work, such as the steam rising and turning a turbine or a wheel. The problem for industrialists was the huge inefficiencies of the early heat engines. Very little of the input heat turned into mechanical work.
Also, input heat doesn't grow on trees. Well, we can use trees as fuel, but we still have to spend time and money growing and cutting down those trees. Or time and money mining coal, to burn and heat the steam that turns the wheel. The more input heat that turns into work, the less money it costs the industrialist to run his factory.
The French scientist, Sadi Carnot, realized the importance of improving heat engines. His 1824 discovery, that the most efficient heat engine is one that's reversible, was driven by his desire to keep up with British engineers and his belief that had the French possessed more efficient heat engines, the Napoleonic Wars could have ended quite differently. Finding a more efficient way to turn heat into work meant military and economic superiority—and if there's one thing industrialists love, it's military and economic superiority.
From there, the study of thermodynamics took off, and for a long time it was an engineering science focused mainly on continually improving heat engines. Just so you know, the maximum theoretical efficiency of a Carnot Engine is 63%, but in the real world 40% is pretty dang awesome. Think about that the next time you're stuck in traffic.
The Second Law of Thermodynamics says that heat will always flow from a warm object to a cold object. So how do we keep the inside of the refrigerator cool? As usual, our first thought was gnomes. We don't know how they'd do, just that they would. Here in reality, though, we need to use a heat pump to take heat out.
Refrigerators move heat from the inside of the refrigerator and dump it outside into the kitchen. Of course, the universe doesn't favor this course of action, since heat spontaneously flows from warm to cold (and not the other way around). So how do we appease the universe into keeping our drinks cold?
Instead moving heat from a warm reservoir to a cold reservoir to do work (like a heat engine does), work has to be put into a refrigerator to move heat from a cold reservoir to a warm reservoir. What kind of work can a refrigerator do, though, to keep our food cold? It's not holding a 9-to-5 job and bribing the universe with its pay…is it?
Nah. What it actually does is circulate a coolant between the inside and the outside of the refrigerator. If you circulate a gas that is 5 °C from the inside of the fridge to the outside, it will be able to absorb excess heat from inside the fridge, but it won't dump it outside of the fridge—because again, heat doesn't move from a 5 °C gas to the 20 °C air in the kitchen willingly.
To transfer heat from the inside of the fridge to the kitchen air, the temperature of the circulating gas must be cooler than the inside of the fridge when it is inside the fridge, and then hotter than the kitchen air when it is outside of the fridge. That's the heat pump's job.
So how does the heat pump do that? By compressing and decompressing the gas. When a gas is compressed, it heats up. When allowed to expand, it cools down. PV = nRT rears its head again. Now let's take a tour of what's happening inside of a refrigerator to see how it all works.
Inside of the refrigerator, the coolant is under low pressure. This causes the gas to contract and cool down. It cools down enough so that the inside of the refrigerator acts as a hot reservoir. The excess heat in the refrigerator packs its bags and moves into the coolant, cooling down the refrigerator.
The coolant next travels through the coils to the outside of the refrigerator. But the air outside of the fridge is warmer (at least, if it's doing its job). If we just let the coolant circulate, the kitchen air would heat the coolant, instead of the coolant dumping heat from inside the fridge into the kitchen air. That sounds like a one step backwards, two steps even more backwards kind of situation.
To get the coolant to release the extra heat from the fridge rather than circulate it right back into the fridge, we have to do work on the coolant. This work is done by the refrigerator's compressor. It takes the coolant gas that is carrying the excess fridge heat and just smashes and smooshes and compresses it down. The compressor is in the business of compressing, and business is good.
This compression does more than provide a sense of fulfillment for the compressor; it also heats up the coolant. The compressor compresses the coolant so much that it becomes hotter than the kitchen air. Heat then moves from the coolant into the kitchen. Mission accomplished.
Then the coolant is pumped back into the fridge, under low pressure, expanding it, which in turn cools it back down below the interior of the fridge temperature and the cycle repeats.
Thermodynamics—keeping things frosty.