A thermodynamic cycle returns to its initial state after several processes. Its net work is the signed area accumulated over the pressure-volume path, while heat transfers close the energy ledger.
Represent each leg as an object with a process type, start constraints, parameter values, endpoint rule, heat convention, and work convention. Run legs sequentially; the output state of one is the input state of the next. Record (P,V,T,U,Q,W) and units after every transition, rather than calculating a single net value from a chart.
With work defined as work done by the system, a per-leg first-law ledger is:
\[\Delta U_i=Q_i-W_i, \qquad \sum_i\Delta U_i=0 \text{ for a closed cycle}.\]The final state must equal the initial state within tolerances for each state variable, not merely have matching pressure-volume coordinates. The net signed (P,dV) area is one representation of work; the leg ledger is the testable implementation.
For a heat engine, define positive heat input Q-in as energy entering from the hot reservoir and useful work output W-out by a stated sign convention:
\[\eta=\frac{W_{\mathrm{out}}}{Q_{\mathrm{in}}}, \qquad 0\leq\eta\leq1 \text{ for an idealized heat engine.\]Test a reversible or analytic reference cycle, a zero-area path with zero net work, and a closure fixture that deliberately fails when one leg is omitted. Check that relabelling the starting leg leaves net totals unchanged. For numerical paths, refine the path subdivisions and report the closure residual and area convergence.
Reservoir temperatures, finite-rate heat exchange, leakage, friction, and phase changes require extra state and transfers. An ideal cycle is a benchmark for assumptions, not an animated promise of a buildable engine.
Prediction: A cycle can produce positive net work only by having net heat input.
Name the data structure that stores process order and the assertion that checks closure.Build cycles from ordered state transitions. Prove closure in every state variable, reconcile per-leg heat and work ledgers, and refine numerical paths before interpreting a pressure-volume loop or efficiency.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Cycles and Engines, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Temperature and the First Law, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Cycles and Engines as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Represent a thermodynamic cycle as ordered state transitions with closure and energy-ledger tests.