In classical mechanics, the field of
*kinematics*
*describes* moving objects using quantities such as length $s$, time $t$, velocity $v=\frac{{\rm d}s}{{\rm d}t}$
and acceleration $a=\frac{{\rm d}^2s}{{\rm d}t^2}$.
*Dynamics*
is the part of classical mechanics which *explains* the causes of the motion of objects.
It is here that mass $m$, momentum $p=mv$, force $F=ma$ and energy $E=Fs$ are introduced.
*Thermodynamics*
takes this one step further by introducing
*temperature*
as an additional quantity,
*heat*
as an energy relating to temperature changes, and
*entropy*
as a quality assigned to energy.

Within thermodynamics, we can distinguish
*classical thermodynamics*,
which describes the behaviour of macroscopic objects and phenomena, from
*statistical mechanics*,
which deals with microscopic interpretations of such macroscopic properties using statistical methods and models.

The term
*thermal physics*
is synonymous with thermodynamics in this wider sense, but emphasises the
physical aspects of this interdisciplinary field. Thermodynamics is equally central to adjacent disciplines
such as chemistry, mechanical engineering, and information theory.
*Engineering thermodynamics*
is at the root of the discipline, which was first established as a theoretical foundation to understand the operation
and efficiency of heat engines.
*Chemical thermodynamics*
uses concepts such as equilibrium to predict
how chemical reactions unfold. In recent decades, concepts from statistical thermodynamics, particularly entropy,
have been applied to
*information theory*
leading to applications such as cryptography.

The
*kinetic theory of gases*
is at the crossover of the classical and statistical branches
of thermodynamics. It considers the thermal movements of gas molecules to derive the pressure the
gas exerts on the walls of a vessel. The higher the temperature of the gas, the higher the mobility
of the gas molecules and thus the higher the force each molecule hitting a wall transfers to the
wall. Since the thermal motion is randomly orientated, the forces from the particles cancel each
other out and simply add up to a uniform pressure (force per surface area) on the walls surrounding
the gas.

If the walls are static, the volume must remain constant and pressure builds up inside the vessel - a
*pressure cooker*
or boiler. If the walls are flexible, they can expand until the forces acting from the inside and
outside are balanced, *i.e.* the pressure remains constant but the volume expands - a
*hot-air balloon*.

Thermodynamics divides the world into the
*system*
under study and its
*surroundings*.
Both are separated from one another by
*walls*.
These terms are used conceptually and are not limited to any particular
material or process; a "wall" can be as insubstantial as a foam bubble. Walls may or may not be permeable
to transfers of various forms of energy and matter. Systems can be nested, *e.g.*
we might consider the boiler inside a power station as a system and be concerned with the temperature and
pressure inside it and the energy flows into and out of it, or we could treat the whole power station as a
system and consider its relationship with its surroundings including the power grid and the atmosphere.
It is therefore important to be clear about what the system is that is being investigated.

A
*state*
in thermodynamics is a complete description of a system in terms of physical quantities.
The physical quantities are known as
*state variables*.
State variables are either
*intensive*
(uniform throughout the system, *e.g.* pressure or temperature) or
*extensive*
(adding up throughout the system, *e.g.* mass, volume, number of atoms, internal energy, entropy).
**State variables do not change without external interaction**
with the system. Atoms in a gas move about, but the number of gas atoms inside a container doesn't
change unless we interact with the system to let some atoms out.

**State variables depend on each other.**
If you heat a pressure cooker, the pressure will increase along
with the temperature. If you heat a balloon, the volume increases with temperature. Anything done to
a system that changes its state is known in thermodynamics as a
*process*.

Thermodynamics often uses an engine cylinder containing a gas as a working medium as a metaphor for any
interacting system. This is largely for historical reasons, but also because it is a simple model system
where state variables and energy flows are relatively easy to determine. Consider a cylinder with a piston
and a safety valve which will open if the pressure in the cylinder exceeds a certain level. If the piston
is pushed into the cylinder, the gas will contract (*i.e.* its volume decreases), but if we don't
overdo it, the valve will remain closed. One state variable (volume) responds to a change in another
(pressure); other state variables (amount of atoms, temperature) are unaffected. Suppose we put a burner
under the cylinder next. Now the temperature increases. If we don't let the piston go, the pressure
increases further until the safety valve opens. Now gas is released until the pressure comes down to
safe levels. Again, one state variable (amount of atoms) responds to a change in another (temperature)
while others (pressure, volume) are unaffected. One could argue that the volume changes because the gas
spills over into the space outside, but we've defined the cylinder as our system, so the atoms have
escaped into the surroundings in this process.

Sometimes, the term
*state function*
is used to stress the fact that a state variable depends on
other state variables. The dependency works boths ways, though, so it's a matter of taste which state
variable is treated as the (dependent) state function and which ones are treated as (independent) state
variables. For example, in step 1 of the experiment, we could say that the volume is a state function
of pressure, amount and temperature: $V(p,n,T)$.

Instead of applying pressure first and heating later (path A), we could have gone the other way to reach the same end result. Alternatively (path B), by heating the original cylinder (initial state), the gas will expand, pushing the piston out. By acting against that expansion and pushing the piston in, we end up with the same final state with gas being ejected from the safety valve.

The order of changes of state variables doesn't change the end result, in other words
**processes (state changes) are path independent**.
Mathematically speaking, we can say that if a state variable $x$ depends on two other
state variables $y$ and $z$, then the mixed second derivative is commutative:
$$\frac{\partial^2x}{\partial y\partial z}=\frac{\partial^2x}{\partial z\partial y}\qquad.$$
This is known as
Schwarz's theorem
in maths and applies to all functions of several variables whose mixed second derivatives are continuous.

When a state variable is being changed in practice, it doesn't immediately change uniformly throughout
the system. For example, the water in a pot on a stove will at first be hotter at the bottom, near the
heat source. The system isn't in a defined state because the intensive state variables aren't uniform
throughout the system. It takes a while for the system to reach
*equilibrium*.

**In thermodynamic equilibrium, all state variables are constant over time and uniform throughout the system.**

The process of reaching equilibrium after an external interaction with the system is called
*equilibration*
or
*relaxation*.
It usually follows an exponential time dependence of the type
$$x=x_0\exp{\left(-\frac{t}{\tau}\right)}$$
where $x$ is a state variable, $x_0$ its initial value, $t$ is elapsing time and $\tau$ is the
*relaxation time*,
a time constant describing how fast the system relaxes back to equilibrium.
Of course, the exponential function is asymptotic, so equilibrium is approached but never really reached.

As we have seen, the state variables depend on each other. What exactly this dependence is
depends on the medium. We need a model for the medium that allows us to describe mathematically
how the different state variables are linked. This is known as an
*equation of state*.

Just as classical thermodynamics models the world in terms of piston cylinders, it uses a simple
model for the medium, the
*ideal gas*.
Of course, as with any model, reality will deviate
from it sooner or later, and a number of refinements have been proposed to deal with deviations
from the simple assumptions the model is based on. The ideal gas is a gas without interactions
between the individual gas atoms, and temperature and pressure are proportional to each other
with a uniform constant of proportionality. This produces the
*ideal gas law*:
$$pV=nRT$$
where $R$ is the
*gas constant*,
$R=N_Ak_B$, the product of Avogadro's and Boltzmann's constants. Its value is 8.314 J/(K mol).

Now that the basic terms are defined, we can consider thermodynamic equilibrium further and develop the laws of thermodynamics.