  The celebrated van der Waals model describes simple fluids in the
thermodynamic limit and predicts the existence of a critical point associated
to the gas-liquid phase transition. However the behaviour of critical isotherms
according to the equation of state, where a gas-liquid phase transition occurs,
significantly departs from experimental observations. The correct critical
isotherms are heuristically re-established via the Maxwell equal areas rule. A
long standing open problem in mean field theory is concerned with the analytic
description of van der Waals isotherms for a finite size system that is
consistent, in the thermodynamic limit, with the Maxwell prescription. Inspired
by the theory of nonlinear conservation laws, we propose a novel mean field
approach, based on statistical mechanics, that allows to calculate the van der
Waals partition function for a system of large but finite number of particles
$N$. Our partition function naturally extends to the whole space of
thermodynamic variables, reproduces, in the thermodynamic limit $N\to \infty$,
the classical results outside the critical region and automatically encodes
Maxwell's prescription. We show that isothermal curves evolve in the space of
thermodynamic variables like nonlinear breaking waves and the criticality is
explained as the mechanism of formation of a classical hydrodynamic shock.
