From first principles
Derive entropy production during heat exchange
Connect two bodies in a thermally isolated enclosure. Assume each body reaches internal equilibrium quickly enough to have a single temperature, and no external work is done. Let \(J>0\) denote energy flowing per time from the hot body at \(T_h\) to the cooler one at \(T_c\). Their internal energies change at equal and opposite rates. Using the equilibrium state relation \(dS_i=dU_i/T_i\) for each body at fixed volume and composition gives
This entropy production is positive while heat goes from hot to cold. To predict a relaxation time requires an empirical heat-flow relationship. If the contact has constant conductance \(G\), so \(J=G(T_h-T_c)\), and the heat capacities \(C_h,C_c\) stay constant, energy balance gives
The temperature difference decays exponentially. The sign of the entropy change follows from thermodynamics, while the measured conductance controls how quickly equilibrium is reached.
Derivation and applications
Connect the recovery of a two-state population to entropy production
A system can return to equilibrium exponentially even when its entropy production has a more complicated time dependence. Consider many independent units with two internal configurations A and B in contact with one heat bath at fixed temperature \(T\). Each changes from A to B with rate \(k_+\) and back with rate \(k_-\), both positive and constant. Write \(p\) for the fraction in B. Conservation of population gives the net forward rate per unit and its stable fixed point,
The solution is
To relate that motion to thermodynamics, suppose the rates obey detailed balance with the bath. For an independently mixed ensemble the excess free energy per unit relative to its equilibrium population is
This expression combines the change in the two-state energy average with the entropy of distributing the units between A and B. Differentiate with respect to \(p\), multiply by \(\dot p\), and use \(p_*/(1-p_*)=k_+/k_-\). Defining forward and reverse event rates \(j_+=k_+(1-p)\) and \(j_-=k_-p\) gives the entropy production per unit,
The inequality follows because the larger positive flux also has the larger logarithm. At equilibrium the two one-way event rates can both be finite even though their difference and total entropy production vanish. Near equilibrium the thermodynamic driving force and net rate are both linear in \(p-p_*\), so their product decays twice as rapidly in its exponential time dependence.
Worked example
Compute the initial dissipation during recovery
Change the inputs and investigate this derivation.
Set \(k_+=3.00\,\mathrm{s^{-1}}\), \(k_-=1.00\,\mathrm{s^{-1}}\) and prepare \(p=0.250\). The forward and reverse rates are \(2.25\) and \(0.250\,\mathrm{s^{-1}}\). Initial entropy production is \(2.00\,k_B\ln9\,\mathrm{s^{-1}}=4.39\,k_B/\mathrm s\) per unit. After \(0.250\,\mathrm s\), one relaxation time, the population has risen to \(0.750-0.500/e=0.566\).
Second application
Infer microscopic rates from a relaxation trace
Change the inputs and investigate this derivation.
A different ensemble reaches equilibrium fraction \(p_*=0.200\). The magnitude of a small population offset halves every \(0.500\,\mathrm s\). The sum of the rates is \(\ln2/0.500=1.386\,\mathrm{s^{-1}}\); hence \(k_+=0.277\,\mathrm{s^{-1}}\) and \(k_-=1.109\,\mathrm{s^{-1}}\). At equilibrium each one-way flux is \(0.222\,\mathrm{s^{-1}}\) per unit. Event counting can test this prediction even when the mean population looks stationary.
Try it · Master entropy
Vary the physical parameters in the derived relation. Use the units and assumptions in the readout to connect the curves to the two worked examples. A parameter study can test the forward prediction; the same relation can then be inverted to infer a parameter from a measurement.
OneSimulation laboratory
Separate the equilibrium temperature from the relaxation time
Start from this chapter. Subtract the two energy balances to get an equation for the temperature difference. Use its exponential decay rate to decide which change of conductance or heat capacity can also change equilibrium.
Compare recorded OneSimulation runs on this page. To test your own inputs, download the notebook and model files and run the model in an activated OneSimulation environment.
The notebook couples two thermal capacities through their temperature inputs. Run its parameter, solve and comparison cells for each setting. The log-slope of \(T_1-T_2\) provides a measured decay rate. Its inverse is the measured relaxation time. Use the capacity-weighted mean at every stored time to estimate \(T_*\), since the two temperatures still differ at the final stored sample. Two-body thermal exchange model.
- Baseline. Start with heat capacities of 500 and 1500 J/K, initial temperatures of 360 and 300 K, and a 2 W/K bridge. Compare the time for the initial temperature difference to fall by a factor \(e\) with 187.5 s. Check entropy by calculating \(C_1\ln(T_1/T_{1,0})+C_2\ln(T_2/T_{2,0})\) across the stored history.
- Improve the bridge. Change
conductancefrom 2 to 4 W/K and rerun. Predict which of the weighted mean and decay rate will double. - Change the hot body. Restore the conductance and set
heat_capacity_1 = 1500.0J/K. Examine how the fitted rate and weighted mean both change. For each run compare the fitted rate with \(1/\tau\) within 0.1%, and check that the weighted mean drifts by less than 0.001 K.
| Thermal contact | Weighted mean (K) | Fitted decay rate (s⁻¹) | Relaxation time (s) |
|---|---|---|---|
| 500 J/K hot block, 2 W/K bridge | 315.00 | 0.005333 | 187.50 |
| 500 J/K hot block, 4 W/K bridge | 315.00 | 0.010667 | 93.75 |
| 1500 J/K hot block, 2 W/K bridge | 330.00 | 0.002667 | 375.00 |

two_mass_thermal_exchange.ipynb in a local OneSimulation environment.
Try it · Two blocks approaching thermal equilibrium
The initial temperatures are the notebook’s 360 K and 300 K, with heat capacities 500 and 1500 J/K and conductance 2 W/K. Double the conductance to halve the relaxation time; restore it and set the first capacity to 1500 J/K to move the equilibrium to 330 K. These curves solve the same constant-property ODE analytically.
Open the corresponding OneSimulation notebook, code and output
Problem sheet 6 · Identify a heat capacity and a bridge conductance
Two bodies with no external heat exchange
Connect two bodies through a weak thermal contact inside a perfectly insulated enclosure. Assume each equilibrates internally much faster than they exchange heat, so each has a single instantaneous temperature \(T_h\) or \(T_c\). Take their heat capacities \(C_h,C_c\) as positive constants over the range, with no work or phase change. Let \(J\) denote heat flowing per second from the initially hot body into the initially cold one. Energy conservation gives
This immediately fixes the conserved weighted mean temperature.
A body's entropy change for this model depends only on its successive internal equilibrium states, so \(dS_i=C_i\,dT_i/T_i\). The bridge can carry irreversible heat while that state relation remains valid inside each nearly uniform body. Adding both entropy rates gives
Positive heat flow down the temperature difference produces positive entropy. Equilibrium sets the thermodynamic force \(1/T_c-1/T_h\) to zero. Thermodynamics constrains the sign of \(J\), yet a constitutive heat-transfer law is still needed to predict how quickly temperatures change.
Identify a rate law experimentally
Suppose \(J=G(T_h-T_c)\) with temperature-independent thermal conductance \(G\). Subtracting the two temperature balances shows that \(\Delta=T_h-T_c\) satisfies
The decaying difference and conserved weighted mean determine both temperature histories. The entropy-production rate becomes \(G\Delta^2/(T_hT_c)\). Near final temperature \(T_f\), the temperature difference decays exponentially while the entropy-production rate decays approximately twice as fast because it depends on the square.
The total entropy increase can also be obtained without integrating this rate. Integrating each state differential from its initial temperature to the common final value gives
This expression is independent of conductance so long as the enclosure is isolated and the final state is the same. Larger conductance produces entropy faster at early times but shortens the duration of the process. Replacing a sliding-contact resistance by a smaller one changes the temperature record even when the equilibrium entropy gain is identical.
Predict a quantity beyond the equilibrium temperature
Take \(C_h=500\) J/K, \(C_c=1500\) J/K, \(T_{h,0}=360\) K, \(T_{c,0}=300\) K and \(G=2.00\) W/K. Conservation gives \(T_f=315\) K. The initial heat current is 120 W, and \(\dot S(0)=120(1/300-1/360)=0.0667\) W/K. The relaxation time is 187.5 s. The net entropy gain is \(500\ln(315/360)+1500\ln(315/300)=6.42\) J/K to two decimal places.
Use the two-body temperature histories to estimate the initial entropy-production rate and sum changes in \(C_i\ln T_i\) over the record. Doubling the conductance should double the initial rate and halve the measured relaxation time. Extending both runs to the same final tolerance should recover the same total entropy gain. A discrepancy that decreases as the sampling interval shrinks points to time resolution in the estimated initial slope.
At a finite recorded time the entropy increase is smaller than its asymptotic endpoint value. Evaluate the state-function expression at the last recorded temperatures before attributing a shortfall to the numerical algorithm. The remaining difference measures entropy still to be produced during subsequent equilibration.
Couple heat transport to electrical current
A thermal bridge can also carry electric charge. In a simple thermoelectric generator a temperature difference produces an electromotive force through the Seebeck effect, while current carries Peltier heat at each end. Take an idealized device with constant effective Seebeck coefficient \(S\), internal resistance \(R\), open-circuit thermal conductance \(K\) and no additional contact losses. Let \(T_h>T_c\) be externally fixed endpoint temperatures and choose positive current \(I\) as useful generator output. Connect a passive load \(R_L\) to the device.
The open-circuit voltage is \(S(T_h-T_c)\). Current through the load is \(I=S\Delta T/(R+R_L)\), giving useful power \(P=I^2R_L=IS\Delta T-I^2R\). For a uniform element with constant properties, half its internal Joule heat flows to each end. The reversible heat carried per unit charge is \(ST\) by the Kelvin relation. Combining these contributions with Fourier conduction gives hot-side input and cold-side output,
Their difference is exactly the electrical output. With the sign conventions fixed, the total reservoir entropy production is \(\dot Q_c/T_c-\dot Q_h/T_h\). The Peltier contributions cancel, leaving a positive term from conduction and another from Joule dissipation. This explicitly separates a reversible cross effect from two irreversible processes in the same device.
Find a matched-load operating point
Use \(T_h=350\) K, \(T_c=300\) K, \(S=200\) μV/K, \(R=0.100\) Ω and \(K=0.00200\) W/K. The open-circuit voltage is \(0.0100\) V. With matched load \(R_L=0.100\) Ω, current is \(0.0500\) A and useful power \(0.250\) mW. Conductive heat leakage alone is \(0.100\) W. At the hot end the Peltier contribution is 3.50 mW and half the internal Joule heating is 0.125 mW. Thus \(\dot Q_h=103.375\) mW and \(\dot Q_c=103.125\) mW. Their measured difference is much smaller than either heat current.
The operating efficiency \(P/\dot Q_h=0.00242\) is far below the reversible limit \(1-300/350=0.143\). Maximizing \(P=(S\Delta T)^2R_L/(R+R_L)^2\) at fixed endpoint temperatures indeed gives \(R_L=R\), but this choice need not maximize efficiency because the heat input also depends on current. With the circuit open the load receives zero power while \(K\Delta T\) still crosses the element and produces entropy. A reliable laboratory test therefore records electrical power and both thermal flows separately instead of interpreting an open-circuit voltage as evidence of appreciable useful energy conversion.
The numerical heat currents allow a direct entropy audit. The reservoirs together gain \(0.103125/300-0.103375/350=4.84\times10^{-5}\) W/K. Most of this is already explained by bare heat conduction, since \(0.100(1/300-1/350)=4.76\times10^{-5}\) W/K. The small remainder is the Joule contribution deposited at the two ends. This calculation uses reservoir rates with signs for heat leaving the hot bath and entering the cold bath. A sign error can suggest negative entropy production when the parameters instead describe an ordinary inefficient generator.
Recording the cold-end heat flow with its sign explicitly marked avoids the common confusion between heat entering the cold reservoir and heat entering the device.
Account for entropy during isolated thermal exchange
Two equal, temperature-independent heat capacities begin at 350 K and 250 K and exchange heat through a constant conductance. Energy fixes their common final temperature at 300 K. The temperature difference decays exponentially and each entropy change is \(C\ln(T/T_i)\).

Try it · Thermal entropy
Change the inputs and compare the recalculated curves with the preceding derivation and baseline figure. The axes give the units; the numerical readout states the model assumptions and any limiting cases. Reset the inputs to return to the reference setting.
Read values from the plot
| Time / temperature-difference decay time | Hot body | Cold body | Isolated pair |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0.8 | −0.081934 | 0.10448 | 0.022547 |
| 1.6 | −0.12106 | 0.14809 | 0.027038 |
| 2.4 | −0.13914 | 0.16709 | 0.027942 |
| 3.2 | −0.14738 | 0.1755 | 0.028125 |
Study the full derivation
Master equations, detailed balance and probability currents · Statistical mechanics from microscopic counting to material response
A two-state detector can switch at random while displaying reproducible occupation fractions and relaxation times. A three-state detector can maintain exactly constant occupancies while carrying a persistent directed current. Derive the probability dynamics, infer transition rates from timed records and decide what a stationary histogram can and cannot reveal about equilibrium.