lstlisting's can span across several pages in very ugly ways:

One solution could be to enclose lstlistings in a minipage:
\noindent\begin{minipage}{\linewidth}
\begin{lstlisting}[numbers=none, language=C++, caption=my caption, label=code:Eqn]
solve
(
fvm::ddt(rho,Phi)
+ fvm::div(phi, Phi)
- fvm::laplacian(Gamma, Phi)
==
Sphi
);
\end{lstlisting}
\end{minipage}
Result:

I suggest adding minipage around the lstlisting in the tex templates here.
Note the \noindent which is needed to ensure alignement with the text margins.
lstlisting's can span across several pages in very ugly ways:

One solution could be to enclose lstlistings in a minipage:
Result:
I suggest adding minipage around the lstlisting in the tex templates here.
Note the \noindent which is needed to ensure alignement with the text margins.