Traditional derivations of available potential energy, in a variety of
contexts, involve combining some form of mass conservation together w
ith energy conservation. This raises the questions of why such constru
ctions are required in the first place, and whether there is some gene
ral method of deriving the available potential energy for an arbitrary
fluid system. By appealing to the underlying Hamiltonian structure of
geophysical fluid dynamics, it becomes clear why energy conservation
is not enough, and why other conservation laws such as mass conservati
on need to be incorporated in order to construct an invariant, known a
s the pseudoenergy, that is a positive-definite functional of disturba
nce quantities. The available potential energy is just the non-kinetic
part of the pseudoenergy, the construction of which follows a well de
fined algorithm. Two notable features of the available potential energ
y defined thereby are first, that it is a locally defined quantity, an
d second, that it is inherently definable at finite amplitude (though
one may of course always take the small-amplitude limit if this is app
ropriate). The general theory is made concrete by systematic derivatio
ns of available potential energy in a number of different contexts. Al
l the well known expressions are recovered, and some new expressions a
re obtained. The possibility of generalizing the concept of available
potential energy to dynamically stable basic flows (as opposed to stat
ically stable basic states) is also discussed.