Physics · Intermediate

Carnot cycle PV diagram

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

The Carnot cycle is an idealized reversible heat engine made of two isothermal and two adiabatic steps, drawn as a closed loop on a pressure-volume diagram. The area enclosed by the loop equals the net work per cycle, and the efficiency depends only on the hot and cold reservoir temperatures.

Intuition

Imagine a gas in a cylinder with a piston. On the PV diagram, each state of the gas is a point, and a reversible process is a curve. In the Carnot cycle, the gas first expands while touching a hot reservoir, staying at constant temperature and absorbing heat. Then it is insulated and keeps expanding, cooling as it does work. Next it is compressed against a cold reservoir, dumping heat at constant low temperature. Finally it is compressed in insulation, warming back to the starting state. The expansion curves lie above the compression curves, so the loop encloses area, and that area is the net work you get out. No real engine operating between the same two temperatures can beat this efficiency, because any heat transfer across a finite temperature difference or any friction creates entropy and wastes work.

Key equations

PV=nRT
(1)

Ideal gas law; on an isotherm P falls as 1/V.

PVγ=constant
(2)

Reversible adiabat for an ideal gas, steeper than an isotherm.

Q=nRTln⁡VfVi
(3)

Heat absorbed (equal to work done) in an isothermal ideal-gas process.

Wnet=QH−QC=∮PdV
(4)

Net work equals the enclosed loop area.

η=1−TCTH
(5)

Carnot efficiency, with temperatures in kelvin.

Derivation

  1. Label the states: A to B isothermal expansion at T_H; B to C adiabatic expansion cooling to T_C; C to D isothermal compression at T_C; D to A adiabatic compression back to T_H.
  2. Isothermal steps: Q_H = nRT_H ln(V_B/V_A) and Q_C = nRT_C ln(V_C/V_D), the heat rejected.
  3. Adiabats give T_H V_B^{γ-1} = T_C V_C^{γ-1} and T_H V_A^{γ-1} = T_C V_D^{γ-1}.
  4. Dividing these two equations gives V_B/V_A = V_C/V_D, so the logarithms are equal.
  5. Therefore Q_C/Q_H = T_C/T_H.
  6. Efficiency is η = W/Q_H = 1 - Q_C/Q_H = 1 - T_C/T_H.

Worked example

Problem

A Carnot engine operates between 500 K and 300 K and absorbs 2000 J of heat from the hot reservoir per cycle. Find its efficiency, the work per cycle, and the heat rejected.

  1. Efficiency: η = 1 - 300/500 = 0.40.
  2. Work: W = η Q_H = 0.40 × 2000 J = 800 J.
  3. Heat rejected: Q_C = Q_H - W = 2000 - 800 = 1200 J.
  4. Check: Q_C/Q_H = 1200/2000 = 0.6 = T_C/T_H.

Answer Efficiency 40%, work 800 J, heat rejected 1200 J per cycle.

Common mistakes

  • Using Celsius instead of kelvin in the efficiency formula.
  • Drawing adiabats shallower than or equal to isotherms; adiabats are steeper.
  • Thinking the adiabatic steps involve heat exchange; Q is zero there, but temperature changes.
  • Believing a Carnot engine can reach 100% efficiency; that would require T_C = 0 K.
  • Forgetting that the loop must be traversed clockwise for an engine; counterclockwise gives a refrigerator.

Animation

Animation coming soon

The animated version of this lesson is being prepared for the web. In the Signals AI app, lessons are drawn step by step.

Code

scene.py(105 lines)
import sys
import numpy as np
from manim import *
from blocks import *

GAMMA = 5.0 / 3.0
NR = 1.0  # n*R in scaled units
TH, TC = 500.0, 300.0
V1, V2 = 1.0, 2.0


def trapezoid(y, x):
    """Plain trapezoid rule, independent of numpy version."""
    y = np.asarray(y, dtype=float)
    x = np.asarray(x, dtype=float)
    return float(np.sum((y[1:] + y[:-1]) * np.diff(x)) / 2.0)


def carnot_states():
    """Compute the four corner states (V, P, T) of an ideal-gas Carnot cycle."""
    V3 = V2 * (TH / TC) ** (1.0 / (GAMMA - 1))
    V4 = V1 * (TH / TC) ** (1.0 / (GAMMA - 1))
    pts = {"A": (V1, TH), "B": (V2, TH), "C": (V3, TC), "D": (V4, TC)}
    return {k: (v, NR * t / v, t) for k, (v, t) in pts.items()}


def branch(name, n=60):
    """Return sampled (V, P) points for a branch of the cycle."""
    S = carnot_states()

    def iso(a, b, T):
        vs = np.linspace(S[a][0], S[b][0], n)
        return vs, NR * T / vs

    def adi(a, b):
        vs = np.linspace(S[a][0], S[b][0], n)
        k = S[a][1] * S[a][0] ** GAMMA
        return vs, k / vs ** GAMMA

    return {"AB": iso("A", "B", TH), "BC": adi("B", "C"),
            "CD": iso("C", "D", TC), "DA": adi("D", "A")}[name]


def efficiency_work():
    """Net work from integrating the loop and heat Qh from the isotherm."""
    br = {k: branch(k, 2000) for k in ["AB", "BC", "CD", "DA"]}
    W = sum(trapezoid(p, v) for v, p in br.values())
    S = carnot_states()
    Qh = NR * TH * np.log(S["B"][0] / S["A"][0])
    return W, Qh


class Main(Scene):
    def construct(self):
        TitleCard(self, "Carnot cycle", "Ideal gas PV diagram")
        S = carnot_states()
        vmax = max(s[0] for s in S.values())
        pmax = max(s[1] for s in S.values())
        axes = Axes(x_range=[0, vmax * 1.1, 1], y_range=[0, pmax * 1.1, 100],
                    x_length=7, y_length=4.2,
                    axis_config={"color": C_DIM, "include_tip": True,
                                 "include_numbers": False})
        axes.shift(LEFT * 1.5 + DOWN * 0.3)
        xl = Text("V", font_size=24).next_to(axes.x_axis.get_end(), DOWN, buff=0.15)
        yl = Text("P", font_size=24).next_to(axes.y_axis.get_end(), LEFT, buff=0.15)
        self.play(Create(axes), FadeIn(xl), FadeIn(yl))
        colors = {"AB": C_BAD, "BC": C_ACCENT, "CD": C_MAIN, "DA": C_GOOD}
        notes = {"AB": "A to B: isothermal expansion, heat in",
                 "BC": "B to C: adiabatic expansion, cools",
                 "CD": "C to D: isothermal compression, heat out",
                 "DA": "D to A: adiabatic compression, heats"}
        for k in ["AB", "BC", "CD", "DA"]:
            vs, ps = branch(k)
            pts = [axes.c2p(v, p) for v, p in zip(vs, ps)]
            c = VMobject(color=colors[k], stroke_width=5).set_points_as_corners(pts)
            StepCaption(self, notes[k])
            self.play(Create(c), run_time=2)
        # corner labels
        for k, (v, p, t) in S.items():
            d = Dot(axes.c2p(v, p), radius=0.07, color=WHITE)
            off = {"A": UL, "B": UR, "C": UR, "D": UL}[k]
            lab = Text(k, font_size=24).next_to(d, off, buff=0.08)
            self.add(d)
            self.play(FadeIn(lab), run_time=0.2)
        W, Qh = efficiency_work()
        eta = W / Qh
        info = VGroup(Text(f"Th = {TH:.0f} K", font_size=24, color=C_BAD),
                      Text(f"Tc = {TC:.0f} K", font_size=24, color=C_MAIN),
                      Text(f"W/Qh = {eta:.2f}", font_size=24, color=C_ACCENT))
        info.arrange(DOWN, aligned_edge=LEFT, buff=0.25).to_edge(RIGHT, buff=0.6)
        self.play(FadeIn(info))
        StepCaption(self, "Efficiency depends only on the two temperatures")
        self.wait(1.5)


if __name__ == "__main__" and "--selftest" in sys.argv:
    S = carnot_states()
    assert abs(S["B"][2] * S["B"][0] ** (GAMMA - 1) - S["C"][2] * S["C"][0] ** (GAMMA - 1)) < 1e-9
    assert abs(S["A"][2] * S["A"][0] ** (GAMMA - 1) - S["D"][2] * S["D"][0] ** (GAMMA - 1)) < 1e-9
    for a, b, n in [("A", "B", "AB"), ("B", "C", "BC"), ("C", "D", "CD"), ("D", "A", "DA")]:
        v, p = branch(n)
        assert abs(v[0] - S[a][0]) < 1e-9 and abs(p[-1] - S[b][1]) < 1e-6
    W, Qh = efficiency_work()
    assert abs(W / Qh - (1 - TC / TH)) < 1e-3
    print("ok")

The Manim scene code that draws this lesson's animation in the Signals AI app (Python, Manim Community).

ccBYNC© 2026 SignalsLab. Lesson text shared as is under CC BY-NC 4.0.