🐍 Interactive Jupyter Notebook: lecture_05_work_modes.ipynb
πŸ“₯ Download Page as .ipynb (Python Notebook) πŸ“‘ Download Blank Slides (PDF)

5. Expansion/Compression Work and Other Work Modes

Term: Spring 2026
Instructor: Mukhamad Suhermanto
Primary References:


Learning Objectives:

  1. Derive the quasi-equilibrium moving boundary work expression and interpret it as area under a P-V curve.
  2. Calculate boundary work for isochoric, isobaric, isothermal, and polytropic (\(PV^n = \text{const}\)) processes.
  3. Analyze complex boundary work processes involving linear springs and mechanical stops.
  4. Formulate shaft work, electrical work, and spring work expressions in rate and integral forms.

5.1 Moving Boundary Work (\(P\,dV\) Work)

In reciprocating internal combustion engines, compressors, and steam expanders, work is transferred across the boundary by the displacement of a movable piston (Moran et al. 2014), (Wassgren 2025).

Piston-Cylinder Moving Boundary Work Figure 5.1: Mechanical moving boundary expansion work (\(W_b = \int P\,dV\)) inside a piston-cylinder device showing the selected control mass boundary and pressure force action.

5.1.1 Derivation of Boundary Work

Consider a gas enclosed in a piston-cylinder device of cross-sectional area \(A\). The gas exerts a normal force \(F = P A\) on the piston face. If the piston moves through an infinitesimal displacement \(ds\), the differential work done by the gas is:

\[ \delta W_b = F\,ds = (P A)\,ds \tag{5.1} \]

Since the change in volume is \(dV = A\,ds\):

\[ \delta W_b = P\,dV \tag{5.2} \]

For a quasi-equilibrium process from state 1 to state 2, the total boundary work done by the system is:

\[ W_{b,\text{by}} = \int_1^2 P\,dV \tag{5.3} \]

On a \(P\)-\(V\) diagram, \(W_{b,\text{by}}\) represents the area under the process curve:

5.1.2 Common Quasi-Equilibrium Process Paths

  1. Isochoric (Constant Volume) Process (\(V = \text{const}\)):

\[ dV = 0 \implies W_b = \int_1^2 P(0) = 0 \tag{5.4} \]

  1. Isobaric (Constant Pressure) Process (\(P = P_0 = \text{const}\)):

\[ W_b = P_0 \int_{V_1}^{V_2} dV = P_0 (V_2 - V_1) \tag{5.5} \]

  1. Isothermal (Constant Temperature) Ideal Gas (\(T = T_0 = \text{const}\)): From the ideal gas equation \(P = \frac{m R T_0}{V}\):

\[ W_b = \int_{V_1}^{V_2} \frac{m R T_0}{V}\,dV = m R T_0 \ln\left(\frac{V_2}{V_1}\right) = P_1 V_1 \ln\left(\frac{V_2}{V_1}\right) \tag{5.6} \]

5.2 Polytropic Processes (\(P V^n = \text{const}\))

During actual expansion and compression processes of gases, pressure and volume are frequently related by a power-law known as a polytropic process (Moran et al. 2014), (Wassgren 2025):

\[ P V^n = C \implies P = C V^{-n} \tag{5.7} \]

where \(n\) is the polytropic exponent (\(-\infty < n < \infty\)) and \(C = P_1 V_1^n = P_2 V_2^n\).

5.2.1 Boundary Work for a Polytropic Process (\(n \ne 1\))

Integrating Eq. (5.3) for \(n \ne 1\):

\[ W_b = \int_{V_1}^{V_2} C V^{-n}\,dV = C \left[ \frac{V^{1-n}}{1 - n} \right]_{V_1}^{V_2} = \frac{(C V_2^{-n}) V_2 - (C V_1^{-n}) V_1}{1 - n} \tag{5.8} \]

Substituting \(C V_2^{-n} = P_2\) and \(C V_1^{-n} = P_1\):

\[ W_b = \frac{P_2 V_2 - P_1 V_1}{1 - n} \tag{5.9} \]

For an ideal gas where \(P V = m R T\):

\[ W_b = \frac{m R (T_2 - T_1)}{1 - n} \tag{5.10} \]

Key Idea: Limiting Values of the Polytropic Exponent \(n\)

  • \(n = 0\): Constant pressure (\(P = \text{const}\), isobaric)
  • \(n = 1\): Constant temperature for ideal gas (\(P V = \text{const}\), isothermal, \(W_b = P_1 V_1 \ln(V_2/V_1)\))
  • \(n = k = c_p/c_v\): Isentropic process for ideal gas with constant specific heats
  • \(n \to \pm \infty\): Constant volume (\(V = \text{const}\), isochoric)

5.3 Other Non-Boundary Work Modes

Energy transfer by work can take forms other than boundary expansion (Moran et al. 2014), (Wassgren 2025).

5.3.1 Linear Spring Work

For a linear elastic spring obeying Hooke’s Law, \(F = k_s x\), where \(k_s\) is the spring constant and \(x\) is displacement from rest:

\[ W_{\text{spring}} = \int_{x_1}^{x_2} k_s x\,dx = \frac{1}{2} k_s (x_2^2 - x_1^2) \tag{5.11} \]

For a spring-loaded piston, gas pressure balances both atmospheric pressure, piston weight, and the spring force:

\[ P(V) = P_{\text{initial}} + \frac{k_s}{A^2}(V - V_{\text{initial}}) \tag{5.12} \]

The boundary work done by the gas is the trapezoidal area under the linear \(P\)-\(V\) line:

\[ W_b = \left(\frac{P_1 + P_2}{2}\right) (V_2 - V_1) \tag{5.13} \]

5.3.2 Rotating Shaft Work

Power transmission through a rotating shaft (e.g., turbine, pump, automotive driveshaft) involves torque \(\tau\) acting through rotational angle \(d\theta\):

\[ \delta W_{\text{shaft}} = \tau\,d\theta \implies \dot{W}_{\text{shaft}} = \tau \frac{d\theta}{dt} = \tau \omega = 2\pi N \tau \tag{5.14} \]

where \(\omega\) is angular velocity (\(\text{rad/s}\)) and \(N\) is rotational speed in revolutions per second.

5.3.3 Electrical Work

Electrons crossing the system boundary across an electric potential difference \(\mathcal{E}\) carry electrical work:

\[ \dot{W}_e = \mathcal{E} I, \quad W_e = \int_1^2 \mathcal{E} I\,dt \tag{5.15} \]

where \(I\) is electric current in amperes (\(\text{A}\)) and \(\mathcal{E}\) is voltage in volts (\(\text{V}\)).

5.4 Worked Examples and Engineering Analysis

Example 5.1: Polytropic Compression of Air

Air with mass \(m = 0.05\text{ kg}\) is compressed polytropically with \(n = 1.30\) from an initial state of \(P_1 = 100\text{ kPa}\) and \(T_1 = 300\text{ K}\) to a final pressure of \(P_2 = 600\text{ kPa}\). Determine the initial volume \(V_1\), final volume \(V_2\), and the boundary work \(W_b\) done on the air.

Solution / Analysis

  • From ideal gas law, \(v_1 = \frac{R T_1}{P_1} = \frac{(0.2870\text{ kJ/kg}\cdot\text{K})(300\text{ K})}{100\text{ kPa}} = 0.861\text{ m}^3\text{/kg}\).

  • Initial volume: \(V_1 = m v_1 = (0.05\text{ kg})(0.861\text{ m}^3\text{/kg}) = 0.04305\text{ m}^3\).

  • For polytropic relation \(P_1 V_1^n = P_2 V_2^n\): \(V_2 = V_1 \left(\frac{P_1}{P_2}\right)^{1/n} = 0.04305 \left(\frac{100}{600}\right)^{1/1.30} = 0.01085\text{ m}^3\).

  • Boundary work via Eq. (5.9): \(W_b = \frac{P_2 V_2 - P_1 V_1}{1 - n} = \frac{(600\text{ kPa})(0.01085\text{ m}^3) - (100\text{ kPa})(0.04305\text{ m}^3)}{1 - 1.30} = \frac{6.51 - 4.305}{-0.30} = -7.35\text{ kJ}\).

  • The negative sign signifies that \(7.35\text{ kJ}\) of boundary work is performed on the air by the piston.

import kilojoule.idealgas as idealgas
from kilojoule.units import Quantity

# Example 5.1: Polytropic compression of air
air = idealgas.Properties('Air')
P1 = Quantity(100.0, 'kPa')
T1 = Quantity(300.0, 'K')
P2 = Quantity(600.0, 'kPa')
n = 1.30
m = Quantity(0.05, 'kg')

# Calculate initial and final volumes
v1 = air.v(p=P1, T=T1)
V1 = (m * v1).to('m^3')
V2 = (V1 * (P1 / P2)**(1.0 / n)).to('m^3')

# Calculate polytropic boundary work
W_b = ((P2 * V2 - P1 * V1) / (1.0 - n)).to('kJ')

print(f"Initial State: P1 = {P1:~.1f}, T1 = {T1:~.1f}")
print(f"Initial Volume V1: {V1:~.5f}")
print(f"Final Pressure P2: {P2:~.1f}")
print(f"Final Volume V2:   {V2:~.5f}")
print(f"Polytropic Boundary Work W_b: {W_b:~.2f}")
Initial State: P1 = 100.0 kPa, T1 = 300.0 K
Initial Volume V1: 0.04306 m ** 3
Final Pressure P2: 600.0 kPa
Final Volume V2:   0.01085 m ** 3
Polytropic Boundary Work W_b: -7.35 kJ
from kilojoule.templates.default import *
import kilojoule.idealgas as idealgas
import numpy as np

# Shaft power transmission analysis
torque = Quantity(180.0, 'N*m')
rpm = 1800.0  # rev/min
omega = Quantity(2.0 * np.pi * rpm / 60.0, 'rad/s')

# Shaft power calculation
W_dot_shaft = (torque * omega).to('kW')
W_dot_hp = W_dot_shaft.to('hp')

# Electrical work equivalent over 30 minutes
dt = Quantity(30.0, 'minute')
W_electric = (W_dot_shaft * dt).to('MJ')
W_kWh = W_electric.to('kW*hour')

print(f"Shaft Torque:     {torque.magnitude:.1f} N*m")
print(f"Rotational Speed: {rpm:.0f} RPM")
print(f"Shaft Power:      {W_dot_shaft.magnitude:.2f} kW ({W_dot_hp.magnitude:.2f} hp)")
print(f"Total Work in 30 min: {W_electric.magnitude:.2f} MJ = {W_kWh.magnitude:.2f} kWh")

# Visualize P-v work paths with kilojoule
air = idealgas.Properties('Air', unit_system='kSI_K')
pv = air.pv_diagram()
p[101] = Quantity(100, 'kPa')
T[101] = Quantity(300, 'K')
v[101] = air.v(p[101], T[101])
states.fix(101, air)

# Isobaric to 2x volume
p[102] = p[101]
v[102] = 2.0 * v[101]
states.fix(102, air)

# Isothermal compression to half volume
T[103] = T[101]
v[103] = 0.5 * v[101]
states.fix(103, air)

# Polytropic n=1.3 compression
v[104] = 0.5 * v[101]
p[104] = p[101] * (v[101]/v[104])**1.3
states.fix(104, air)

pv.plot_state(states[101], label='1')
pv.plot_state(states[102], label='2 (Isobaric)')
pv.plot_state(states[103], label='3 (Isothermal)')
pv.plot_state(states[104], label='4 (Polytropic)')
pv.plot_process(states[101], states[102], path='isobaric', label='P=const')
pv.plot_process(states[101], states[103], path='isothermal', label='T=const')
pv.plot_process(states[101], states[104], path='straight', label='Pv^1.3=C', linestyle='--')
Shaft Torque:     180.0 N * m
Rotational Speed: 1800 RPM
Shaft Power:      33.93 kW (45.50 hp)
Total Work in 30 min: 61.07 MJ = 16.96 kW * h
P-v Diagram of Thermodynamic Work Modes (Isobaric, Isothermal, Polytropic)

Engineering Practice Problems (Self-Study Exercises)

Try each problem on paper first using the principles from this chapter, then expand the step-by-step solution to check your derivation.

Practice Problem 1 β€” Polytropic Compression Work of Argon in a Cooled Cylinder

Argon initially occupies \(V_1 = 0.36\text{ m}^3\) at \(P_1 = 110\text{ kPa}\) inside a water-jacketed piston-cylinder assembly. The gas is compressed slowly following a polytropic path \(P V^{1.28} = \text{const}\) until the pressure reaches \(P_2 = 550\text{ kPa}\). Calculate the final volume \(V_2\) in \(\text{m}^3\) and the moving boundary work \(W_b\) in \(\text{kJ}\), clearly stating whether work is done by or on the gas.

πŸ” Click to View Complete Step-by-Step Solution
  1. Find Final Volume from \(P_1 V_1^n = P_2 V_2^n\): \[V_2 = V_1 \left(\frac{P_1}{P_2}\right)^{1/n} = 0.36\left(\frac{110}{550}\right)^{1/1.28} = 0.10238\text{ m}^3\]

  2. Evaluate Polytropic Boundary Work (\(n \neq 1\)): \[W_b = \int_1^2 P\,dV = \frac{P_2 V_2 - P_1 V_1}{1 - n}\]

  3. Substitute Numerical Values: \[W_b = \frac{(550)(0.10238) - (110)(0.36)}{1 - 1.28} = \frac{56.31 - 39.60}{-0.28} = -59.68\text{ kJ}\] Final Result: \(V_2 = 0.1024\text{ m}^3\), \(W_b = -59.68\text{ kJ}\) (negative sign confirms \(59.68\text{ kJ}\) of work done ON the argon).


Practice Problem 2 β€” Isothermal Expansion of Compressed Nitrogen at Constant \(PV\)

Nitrogen inside a temperature-controlled bath expands quasi-equilibrantly and isothermally (\(PV = \text{const}\)) from \(P_1 = 680\text{ kPa}\) and \(V_1 = 0.045\text{ m}^3\) to a final volume \(V_2 = 0.180\text{ m}^3\). Determine the final pressure \(P_2\) in \(\text{kPa}\) and the total boundary work \(W_b\) performed by the nitrogen in \(\text{kJ}\).

πŸ” Click to View Complete Step-by-Step Solution
  1. Isothermal Final Pressure: Since \(P_1 V_1 = P_2 V_2\): \[P_2 = P_1 \frac{V_1}{V_2} = 680\left(\frac{0.045}{0.180}\right) = 170.0\text{ kPa}\]

  2. Integrate \(P = (P_1 V_1)/V\) (\(n = 1\) Polytropic Limit): \[W_b = \int_1^2 \frac{P_1 V_1}{V}\,dV = P_1 V_1 \ln\left(\frac{V_2}{V_1}\right) = (680)(0.045)\ln\left(\frac{0.180}{0.045}\right) = 42.42\text{ kJ}\]

  3. Sign Check: Because the gas expands (\(V_2 > V_1\)), \(W_b = +42.42\text{ kJ}\) of work is delivered by the nitrogen, and \(P_2 = 170.0\text{ kPa}\).


Practice Problem 3 β€” Piecewise Linear-Spring Piston-Cylinder with Mechanical Stops

A gas occupies \(V_1 = 0.08\text{ m}^3\) at \(P_1 = 200\text{ kPa}\) beneath a piston of area \(A = 0.20\text{ m}^2\). At state 1, the piston touches an uncompressed linear spring (\(k_s = 80\text{ kN/m}\)). Heat is slowly added until the gas pressure reaches \(P_2 = 650\text{ kPa}\); however, rigid mechanical stops prevent the piston from moving beyond a maximum cylinder volume of \(V_{\text{stop}} = 0.20\text{ m}^3\). Determine: (a) the pressure \(P_{\text{stop}}\) when the piston first contacts the stops, (b) whether the piston hits the stops during the heating process, and (c) the total boundary work \(W_b\) performed by the gas in \(\text{kJ}\).

πŸ” Click to View Complete Step-by-Step Solution
  1. Check Pressure at the Mechanical Stops: The displacement required to reach \(V_{\text{stop}} = 0.20\text{ m}^3\) is: \[\Delta x_{\text{stop}} = \frac{V_{\text{stop}} - V_1}{A} = \frac{0.20 - 0.08}{0.20} = 0.60\text{ m}\] Because the spring force adds \(k_s \Delta x / A\) to the equilibrium gas pressure: \[P_{\text{stop}} = P_1 + \frac{k_s \Delta x_{\text{stop}}}{A} = 200 + \frac{(80\text{ kN/m})(0.60\text{ m})}{0.20\text{ m}^2} = 440.0\text{ kPa}\]

  2. Identify Path Regime: Since the target pressure \(P_2 = 650\text{ kPa} > P_{\text{stop}} = 440\text{ kPa}\), the piston does contact the stops at \((V_{\text{stop}}, P_{\text{stop}})\) and then undergoes a constant-volume (isochoric) pressurization from \(440\text{ kPa}\) to \(650\text{ kPa}\).

  3. Total Boundary Work: Work is the trapezoidal area from \(V_1\) to \(V_{\text{stop}}\) plus zero work on the constant-volume segment: \[W_b = \frac{P_1 + P_{\text{stop}}}{2}(V_{\text{stop}} - V_1) + 0 = \frac{200 + 440}{2}(0.20 - 0.08) = 38.4\text{ kJ}\] Final Result: \(P_{\text{stop}} = 440.0\text{ kPa}\) (reaches stops), \(W_b = 38.4\text{ kJ}\).


Practice Problem 4 β€” Superposition of Shaft, Electrical, and Elastic Work Modes on a Closed Vessel

A rigid laboratory autoclave undergoes a \(5.0\text{-min}\) process involving three simultaneous non-boundary work interactions: (1) a stirring paddle wheel driven at \(180\text{ rpm}\) with constant shaft torque \(\tau = 4.5\text{ N}\cdot\text{m}\), (2) an internal resistance coil drawing \(3.5\text{ A}\) at \(24\text{ V}\), and (3) an external actuator stretching an internal titanium calibration wire quasi-statically by \(\Delta L = 0.15\text{ m}\) as tensile tension rises linearly from \(F_1 = 40\text{ N}\) to \(F_2 = 140\text{ N}\). Using the standard thermodynamic sign convention (\(W > 0\) by system, \(W < 0\) on system), compute each work mode and the net work \(W_{\text{net}}\) in \(\text{kJ}\).

πŸ” Click to View Complete Step-by-Step Solution
  1. Paddle-Wheel Shaft Work (Into System \(\implies\) Negative): Over \(\Delta t = 300\text{ s}\) with \(\dot{n} = 180/60 = 3.0\text{ rev/s}\): \[W_{\text{shaft}} = -2\pi \dot{n} \tau \Delta t = -\frac{2\pi (3.0)(4.5)(300)}{1000} = -25.447\text{ kJ}\]

  2. Electrical and Elastic Stretching Work (Both Into System \(\implies\) Negative): \[W_{\text{elec}} = -V I \Delta t = -\frac{(24)(3.5)(300)}{1000} = -25.20\text{ kJ}\] \[W_{\text{wire}} = -\int F\,dx = -\frac{40 + 140}{2}(0.15)/1000 = -0.0135\text{ kJ}\]

  3. Sum Net Work on the Vessel: \[W_{\text{net}} = W_{\text{shaft}} + W_{\text{elec}} + W_{\text{wire}} = -25.447 + (-25.20) + (-0.0135) = -50.66\text{ kJ}\] Final Result: \(W_{\text{net}} = -50.66\text{ kJ}\) (\(50.66\text{ kJ}\) done ON the autoclave).

Summary & Key Takeaways


References, Suggested Reading & Video Lectures

Moran, Michael J., Howard N. Shapiro, Daisie D. Boettner, and Margaret B. Bailey. 2014. Fundamentals of Engineering Thermodynamics. 8th ed. Hoboken, NJ: John Wiley & Sons.
Waitz, Ian A., and Zoltan S. Spakovszky. 2008. 16.unified: Thermodynamics and Propulsion. Cambridge, MA: MIT OpenCourseWare, Massachusetts Institute of Technology.
Wassgren, Carl. 2021. Thermodynamics I (ME 200) Video Lecture Series. School of Mechanical Engineering, Purdue University. https://www.youtube.com/@cw2306/playlists.
β€”β€”β€”. 2025. Notes on Thermodynamics, Fluid Mechanics, and Gas Dynamics. West Lafayette, IN: School of Mechanical Engineering, Purdue University. https://engineering.purdue.edu/~wassgren/notes/NotesOnThermodynamicsFluidMechanicsAndGasDynamics_Wassgren.pdf.
Yan, Claire Yu. 2022. Introduction to Engineering Thermodynamics. BCcampus Open Education. https://open.umn.edu/opentextbooks/textbooks/introduction-to-engineering-thermodynamics.