**Hamiltonian fluid mechanics** is the application of Hamiltonian methods to fluid mechanics. This formalism can only apply to nondissipative fluids.

Take the simple example of a barotropic, inviscid vorticity-free fluid.

Then, the conjugate fields are the mass density field *ρ* and the velocity potential *φ*. The Poisson bracket is given by

{
φ
(
x
→
)
,
ρ
(
y
→
)
}
=
δ
d
(
x
→
−
y
→
)
and the Hamiltonian by:

H
=
∫
d
d
x
H
=
∫
d
d
x
(
1
2
ρ
(
∇
φ
)
2
+
e
(
ρ
)
)
,
where *e* is the internal energy density, as a function of *ρ*. For this barotropic flow, the internal energy is related to the pressure *p* by:

e
″
=
1
ρ
p
′
,
where an apostrophe ('), denotes differentiation with respect to *ρ*.

This Hamiltonian structure gives rise to the following two equations of motion:

∂
ρ
∂
t
=
+
∂
H
∂
φ
=
−
∇
⋅
(
ρ
u
→
)
,
∂
φ
∂
t
=
−
∂
H
∂
ρ
=
−
1
2
u
→
⋅
u
→
−
e
′
,
where
u
→
=
d
e
f
∇
φ
is the velocity and is vorticity-free. The second equation leads to the Euler equations:

∂
u
→
∂
t
+
(
u
→
⋅
∇
)
u
→
=
−
e
″
∇
ρ
=
−
1
ρ
∇
p
after exploiting the fact that the vorticity is zero:

∇
×
u
→
=
0
→
.
As fluid dynamics is described by non-canonical dynamics, which possess an infinite amount of Casimir invariants, an alternative formulation of Hamiltonian formulation of fluid dynamics can be introduced through the use of Nambu mechanics