Skip to main content
Back to module
Thermodynamics & Fluids · Thermodynamics

Laws of thermodynamics

Reading32mLesson 1 of 3 in this module

Use the four laws of thermodynamics and apply the first law to a closed system, with sign conventions and the Carnot limit.

Why it matters

Every engine, power plant, refrigerator, boiler and chemical reactor is an energy bookkeeping problem. Thermodynamics gives you the rules for that bookkeeping. Civil engineers meet it in building energy and water heating, mechanical engineers in engines and HVAC, chemists in reaction energies, and materials scientists in phase changes and heat treatment. The laws are short; the skill is applying them carefully, with the right system, the right signs and the right units.

Systems and sign conventions

Start every problem by drawing a boundary around a system:

  • A closed system (control mass) lets energy cross the boundary but not mass. Example: gas trapped under a piston.
  • An open system (control volume) lets mass flow in and out. Example: a pump, turbine or heat exchanger.

Energy crosses a boundary in two ways: heat Q (driven by a temperature difference) and work W (everything else, such as a moving piston or a spinning shaft). This course uses the common engineering convention:

  • Q is positive when heat flows into the system.
  • W is positive when the system does work on the surroundings.

Some chemistry and physics texts use W positive into the system, which flips a sign in the first law. Always check which convention your textbook uses.

The four laws in one paragraph each

  • Zeroth law. If A is in thermal equilibrium with B, and B with C, then A is with C. This is why thermometers work.
  • First law. Energy is conserved. For a closed system: Q − W = ΔU (plus changes in kinetic and potential energy if they matter).
  • Second law. Heat flows on its own only from hot to cold, and no engine can turn all of its heat input into work. The best possible (Carnot) efficiency between a hot reservoir at T_H and a cold one at T_C is η = 1 − T_C / T_H, with temperatures in kelvin.
  • Third law. The entropy of a perfect crystal approaches zero as temperature approaches absolute zero. You rarely use it in engineering calculations, but it anchors entropy tables.

Worked example 1: heating gas under a piston

A cylinder holds air under a frictionless piston that keeps the pressure at 200 kPa. You add 50 kJ of heat, and the gas expands from 0.10 m³ to 0.25 m³. What is the change in internal energy?

At constant pressure, the boundary work is pressure times the change in volume. Note that kPa × m³ = kJ:

W  = P · (V2 − V1) = 200 kPa × (0.25 − 0.10) m³ = 30 kJ   (done by the gas, so positive)
ΔU = Q − W = 50 kJ − 30 kJ = 20 kJ

Only 20 kJ of the 50 kJ stayed in the gas as internal energy; the other 30 kJ left as work pushing the piston.

Worked example 2: the Carnot limit

A power plant boiler supplies heat at 600 K and the cooling water sits at 300 K. The second law caps any engine between these temperatures at:

η_Carnot = 1 − T_C / T_H = 1 − 300 / 600 = 0.50   (50 %)

Real plants reach much less, because real processes have friction, heat losses and finite temperature differences. If someone claims an efficiency above the Carnot value, there is an error somewhere.

The first law for open systems

For a steady-flow device with one inlet and one outlet, the first law becomes a rate balance using enthalpy h = u + Pv, which bundles the internal energy with the "flow work" needed to push fluid across the boundary:

Q̇ − Ẇ = ṁ · [ (h2 − h1) + (V2² − V1²)/2 + g (z2 − z1) ]

For many turbines, pumps and boilers the kinetic and potential terms are small, so Q̇ − Ẇ ≈ ṁ (h2 − h1). You will use this form for cycles in lesson 3. Watch the units: h is usually in kJ/kg, but V²/2 comes out in J/kg (m²/s²), so divide it by 1,000 before adding.

Common mistakes

  • Using °C in a temperature ratio. Carnot efficiency, ideal gas law and radiation all need kelvin. 300 °C is 573.15 K.
  • Mixing sign conventions. Decide once, write it at the top of your work, and stick to it.
  • Forgetting that work is a path quantity. P·ΔV is only right at constant pressure. For other processes, W is the area under the P–V curve.
  • Mixing kJ and J. Pressure in Pa times volume in m³ gives J; in kPa it gives kJ.

Recap

  • Draw the system boundary first: closed or open.
  • First law (closed): Q − W = ΔU. Open, steady flow: Q̇ − Ẇ = ṁ Δh when KE and PE are small.
  • Second law: η ≤ 1 − T_C/T_H with kelvin temperatures.
  • These are teaching examples. Real equipment is designed to codes and standards, and engineering designs that affect public safety must be reviewed by a licensed professional engineer.

Try it

On the Do tab, finish a Python function that applies the first law to a closed system, then use it on the piston problem.

Also in this lesson: