Let $n\in\mathbb N$, and let $U\subset\mathbb R^n$ be a bounded convex open set with $C^1$ boundary. Let $\nu:\partial U\to\mathbb R^n$ denote the outward unit normal. Let $\rho_0,\rho_1\in C^1(\overline U;(0,\infty))$ satisfy
in $U$ for every $t\in[0,1]$, together with the boundary condition
paragraph
admin
\begin{align*}
\rho_t v_t\cdot\nu=0
\end{align*}
latex_env
admin
on $\partial U$ for every $t\in[0,1]$.
paragraph
admin
Assume that $(\rho,v)$ is a minimizer in this smooth no-flux class and, in addition,
paragraph
admin
\begin{align*}
v_t\cdot\nu=0
\end{align*}
latex_env
admin
on $\partial U$ for every $t\in[0,1]$. Assume also that this minimizer is a regular point of the smooth no-flux constraint map in the following precise sense: there exists a multiplier $\psi\in C^1([0,1]\times\overline U;\mathbb R)$ such that $(\rho,v,\psi)$ is stationary, under all $C^1$ variations of $\rho$ with zero endpoint values and zero spatial mean at each time and all $C^1$ variations of $v$ tangent to $\partial U$, for the augmented functional
where $\psi_t:U\to\mathbb R$ is $x\mapsto\psi(t,x)$. Then there exists $\phi\in C^1([0,1]\times\overline U;\mathbb R)$ such that
paragraph
admin
\begin{align*}
v_t=\nabla\phi_t
\end{align*}
latex_env
admin
on $U$ for every $t\in[0,1]$, where $\phi_t:U\to\mathbb R$ is the map $x\mapsto\phi(t,x)$. For each fixed $t\in[0,1]$, the function $\phi_t$ is unique up to addition of a constant on $U$. Equivalently, $\phi$ is unique up to addition of a function of $t$. Moreover, after adding a suitable $C^1$ function of $t$ to $\phi$, one has
Conversely, let $\rho\in C^1([0,1]\times\overline U;(0,\infty))$ and let $\phi:[0,1]\times\overline U\to\mathbb R$ be $C^1$ in $t$ and $C^2$ in $x$. For each $t\in[0,1]$, define
holds for all $0\le s<t\le1$ and all $x,y\in\overline U$. Then $(\mu_t)_{t\in[0,1]}$ is a constant-speed geodesic in $(\mathcal P_2(\overline U),W_2)$, where $W_2$ denotes the quadratic Wasserstein distance induced by the Euclidean distance on $\overline U$.