🐍 Interactive Jupyter Notebook: lecture_30_entropy_ideal_gas.ipynb
📥 Download Page as .ipynb (Python Notebook) 📑 Download Blank Slides (PDF)

30. Entropy Change of an Ideal Gas and Isentropic Processes

Term: Spring 2026
Instructor: Mukhamad Suhermanto
Primary References:


Learning Objectives:

  1. Derive specific entropy change relations for ideal gases from both fundamental T ds equations (Moran et al. 2014).
  2. Apply the exact variable specific heat method using standard entropy \(s^\circ(T)\), relative pressure \(p_r\), and relative volume \(v_r\) (Wassgren 2025).
  3. Formulate and apply constant specific heat isentropic relations: \(T v^{k-1} = \text{const}\), \(T P^{(1-k)/k} = \text{const}\), and \(P v^k = \text{const}\) (Waitz and Spakovszky 2008).
  4. Compare accuracy between exact variable-heat and constant-heat approximations for compression and expansion (Yan 2022).
  5. Solve isentropic and polytropic ideal-gas processes (Purdue ME 200 Examples SecondLaw_10, 28, 31, 32 (Wassgren 2021)).

30.1 Derivation of Entropy Change for an Ideal Gas

For an ideal gas, the thermal equation of state is \(Pv = RT\), with internal energy and enthalpy depending solely on temperature: \(du = c_v(T)\,dT\) and \(dh = c_p(T)\,dT\) (Moran et al. 2014), (Wassgren 2025).

30.1.1 In Terms of Temperature and Volume (\(T\) and \(v\))

Substituting \(du = c_v(T)\,dT\) and \(P/T = R/v\) into the First \(T\,ds\) relation:

\[ ds = \frac{du}{T} + \frac{P}{T}\,dv = c_v(T)\,\frac{dT}{T} + R\,\frac{dv}{v} \tag{30.1} \]

Integrating from state 1 to state 2:

\[ s_2 - s_1 = \int_{T_1}^{T_2} c_v(T)\,\frac{dT}{T} + R\,\ln\left( \frac{v_2}{v_1} \right) \tag{30.2} \]

30.1.2 In Terms of Temperature and Pressure (\(T\) and \(P\))

Substituting \(dh = c_p(T)\,dT\) and \(v/T = R/P\) into the Second \(T\,ds\) relation:

\[ ds = \frac{dh}{T} - \frac{v}{T}\,dP = c_p(T)\,\frac{dT}{T} - R\,\frac{dP}{P} \tag{30.3} \]

Integrating from state 1 to state 2:

\[ s_2 - s_1 = \int_{T_1}^{T_2} c_p(T)\,\frac{dT}{T} - R\,\ln\left( \frac{P_2}{P_1} \right) \tag{30.4} \]

30.2 Variable Specific Heats: The \(s^\circ(T)\) and Relative Functions

Because specific heats of real gases increase significantly with temperature (due to excitation of rotational and vibrational quantum modes), high-accuracy calculations require integrating \(c_p(T)\) (Waitz and Spakovszky 2008).

30.2.1 The Standard Entropy Function \(s^\circ(T)\)

We define the temperature-dependent reference function \(s^\circ(T)\) (tabulated in Ideal Gas Tables A-22 for air):

\[ s^\circ(T) \equiv \int_0^T \frac{c_p(T')}{T'}\,dT' \tag{30.5} \]

Substituting into Equation (30.4) gives the exact entropy change:

\[ s_2 - s_1 = s^\circ(T_2) - s^\circ(T_1) - R\,\ln\left( \frac{P_2}{P_1} \right) \tag{30.6} \]

30.2.2 Isentropic Processes with Variable Specific Heats (\(s_2 = s_1\))

For an isentropic process (\(\Delta s = 0\)), Equation (30.6) yields:

\[ \ln\left( \frac{P_2}{P_1} \right) = \frac{s^\circ(T_2) - s^\circ(T_1)}{R} \implies \frac{P_2}{P_1} = \frac{\exp[s^\circ(T_2)/R]}{\exp[s^\circ(T_1)/R]} \equiv \frac{p_r(T_2)}{p_r(T_1)} \tag{30.7} \]

where \(p_r(T) \equiv \exp[s^\circ(T)/R]\) is the dimensionless relative pressure (Moran et al. 2014).
Similarly, using the ideal gas law with \(P_2/P_1 = p_r(T_2)/p_r(T_1)\):

\[ \left( \frac{v_2}{v_1} \right)_{s_2=s_1} = \left( \frac{T_2}{T_1} \right) \left( \frac{P_1}{P_2} \right) = \frac{R T_2 / p_r(T_2)}{R T_1 / p_r(T_1)} \equiv \frac{v_r(T_2)}{v_r(T_1)} \tag{30.8} \]

where \(v_r(T)\) is the dimensionless relative volume.

30.3 Constant Specific Heat Model

When temperature variations are moderate, specific heats may be treated as constant (\(c_{p0}, c_{v0}\) evaluated at average temperature) (Wassgren 2025), (Yan 2022):

\[ s_2 - s_1 = c_v\,\ln\left( \frac{T_2}{T_1} \right) + R\,\ln\left( \frac{v_2}{v_1} \right) \tag{30.9} \]

\[ s_2 - s_1 = c_p\,\ln\left( \frac{T_2}{T_1} \right) - R\,\ln\left( \frac{P_2}{P_1} \right) \tag{30.10} \]

30.3.1 Isentropic Relations with Constant Specific Heats

Setting \(s_2 = s_1\) and using \(c_p / R = k / (k - 1)\) and \(c_v / R = 1 / (k - 1)\) where \(k = c_p / c_v\):

\[ \left( \frac{T_2}{T_1} \right)_{s_2=s_1} = \left( \frac{v_1}{v_2} \right)^{k-1} = \left( \frac{P_2}{P_1} \right)^{\frac{k-1}{k}} \tag{30.11} \]

\[ P_1 v_1^k = P_2 v_2^k \implies P v^k = \text{constant} \tag{30.12} \]

Caution: Polytropic vs Isentropic Index

An isentropic process of an ideal gas with constant specific heats has path index \(n = k = c_p/c_v\). For air at room temperature, \(k \approx 1.40\). If a process is irreversible or involves heat transfer, \(P v^n = \text{const}\) with \(n \ne k\).

30.4 Worked Examples (Purdue ME 200)

Example 30.1: Isentropic Compression of Air (SecondLaw_10 & 28)

Air is compressed reversibly and adiabatically in a steady-flow compressor from \(P_1 = 1.0\text{ bar}\), \(T_1 = 300\text{ K}\) to \(P_2 = 5.0\text{ bar}\) (Wassgren 2021). Determine the exit temperature \(T_2\) and compressor work per unit mass \(w_c = h_2 - h_1\) using:

  1. The exact variable specific heat method (Table A-22 \(p_r\) function).
  2. The constant specific heat approximation with \(k = 1.40\) and \(c_p = 1.005\text{ kJ/(kg}\cdot\text{K)}\).

Solution / Analysis

1. Exact Method:

At \(T_1 = 300\text{ K}\): \(h_1 = 300.19\text{ kJ/kg}\), \(p_{r1} = 1.3860\). \(p_{r2} = p_{r1} \times (P_2 / P_1) = 1.3860 \times 5.0 = 6.930\). Interpolating in Table A-22 at \(p_{r2} = 6.930\): \(T_{2s} = 472.1\text{ K}\), \(h_{2s} = 474.7\text{ kJ/kg}\). \(w_c = h_{2s} - h_1 = 474.7 - 300.19 = 174.5\text{ kJ/kg}\).

2. Constant Specific Heat Method:

\(T_{2s} = T_1 (P_2 / P_1)^{(k-1)/k} = 300 \times (5.0)^{0.4/1.4} = 300 \times (5.0)^{0.2857} = 300 \times 1.5838 = 475.1\text{ K}\). \(w_c = c_p (T_{2s} - T_1) = 1.005 \times (475.1 - 300.0) = 176.0\text{ kJ/kg}\). The constant \(k\) approximation overestimates \(T_2\) by only \(3.0\text{ K}\) (\(0.6\%\)) and work by \(1.5\text{ kJ/kg}\) (\(0.8\%\)).

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

# Purdue ME 200 Example SecondLaw_10 / 28: Isentropic air compression
air = idealgas.Properties('Air')

P1 = Quantity(1.0, 'bar')
T1 = Quantity(300.0, 'K')
h1 = air.h(T=T1)
s1 = air.s(p=P1, T=T1)

P2 = Quantity(5.0, 'bar')
T2s = air.T(p=P2, s=s1)
h2s = air.h(T=T2s)

w_exact = (h2s - h1).to('kJ/kg')

# Constant specific heat model (k = 1.40, cp = 1.0045 kJ/kg/K)
k = 1.40
cp_const = Quantity(1.0045, 'kJ/(kg*K)')
T2_approx = T1 * (P2 / P1)**((k - 1) / k)
w_approx = (cp_const * (T2_approx - T1)).to('kJ/kg')

error = float(abs(w_approx - w_exact) / w_exact * 100)

print("--- State 1 (Inlet) ---")
print(f"P1 = {P1.magnitude:.1f} bar, T1 = {T1.magnitude:.1f} K, h1 = {h1.to('kJ/kg').magnitude:.2f} kJ/kg")
print("--- State 2s (Exit, Isentropic) ---")
print(f"Exact Variable cp:  T2s = {T2s.to('K').magnitude:.2f} K, w_s = {w_exact.magnitude:.2f} kJ/kg")
print(f"Constant cp Model:  T2s = {T2_approx.to('K').magnitude:.2f} K, w_s = {w_approx.magnitude:.2f} kJ/kg")
print(f"Discrepancy:        {error:.2f}%")
--- Exact Method (Variable Specific Heats) ---
T1 = 300.00 K, h1 = 300.19 kJ/kg
T2s = 472.05 K, h2s = 474.65 kJ/kg
Work w_c (exact) = 174.46 kJ/kg

--- Constant Specific Heat Approx (k = 1.40) ---
T2s (approx) = 475.15 K
Work w_c (approx) = 176.02 kJ/kg
Relative error in work: 0.90%

30.4.2 Irreversible Expansion and Polytropic Behavior

Example 30.2: Entropy Generation in an Air Expansion (SecondLaw_31 & 32)

Air in a piston-cylinder device expands from \(P_1 = 6.0\text{ bar}\), \(T_1 = 600\text{ K}\) to \(P_2 = 1.5\text{ bar}\). The process is polytropic with \(P v^{1.25} = \text{constant}\) (Wassgren 2021). Assume \(R = 0.287\text{ kJ/(kg}\cdot\text{K)}\) and \(k = 1.40\). Determine the final temperature \(T_2\), the entropy change \(\Delta s = s_2 - s_1\), and explain the heat transfer and entropy behavior.

Solution / Analysis

Polytropic temperature relation: \(T_2 = T_1 (P_2 / P_1)^{(n-1)/n} = 600 \times (1.5 / 6.0)^{(1.25 - 1)/1.25} = 600 \times (0.25)^{0.2} = 600 \times 0.75786 = 454.7\text{ K}\). Entropy change using constant specific heats (\(c_p = k R / (k - 1) = 1.0045\text{ kJ/(kg}\cdot\text{K)}\)): \(\Delta s = c_p \ln(T_2/T_1) - R \ln(P_2/P_1)\) \(\Delta s = 1.0045 \times \ln(454.7 / 600.0) - 0.287 \times \ln(1.5 / 6.0)\) \(\Delta s = 1.0045 \times (-0.2770) - 0.287 \times (-1.3863) = -0.2782 + 0.3979 = +0.1197\text{ kJ/(kg}\cdot\text{K)}\). Because \(n = 1.25 < k = 1.40\), heat was transferred into the gas during expansion, increasing entropy!

import numpy as np
from kilojoule.units import Quantity

# Purdue ME 200 Example SecondLaw_31 / 32: Polytropic expansion of air
P1 = Quantity(6.0, 'bar')
T1 = Quantity(600.0, 'K')
P2 = Quantity(1.5, 'bar')
n = 1.25
k = 1.40
R = Quantity(0.287, 'kJ/(kg*K)')
cp = Quantity(1.0045, 'kJ/(kg*K)')

# Polytropic final temperature
T2 = T1 * (P2 / P1)**((n - 1) / n)

# Entropy change: Delta s = cp*ln(T2/T1) - R*ln(P2/P1)
delta_s = (cp * np.log((T2 / T1).magnitude) - R * np.log((P2 / P1).magnitude)).to('kJ/(kg*K)')

# Polytropic work: w = R*(T2 - T1) / (1 - n)
w_b = (R * (T2 - T1) / (1 - n)).to('kJ/kg')

print(f"Polytropic Exponent n: {n}")
print(f"Initial State: P1 = {P1.magnitude:.1f} bar, T1 = {T1.magnitude:.1f} K")
print(f"Final State:   P2 = {P2.magnitude:.1f} bar, T2 = {T2.magnitude:.2f} K")
print(f"Boundary Work: w_b = {w_b.magnitude:.2f} kJ/kg")
print(f"Entropy Change: Delta s = {delta_s.magnitude:.4f} kJ/(kg*K) (> 0, heat added)")
Inlet: P1 = 6.0 bar, T1 = 600.00 K
Exit:  P2 = 1.5 bar, T2 = 454.71 K
Entropy Change Delta s: 0.1197 kJ/(kg·K)

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 — Constant vs. Variable Specific-Heat Entropy Change for High-Temperature Air

Air (\(R = 0.287\text{ kJ}/(\text{kg}\cdot\text{K})\)) is compressed from \(P_1 = 100\text{ kPa}\), \(T_1 = 300\text{ K}\) to \(P_2 = 650\text{ kPa}\), \(T_2 = 950\text{ K}\). (a) Estimate \(\Delta s\) using constant \(c_p(300\text{ K}) = 1.005\text{ kJ}/(\text{kg}\cdot\text{K})\), (b) repeat using average \(c_{p,\text{avg}}(625\text{ K}) = 1.0570\text{ kJ}/(\text{kg}\cdot\text{K})\), and (c) compare against the exact variable-specific-heat CoolProp result \(\Delta s_{\text{exact}} = 0.6708\text{ kJ}/(\text{kg}\cdot\text{K})\).

🔍 Click to View Complete Step-by-Step Solution
  1. Room-Temperature Constant-\(c_p\) Formula: \[\Delta s_{\text{cold}} = 1.005\ln\left(\frac{950}{300}\right) - 0.287\ln\left(\frac{650}{100}\right) = 0.6212\text{ kJ}/(\text{kg}\cdot\text{K})\]

  2. Midpoint Average-\(c_p\) Formula (\(625\text{ K}\)): \[\Delta s_{\text{avg}} = 1.0570\ln\left(\frac{950}{300}\right) - 0.287\ln\left(\frac{650}{100}\right) = 0.6812\text{ kJ}/(\text{kg}\cdot\text{K})\]

  3. Error Analysis vs. Exact (CoolProp \(\Delta s = 0.6708\text{ kJ}/(\text{kg}\cdot\text{K})\)): Cold-\(c_p\) underpredicts by \(7.39\%\), whereas midpoint \(c_{p,\text{avg}}\) matches within \(1.55\%\)!


Practice Problem 2 — Monatomic vs. Diatomic Isentropic Compression Temperature & Power Comparison

An adiabatic reversible compressor receives either Argon (\(k = 1.667\), \(c_p = 0.520\text{ kJ}/(\text{kg}\cdot\text{K})\)) or Nitrogen (\(k = 1.400\), \(c_p = 1.039\text{ kJ}/(\text{kg}\cdot\text{K})\)) at \(P_1 = 100\text{ kPa}\), \(T_1 = 300\text{ K}\) and compresses each isentropically across a pressure ratio of \(r_p = P_2/P_1 = 8.0\). Compute the exit temperature \(T_2\), volume compression ratio \(v_1/v_2\), and specific compressor work \(w_c\) for both gases.

🔍 Click to View Complete Step-by-Step Solution
  1. Argon (\(k = 1.667\)): \[T_{2,\text{Ar}} = 300(8.0)^{0.667/1.667} = 689.4\text{ K}, \quad \frac{v_1}{v_2} = 8.0^{1/1.667} = 3.48, \quad w_{c,\text{Ar}} = 0.520(689.4 - 300) = 202.6\text{ kJ/kg}\]

  2. Nitrogen (\(k = 1.400\)): \[T_{2,\text{N}_2} = 300(8.0)^{0.4/1.4} = 543.4\text{ K}, \quad \frac{v_1}{v_2} = 8.0^{1/1.4} = 4.42, \quad w_{c,\text{N}_2} = 1.039(543.4 - 300) = 252.9\text{ kJ/kg}\]

  3. Takeaway: Higher \(k\) produces much hotter discharge temperatures (\(689\text{ K}\) vs. \(543\text{ K}\)), even though argon’s heavy molar mass keeps its per-kg work lower!


Practice Problem 3 — Closed-Cylinder Isentropic Compression in a Spark-Ignition Engine Cylinder

Air (\(k = 1.40\), \(R = 0.287\), \(c_v = 0.718\text{ kJ}/(\text{kg}\cdot\text{K})\)) inside an engine cylinder is compressed isentropically from bottom dead center (\(V_1 = 4.50\text{ L}\), \(P_1 = 95\text{ kPa}\), \(T_1 = 310\text{ K}\)) by a compression ratio of \(r = V_1/V_2 = 9.0\). Determine the final pressure \(P_2\), final temperature \(T_2\), air mass \(m\), and boundary work input \(|W_b|\).

🔍 Click to View Complete Step-by-Step Solution
  1. Isentropic Pressure and Temperature Ratios (\(r = 9.0\)): \[P_2 = P_1 r^k = 95(9.0)^{1.40} = 2059.0\text{ kPa}, \qquad T_2 = T_1 r^{k-1} = 310(9.0)^{0.40} = 746.5\text{ K}\]

  2. Air Mass & Boundary Work (\(Q = 0 \implies W_b = -\Delta U\)): \[m = \frac{(95)(0.0045)}{(0.287)(310)} = 0.00480\text{ kg} \; (4.80\text{ g})\] \[W_b = -m c_v (T_2 - T_1) = -(0.00480)(0.718)(746.5 - 310) = -1.506\text{ kJ}\]

  3. Result: \(P_2 = 2059\text{ kPa}\), \(T_2 = 746.5\text{ K}\), \(m = 4.80\text{ g}\), \(|W_b| = 1.506\text{ kJ}\).


Practice Problem 4 — Isentropic vs. Internally Reversible Isothermal Gas Compressor Work

An industrial compressed-air plant raises air (\(R = 0.287\), \(c_p = 1.005\text{ kJ}/(\text{kg}\cdot\text{K})\), \(k = 1.40\)) steadily from \(P_1 = 100\text{ kPa}\), \(T_1 = 300\text{ K}\) to \(P_2 = 600\text{ kPa}\). Compare the reversible specific shaft work \(|w_{\text{rev}}|\) required under: (a) an adiabatic isentropic compression, and (b) an internally reversible isothermal compression at \(300\text{ K}\), reporting the percentage work saved by cooling.

🔍 Click to View Complete Step-by-Step Solution
  1. Adiabatic Isentropic Compressor Work: \(T_{2s} = 300(6.0)^{0.2857} = 500.55\text{ K}\): \[|w_s| = c_p(T_{2s} - T_1) = 1.005(500.55 - 300) = 201.56\text{ kJ/kg}\]

  2. Reversible Isothermal Compressor Work (\(w_{\text{rev}} = -\int v\,dP\) at constant \(T_1\)): \[|w_{\text{isoT}}| = R T_1 \ln\left(\frac{P_2}{P_1}\right) = (0.287)(300)\ln(6.0) = 154.27\text{ kJ/kg}\]

  3. Work Savings: Continuous cooling cuts specific volume throughout compression, saving \(47.29\text{ kJ/kg}\) (\(23.5\%\)) of shaft power! Final Result: \(w_s = 201.56\text{ kJ/kg}\), \(w_{\text{isoT}} = 154.27\text{ kJ/kg}\) (\(23.5\%\) savings).

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.