  We study the spreading and leveling of a gravity current in a Hele-Shaw cell
with flow-wise width variations as an analog for flow in a porous medium with
horizontally heterogeneous permeability. Using phase-plane analysis, we obtain
second-kind self-similar solutions to describe the evolution of the gravity
current's shape during both the spreading (pre-closure) and leveling
(post-closure) regimes. The self-similar theory is compared to numerical
simulations of the partial differential equation governing the evolution of
current's shape (under the lubrication approximation) and to table-top
experiments. Specifically, simulations of the governing partial differential
equation from lubrication theory allow us to compute a pre-factor, which is
\textit{a priori} arbitrary in the second-kind self-similar transformation, by
estimating the time required for the memory of the initial condition to be
forgotten (and for the current to enter the self-similar regime). With this
pre-factor calculated, we show that theory, simulations and experiments agree
well near the propagating front. In the leveling regime, the current's memory
resets, and another self-similar behavior emerges after an adjustment time,
which we estimate from simulations. Once again, with the pre-factor calculated,
both simulations and experiments are shown to obey the predicted self-similar
scalings. For both the pre- and post-closure regimes, we provide detailed
asymptotic (analytical) characterization of the universal current profiles that
arise as self-similarity of the second kind.
