Introduction to Thermodynamics | Thermodynamics with Python | Skill-Lync Resources

50% OFF - Ends Soon!

Lesson 1 of 13 20 min

Introduction to Thermodynamics

Every power plant that lights your city, every engine that moves your car, and every refrigerator that keeps your food fresh runs on the same set of fundamental rules: the laws of thermodynamics. It is the science of energy — how it is stored, how it moves, and how it transforms from one form to another.

In this course, you'll learn the core ideas of thermodynamics while building Python tools that compute real fluid properties and solve engineering energy balances.

What is Thermodynamics?

Thermodynamics studies energy and its transformations, especially the conversion between heat and work. Wherever energy is converted, thermodynamics tells us:

Sponsored

70% of India's auto industry trusts Skill-Lync

For training their engineers in CAD, CAE & simulation

Learn More
  • How much work can we extract? (efficiency limits)
  • In which direction does a process go? (the second law)
  • What state is the substance in? (properties and tables)

Where It Matters

ApplicationWhat thermodynamics decides
Steam & gas power plantsCycle efficiency, turbine work output
IC engines & jet enginesCompression ratio, combustion energy
Refrigeration & air-conditioningCoefficient of performance, refrigerant choice
Compressors & pumpsWork input, exit temperature
Heat exchangers & boilersHeat transfer rates, phase change

System, Surroundings, and Boundary

To analyze anything in thermodynamics, we first draw a line around what we care about.

  • System: the quantity of matter or region in space chosen for study.
  • Surroundings: everything outside the system.
  • Boundary: the real or imaginary surface separating the two. It can be fixed or moving.

Types of Systems

System typeMass crosses boundary?Energy crosses boundary?Example
Closed (control mass)NoYesGas in a sealed piston-cylinder
Open (control volume)YesYesTurbine, nozzle, pump
IsolatedNoNoInsulated, rigid, sealed tank

A closed system has fixed mass but its volume can change (the piston moves). An open system, or control volume, lets fluid flow through it — this is how we analyze turbines and nozzles in Lesson 4.

Properties of a System

A property is any measurable characteristic of a system, such as pressure $p$, temperature $T$, volume $V$, or internal energy $U$. Properties split into two kinds:

Sponsored

Get an IIT Jammu PG certification

Recognized by Mahindra, Bosch, TATA ELXSI & 500+ companies

See Program Details
  • Extensive properties depend on the amount of matter: volume $V$, mass $m$, total internal energy $U$.
  • Intensive properties do not: temperature $T$, pressure $p$, density $\rho$.

Dividing an extensive property by mass gives a specific (intensive) property:

$$v = \frac{V}{m}, \qquad u = \frac{U}{m}$$

where $v$ is specific volume (m³/kg) and $u$ is specific internal energy (J/kg).

Sponsored

Harshal got placed at Fiat Chrysler as Design Engineer

Watch his video testimonial on how the program helped him

See His Journey
🎯 3,000+ Engineers Placed
Sponsored
Harshal Sukenkar

Harshal

Fiat Chrysler

Abhishek

Abhishek

TATA ELXSI

Srinithin

Srinithin

Xitadel

Ranjith

Ranjith

Core Automotive

Gaurav Jadhav

Gaurav

Automotive Company

Bino K Biju

Bino

Design Firm

Aseem Shrivastava

Aseem

EV Company

Puneet

Puneet

Automotive Company

Vishal Kumar

Vishal

EV Startup

State and Equilibrium

The state of a system is its complete set of properties at a given instant. A system is in thermodynamic equilibrium when no property changes with time and there are no unbalanced potentials (thermal, mechanical, chemical).

The state postulate says: the state of a simple compressible system is fully fixed by two independent intensive properties. This is why CoolProp can return every property of water once you give it any two, such as pressure and temperature.

Processes and Cycles

A process is a change of state. Common idealized processes hold one property constant:

ProcessProperty held constant
IsobaricPressure $p$
IsothermalTemperature $T$
Isochoric (isometric)Volume $V$
AdiabaticNo heat transfer, $Q = 0$

A quasi-static (quasi-equilibrium) process happens slowly enough that the system stays infinitesimally close to equilibrium throughout — this is the idealization we use to draw smooth process paths on diagrams.

A cycle is a sequence of processes that returns the system to its initial state. Power plants and engines operate in cycles.

The Zeroth Law and Temperature

The zeroth law of thermodynamics states:

If two bodies are each in thermal equilibrium with a third body, they are in thermal equilibrium with each other.

This is what makes temperature a meaningful, measurable property — it is the basis of every thermometer. Temperature is the intensive property that determines the direction of heat flow: heat always flows from high $T$ to low $T$.

Units, Pressure, and Temperature

We use SI units throughout.

QuantitySI unitSymbol
Masskilogramkg
TemperaturekelvinK
PressurepascalPa = N/m²
EnergyjouleJ
PowerwattW = J/s

Temperature conversions:

$$T[\text{K}] = T[^\circ\text{C}] + 273.15$$

Pressure is force per unit area. Absolute and gauge pressure are related by:

$$p_\text{abs} = p_\text{gauge} + p_\text{atm}, \qquad p_\text{atm} = 101325\ \text{Pa}$$

Always use absolute temperature and pressure in thermodynamic equations.

Setting Up Python

We'll use three libraries. NumPy and Matplotlib are standard; CoolProp is a free, accurate fluid-property database that replaces flipping through steam tables.

pip install numpy matplotlib CoolProp
# Core scientific computing
import numpy as np
import matplotlib.pyplot as plt

# CoolProp: thermophysical properties of fluids
# pip install CoolProp
from CoolProp.CoolProp import PropsSI

Your First Property Lookup

PropsSI returns a property in SI units given a fluid and two state inputs. The signature is PropsSI(output, name1, value1, name2, value2, fluid).
from CoolProp.CoolProp import PropsSI

# State: saturated steam (water) at 100 C, atmospheric pressure
T = 373.15        # K  (100 C)
P = 101325        # Pa (1 atm)

# Density of saturated liquid water at 100 C (Q=0 means saturated liquid)
rho_liq = PropsSI('D', 'T', T, 'Q', 0, 'Water')
# Density of saturated vapour (steam) at 100 C (Q=1 means saturated vapour)
rho_vap = PropsSI('D', 'T', T, 'Q', 1, 'Water')

# Latent heat of vaporization = h_vapour - h_liquid
h_liq = PropsSI('H', 'T', T, 'Q', 0, 'Water')
h_vap = PropsSI('H', 'T', T, 'Q', 1, 'Water')
h_fg = h_vap - h_liq

print(f"Liquid water density at 100 C: {rho_liq:.2f} kg/m^3")
print(f"Steam density at 100 C:        {rho_vap:.3f} kg/m^3")
print(f"Latent heat of vaporization:   {h_fg/1e3:.1f} kJ/kg")
Output:
Liquid water density at 100 C: 958.35 kg/m^3
Steam density at 100 C:        0.598 kg/m^3
Latent heat of vaporization:   2256.5 kJ/kg

The steam is over 1600 times less dense than liquid water — this huge volume change is exactly what drives a steam turbine.

An Ideal-Gas Pressure Calculation

For low-density gases, the ideal gas law is an excellent approximation:

$$pV = mRT \qquad\text{or}\qquad pv = RT$$

where $R$ is the specific gas constant ($R = R_u / M$, with universal $R_u = 8.314\ \text{J/(mol·K)}$ and molar mass $M$).

import numpy as np

# Air in a 0.5 m^3 rigid tank, 2 kg, at 300 K -- find pressure
R_universal = 8.314        # J/(mol K)
M_air = 0.028964           # kg/mol  (molar mass of air)
R_air = R_universal / M_air  # specific gas constant J/(kg K)

m = 2.0      # kg
V = 0.5      # m^3
T = 300.0    # K

P = m * R_air * T / V        # ideal gas law: P = mRT/V
print(f"Specific gas constant of air: {R_air:.1f} J/(kg K)")
print(f"Pressure in tank: {P/1e3:.2f} kPa  ({P/1e5:.3f} bar)")
Output:
Specific gas constant of air: 287.0 J/(kg K)
Pressure in tank: 344.42 kPa  (3.444 bar)

Course Roadmap

Here's what you'll learn in this course:

LessonTopicKey Python Skills
1Introduction to ThermodynamicsCoolProp setup, ideal gas law
2Properties & State of a SubstanceSaturation dome plots, quality, van der Waals
3First Law & EnergyBoundary work integrals, energy-balance solver
4Control Volume AnalysisSFEE solver, turbine & nozzle analysis

Common Pitfalls

  • Using Celsius in equations: thermodynamic relations need absolute temperature (kelvin). Always convert.
  • Mixing gauge and absolute pressure: equations like $pv = RT$ require absolute pressure.
  • Forgetting CoolProp uses SI: PropsSI takes pascals, kelvin, and J/kg — not kPa, °C, or kJ/kg.
  • Confusing intensive and extensive properties: you can't fix a state with two extensive properties; you need two independent intensive ones.

Key Takeaways

  • Thermodynamics is the science of energy and its transformation between heat and work.
  • Define a system, its boundary, and surroundings before any analysis — closed, open, or isolated.
  • Properties are intensive or extensive; the state postulate fixes a state with two independent intensive properties.
  • The zeroth law makes temperature measurable; always use absolute units in equations.
  • CoolProp + NumPy + Matplotlib is a powerful, accurate thermodynamics toolkit.

In the next lesson, we'll explore how a pure substance changes phase and how to pin down its state.

3,000+ Engineers Placed in Top Companies
Career Growth

3,000+ Engineers Placed in Top Companies

Join the ranks of successful engineers at Bosch, Tata, L&T, and 500+ hiring partners.