  We show that the widely used model governing the motion of two incompressible
immiscible fluids in a possibly heterogeneous porous medium has a formal
gradient flow structure. More precisely, the fluid composition is governed by
the gradient flow of some non-smooth energy. Starting from this energy together
with a dissipation potential, we recover the celebrated Darcy-Muskat law and
the capillary pressure law governing the flow thanks to the principle of least
action. Our interpretation does not require the introduction of any algebraic
transformation like, e.g., the global pressure or the Kirchhoff transform, and
can be transposed to the case of more phases.
