  The aim of this paper is to use large deviation theory in order to compute
the entropy of macrostates for the microcanonical measure of the shallow water
system. The main prediction of this full statistical mechanics computation is
the energy partition between a large scale vortical flow and small scale
fluctuations related to inertia-gravity waves. We introduce for that purpose a
discretized model of the continuous shallow water system, and compute the
corresponding statistical equilibria. We argue that microcanonical equilibrium
states of the discretized model in the continuous limit are equilibrium states
of the actual shallow water system. We show that the presence of small scale
fluctuations selects a subclass of equilibria among the states that were
previously computed by phenomenological approaches that were neglecting such
fluctuations. In the limit of weak height fluctuations, the equilibrium state
can be interpreted as two subsystems in thermal contact: one subsystem
corresponds to the large scale vortical flow, the other subsystem corresponds
to small scale height and velocity fluctuations. It is shown that either a
non-zero circulation or rotation and bottom topography are required to sustain
a non-zero large scale flow at equilibrium. Explicit computation of the
equilibria and their energy partition is presented in the quasi-geostrophic
limit for the energy-enstrophy ensemble. The possible role of small scale
dissipation and shocks is discussed. A geophysical application to the Zapiola
anticyclone is presented.
