Derive the Momentum Equation from a Lagrangian (Fluid Dynamics) I'm trying to derive the fully compressible Euler-Momentum equation for the given Lagrangian.
We wish to derive $$\rho\frac{D\boldsymbol{u}}{Dt} + \nabla P + \rho\nabla\phi = 0  $$ from the Lagrangian $$ \mathcal{L} = \rho \left( \frac{|\boldsymbol{u}|^{2}}{2} -e(\rho,s) - \phi \right) $$
I've gotten as far as
$$\frac{\partial}{\partial t}(\rho\boldsymbol{u}) + \nabla\cdot(\rho\boldsymbol{u}\boldsymbol{u}) + \rho\nabla\frac{|\boldsymbol{u}|^{2}}{2} -\rho\nabla \left(\frac{|\boldsymbol{u}|^{2}}{2}-e-\frac{P}{\rho}-\phi \right) - \rho T\nabla s = 0 $$
which has been verified as correct.
I've recognized the following relationships, $$\frac{\partial}{\partial t}(\rho\boldsymbol{u}) + \nabla\cdot(\rho\boldsymbol{u}\boldsymbol{u}) = -\nabla P $$ $$\frac{D\boldsymbol{u}}{Dt} = -\nabla \frac{P}{\rho} $$
$$ \rho T\nabla s = \rho\nabla e - \frac{P}{\rho}\nabla\rho $$ which are the Euler-Momentum equation in conservative form, the Euler-Momentum equation, and the 2nd Law of Thermodynamics, respectively.
but after implementing these I arrive at:
$$\frac{\partial}{\partial t}(\rho\boldsymbol{u}) + \nabla\cdot(\rho\boldsymbol{u}\boldsymbol{u}) + \rho\nabla\frac{|\boldsymbol{u}|^{2}}{2} - \rho\nabla\frac{|\boldsymbol{u}|^{2}}{2} + \rho\nabla e + \rho\nabla\frac{P}{\rho} + \rho\nabla\phi - \rho\nabla e + \frac{P}{\rho}\nabla\rho = 0 $$
$$ \Rightarrow -\nabla P - \rho \frac{D\boldsymbol{u}}{Dt} + \rho\nabla\phi + \frac{P}{\rho}\nabla\rho = 0 $$
which is "close" but incorrect. Where am I going wrong here?
 A: It works out just fine
Starting from your equation:
$$\frac{\partial}{\partial t}(\rho\boldsymbol{u})+\nabla\cdot(\rho\boldsymbol{u}\boldsymbol{u})+\rho\nabla\frac{|\boldsymbol{u}|^{2}}{2}-\rho\nabla\left(\frac{|\boldsymbol{u}|^{2}}{2}-e-\frac{P}{\rho}-\phi\right)-\rho T\nabla s=0$$
it can be simplified:
$$\frac{\partial}{\partial t}(\rho\boldsymbol{u})+\nabla\cdot(\rho\boldsymbol{u}\boldsymbol{u})+\rho\nabla\left(e+\frac{P}{\rho}+\phi\right)-\rho T\nabla s=0$$
by canceling kinetic energy terms.
Then applying the 2nd law of thermodynamics:
$$\rho T\nabla s=\rho\nabla e-\frac{P}{\rho}\nabla\rho$$
substituting, cancelling and rearranging we get:
$$\frac{\partial}{\partial t}(\rho\boldsymbol{u})+\nabla\cdot(\rho\boldsymbol{u}\boldsymbol{u})+\rho\nabla\frac{P}{\rho}+\frac{P}{\rho}\nabla\rho+\rho\nabla\phi=0$$
The pressure terms can be combined using the product rule:
$$\nabla P = \nabla \left[\rho\frac{P}{\rho}\right]=\rho\nabla\frac{P}{\rho}+\frac{P}{\rho}\nabla\rho$$
to yield:
$$\frac{\partial}{\partial t}(\rho\boldsymbol{u})+\nabla\cdot(\rho\boldsymbol{u}\boldsymbol{u})+\nabla P+\rho\nabla\phi=0$$
Then using the continuity equation:
$$\frac{\partial\rho}{\partial t}+\nabla\cdot(\rho\boldsymbol{u})=0$$
we simplify the first two terms on the left:
$$\frac{\partial}{\partial t}(\rho\boldsymbol{u})+\nabla\cdot(\rho\boldsymbol{u}\boldsymbol{u})=\rho\left[\frac{\partial\boldsymbol{u}}{\partial t}+\boldsymbol{u}\nabla\cdot\boldsymbol{u}\right]+\left[\frac{\partial\rho}{\partial t}+\nabla\cdot(\rho\boldsymbol{u})\right]\boldsymbol{u}=\rho\frac{D\boldsymbol{u}}{Dt}$$
Finally we get to what you wished to derive:
$$\rho\frac{D\boldsymbol{u}}{Dt}+\nabla P+\rho\nabla\phi=0$$
