[step:Vary the density to obtain the Hamilton-Jacobi equation up to a time function]
Let
\begin{align*}
\sigma:[0,1]\times\overline U&\to\mathbb R
\end{align*}
be a $C^1$ function satisfying $\sigma_0=0$, $\sigma_1=0$, and
\begin{align*}
\int_U\sigma_t\,d\mathcal L^n=0
\end{align*}
for every $t\in[0,1]$. For sufficiently small $\varepsilon\in\mathbb R$, define
\begin{align*}
\rho^\varepsilon_t:U&\to(0,\infty),
\end{align*}
\begin{align*}
x&\mapsto\rho_t(x)+\varepsilon\sigma_t(x).
\end{align*}
Stationarity in the density variable gives
\begin{align*}
0
=
\frac{d}{d\varepsilon}\bigg|_{\varepsilon=0}\mathscr L[\rho^\varepsilon,v,\psi].
\end{align*}
Differentiating gives
\begin{align*}
0
=
\int_0^1\int_U \sigma_t|v_t|^2\,d\mathcal L^n\,d\mathcal L^1(t)
+
2\int_0^1\int_U \psi_t\partial_t\sigma_t\,d\mathcal L^n\,d\mathcal L^1(t)
+
2\int_0^1\int_U \psi_t\nabla\cdot(\sigma_t v_t)\,d\mathcal L^n\,d\mathcal L^1(t).
\end{align*}
Integration by parts in time has no endpoint contribution because $\sigma_0=\sigma_1=0$, and integration by parts in space has no boundary contribution because $v_t\cdot\nu=0$ on $\partial U$. Hence
\begin{align*}
0
=
\int_0^1\int_U
\sigma_t\left(
|v_t|^2-2\partial_t\psi_t-2v_t\cdot\nabla\psi_t
\right)\,d\mathcal L^n\,d\mathcal L^1(t).
\end{align*}
Using $v_t=\nabla\psi_t$, this becomes
\begin{align*}
0
=
-\int_0^1\int_U
\sigma_t\left(
2\partial_t\psi_t+|\nabla\psi_t|^2
\right)\,d\mathcal L^n\,d\mathcal L^1(t).
\end{align*}
Define
\begin{align*}
g:[0,1]\times U&\to\mathbb R,
\end{align*}
\begin{align*}
(t,x)&\mapsto 2\partial_t\psi_t(x)+|\nabla\psi_t(x)|^2.
\end{align*}
The preceding identity says
\begin{align*}
\int_0^1\int_U \sigma_t g_t\,d\mathcal L^n\,d\mathcal L^1(t)=0
\end{align*}
for every $C^1$ function $\sigma$ with zero endpoint values and zero spatial mean at each time. Applying the fundamental lemma first with variations supported in an arbitrary time subinterval of $(0,1)$ and then with arbitrary zero-mean spatial variations gives that, for each $t\in(0,1)$, the function $g_t$ is constant on $U$. Since $g$ is continuous on $[0,1]\times U$, the same conclusion extends to $t=0$ and $t=1$ by taking one-sided limits. Thus there exists a continuous function
\begin{align*}
c:[0,1]&\to\mathbb R
\end{align*}
such that
\begin{align*}
\partial_t\psi_t+\frac12|\nabla\psi_t|^2=c(t)
\end{align*}
on $U$ for every $t\in[0,1]$.
[/step]