I am dealing with the following Lagrangian density $$\mathscr{L}_{em}= -\frac{1}{2}\rho\omega^2 u^2 +\frac{1}{2}\nabla u:\Sigma :\nabla u-\frac{1}{2}\nabla\phi\cdot\epsilon\cdot\nabla\phi+\nabla\phi\cdot P:\nabla u$$ where $\rho,\omega\in\mathbb{R}^+$, $\Sigma_{ij,kl}=\Sigma_{ji,kl}=\Sigma_{ij,lk}=\Sigma_{kl,ij}$, $\epsilon_{ij}=\epsilon_{ji}$, $P_{ijk}=P_{ikj}$, $\phi$ is a scalar field and $ u \in\mathbb{R}^3$.
I need to compute the associated Hamiltonian density.
If it was just
$$\mathscr{L}_m=-\frac{1}{2}\rho\omega^2 u^2 +\frac{1}{2}\nabla u:\Sigma :\nabla u$$
by defining the momentum $\sigma_m=\Sigma:\nabla u$, and using the Legendre transform
$$\mathscr{H}=p\cdot\nabla q(q,p)-\mathscr{L}(q,p),$$
where $q$ are the field variables and $p$ the momentum, I obtain
$$\mathscr{H}_m=\frac{1}{2}\rho\omega^2 u^2+\frac{1}{2}\sigma_m:\Sigma^{-1} :\sigma_m.$$
Also for
$$\mathscr{L}_e=-\frac{1}{2}\nabla\phi\cdot\epsilon\cdot\nabla\phi$$
I can obtain
$$\mathscr{H}_e=-\frac{1}{2} d_e\cdot\epsilon^{-1}\cdot d_e$$
with $d_e=-\varepsilon\cdot\nabla\phi$.
But now, what about the Hamiltonian density for $\mathscr{L}_{em}$? Can I write something like
$$\mathscr{H}_{em}=\frac{1}{2}\rho\omega^2 u^2 +\frac{1}{2}\sigma_m:\Sigma^{-1}:\sigma_m -\frac{1}{2}d_e\cdot\epsilon^{-1}\cdot d_e\pm d_e\cdot Q:\sigma_m~?$$
Or must I rely on the introduction of the momentum
$$\sigma_{em}=\Sigma:\nabla u+P^T\cdot\nabla\phi.$$
$$d_{em}=-\varepsilon\cdot\nabla\phi+P:\nabla u~ ?$$
Who is the matrix $Q$?
Is something related to this Phys.SE post: Lagrangian and hamiltonian of interaction ?
I am new in the argument, but every suggestion is appreciated.