Conservative Systems and The Hamilton-Jacobi Equation
The function $u$ is known as Hamilton's principal function. Since OP's system is apparently autonomous, one should (in order to simplify) use Hamilton's characteristic function $W$ instead. The HJ equation then simplifies to $$H(x,\nabla W)~=~E. $$ The corresponding characteristic curves certainly preserves the energy level $E$.