# Proving that system is Hamiltonian

This question is moved from math stackexchange, seems like it is a more advanced question. Here the link from the original question: https://math.stackexchange.com/questions/2666194/proving-that-system-is-hamiltonian

I am trying to show that the PDEs governing stratified flow are Hamiltonian. The approach is based on the paper "Nonlinear Stability Analysis of Stratified Fluid Equilibria which can be found here https://www.researchgate.net/publication/37465117_Nonlinear_Stability_Analysis_of_Stratified_Fluid_Equilibria On page 390 the author suggest the reader to actually check directly that the equations of motion are Hamiltonian, this has been done for a similar problem already in section 7a.

I know is quite a lengthy problem, but I dont know what I have done wrong, in the end one term in the euler equation has the factor 1/$\varrho$ which shouldnt be there. Any advice is appreciated

Equations to derive: \begin{gather} \label{gleichung1}\frac{\partial v}{\partial t}= -\frac{\nabla p}{\varrho}-\nabla \big(\frac{1}{2}|v|^2 +gz \big)+\color{red}{v \times curl~ v}\\ \frac{\partial \varrho }{\partial t} = -v\cdot \nabla \varrho\notag\\ \operatorname{div} v =0\notag \end{gather} The first variation is defined via $$\delta F=DF(v,\varrho)\cdot (\delta v,\delta \varrho)$$ Poisson bracket: $$\{F,G\}(v,\varrho)=\int_D v\cdot \left[\left(\frac{\delta G}{\delta v}\cdot \nabla\right)\frac{\delta F}{\delta v}-\left(\frac{\delta F}{\delta v}\cdot \nabla\right)\frac{\delta G}{\delta v}\right]d^3 \boldsymbol{x}+\int_D\varrho \left(\frac{\delta G}{\delta v}\cdot \nabla \frac{\delta F}{\delta \varrho}-\frac{\delta F}{\delta v}\cdot \nabla \frac{\delta G}{\delta \varrho}\right)d^3 \boldsymbol{x}\label{Poissonbracket}$$ Hamiltonian function: \begin{equation*} H=\int_D \frac{1}{2}\varrho |v|^2+\varrho g z ~d^3 \boldsymbol{x} \end{equation*}

\begin{equation*} \delta H=\int_D \frac{1}{2}|v|^2\delta \varrho+gz\delta \varrho+\varrho v\cdot\delta v~d^3 \boldsymbol{x}. \end{equation*} With the redefined weakly pairing which is explained in more detail in the paper we have the following first variations (equation 7.54): \begin{gather*} \frac{\delta H}{\delta v}= v,\\ \frac{\delta H}{\delta \varrho}=\frac{1}{2}|v|^2+gz. \end{gather*}

For clarification: The variation should be correct because the paper defines a new Riemannian metric on $Diff_{vol}(D)$ (page 389) via $$<<U_\eta,v_\eta >>=\int_D \varrho_0(X) U_\eta (X)\cdot V_\eta(X)d^3 X,$$ where the dot denotes the dot product in R^3.

The variation depends on the weak riemannian metric in the following way: $$D_v F(v)\cdot \delta v=\Big\langle\Big\langle \frac{\delta F}{\delta v},\delta v\Big\rangle\Big\rangle$$

Inserting this into the Poisson bracket yields:

\begin{align} \{F,H\}&=\int_D v\cdot \left[\left( v\cdot \nabla\right)\frac{\delta F}{\delta v}-\left(\frac{\delta F}{\delta v}\cdot \nabla\right) v\right]+\varrho \left(v\cdot \nabla \frac{\delta F}{\delta \varrho}-\frac{\delta F}{\delta v}\cdot \nabla \Big(\frac{1}{2}|v|^2+gz\Big)\right)d^3 \boldsymbol{x}\notag\\ &=\int_D \sum_{i=1}^{3} v_i v\cdot \nabla \left(\frac{\delta F}{\delta v}\right)_i-\frac{\delta F}{\delta v}\cdot \nabla \Big(\frac{1}{2}|v|^2\Big)-\operatorname{div}(\rho v)\frac{\delta F}{\delta \varrho}-\varrho\frac{\delta F}{\delta v}\cdot \nabla \Big(\frac{1}{2}|v|^2+gz\Big)d^3 \boldsymbol{x}\notag\\ &~~~+\oint_{\partial D}\varrho\frac{\delta F}{\delta \varrho} v\cdot \vec{n}~dS\notag\\ &=\int_D \sum_{i=1}^3-\operatorname{div}(v_iv)\left(\frac{\delta F}{\delta v}\right)_i-\frac{\delta F}{\delta v}\cdot \nabla \Big(\frac{1}{2}|v|^2\Big)-\nabla \rho\cdot v \frac{\delta F}{\delta \varrho}-\varrho \frac{\delta F}{\delta v}\cdot \nabla \Big(\frac{1}{2}|v|^2+gz\Big)d^3 \boldsymbol{x}\notag\\ &~~~+\oint_{\partial D}\sum_{i=1}^3\left(\frac{\delta F}{\delta v}\right)_i v_iv\cdot \vec{n}~dS\notag\\ &=\int_{D}\sum_{i=1}^3-\nabla v_i\cdot v \left(\frac{\delta F}{\delta v}\right)_i-\frac{\delta F}{\delta v}\cdot \nabla \Big(\frac{1}{2}|v|^2\Big)-\nabla \rho\cdot v \frac{\delta F}{\delta \varrho}-\varrho \frac{\delta F}{\delta v}\cdot \nabla \Big(\frac{1}{2}|v|^2+gz\Big)d^3 \boldsymbol{x}\notag\\ &=\int_{D}-(v\cdot \nabla)v \cdot \frac{\delta F}{\delta v}-\frac{\delta F}{\delta v}\cdot \nabla \Big(\frac{1}{2}|v|^2\Big)-\nabla \rho\cdot v \frac{\delta F}{\delta \varrho}-\varrho \frac{\delta F}{\delta v}\cdot \nabla \Big(\frac{1}{2}|v|^2+gz\Big)d^3 \boldsymbol{x}\notag\\ &=\int_D \left(v\times curl~ v-\nabla \big(|v|^2\big)-\rho \nabla\Big(\frac{1}{2}|v|^2+gz\Big)\right)\cdot \frac{\delta F}{\delta v}-(v\cdot \nabla \varrho)\frac{\delta F}{\delta \varrho} ~d^3 \boldsymbol{x}\notag, \end{align} where in the last step we used the vector identity $-(v\cdot \nabla)v=v\times curl ~v-\frac{1}{2}\nabla \big(|v|^2\big)$. By the Helmholtz-Hodge decomposition this transforms into

\begin{align*} \{F,H \}&=\int_D P\left(v\times curl ~v-\rho \nabla\Big(\frac{1}{2}|v|^2+gz\Big)\right)\cdot \frac{\delta F}{\delta v}-(v\cdot \nabla \varrho)\frac{\delta F}{\delta \varrho} ~d^3 \boldsymbol{x}\\ &=\Bigg\langle \frac{P\left(v\times curl~ v-\rho \nabla\Big(\frac{1}{2}|v|^2+gz\Big)\right)}{\varrho}, \frac{\delta F}{\delta v}\Bigg \rangle +\bigg \langle -v\cdot \nabla \varrho, \frac{\delta F}{\delta \varrho} \bigg \rangle \end{align*} On the other hand we have \begin{equation*} \frac{d}{dt} F(v,\varrho)= \bigg \langle \dot v, \frac{\delta F}{\delta v} \bigg \rangle+\bigg \langle \dot \varrho, \frac{\delta F}{\delta \varrho} \bigg \rangle \end{equation*} Comparing coefficient in terms of variational derivatives we arrive at: \begin{gather*} \dot{v}=\frac{P\left(v\times curl~ v-\rho \nabla\Big(\frac{1}{2}|v|^2+gz\Big)\right)}{\varrho}\\ \dot{\varrho}=-v\cdot \nabla \varrho \end{gather*} Applying the Helmholtz Hodge decomposition with the ansatz \begin{equation*} v\times curl ~v -\varrho \nabla (\frac{1}{2}|v|^2+gz)=u-\nabla p \end{equation*} yields \begin{equation*} \dot v= \color{red}{\frac{v\times curl~ v}{\varrho}}-\nabla \Big(\frac{1}{2}|v|^2+gz\Big)-\frac{\nabla p}{\varrho} \end{equation*} Note, that $p$ also does not necessarily agree with the pressure $p$? Taking the divergence of the euler equation leads to the Neumann problem: \begin{gather*} 0=-\frac{\nabla^2 p}{\varrho}+\frac{\nabla p\cdot \nabla \varrho}{\varrho^2}-\nabla^2 \big(\frac{1}{2}|v|^2+gz\big)+\operatorname{div}(v\times curl~ v)\\ \frac{\partial p}{\partial \vec{n}}=\varrho \vec{n}\cdot \nabla \big(\frac{1}{2}|v|^2+gz\big)-\varrho \vec{n}\cdot v\times curl~ v \end{gather*}

In the section 7a of the paper the Neumann equation and uniqueness of the Helmholz hodge decompositions yields that p of the ansatz actually agrees with the pressure