Where do some "energy identities" in PDE theory come from? There are a lot of very complicated expression that helps us obtain useful estimates for PDEs. To just give one example, the following is one of the Virial identities:
$$
\frac12\frac{d}{dt} \Im \left(\int (x \cdot \nabla u) u^*  \right)dx =\int|\nabla u|^2 dx -\epsilon\left(\frac{n}{2}-\frac{n}{p+1}\right)\int|u|^{p+1} dx,
$$
where $u\in H^1, xu\in L^2$ solves the non-linear Schrödinger equation $i\partial_t u + \Delta u = -\epsilon u|u|^2$ in $\mathbb R^n.$
One way to come up with complicated "energy" or "momentum" expressions is to use Noether's theorem, but apparently many identities similar to the one above cannot be easily derived by Noether's theorem. In particular, the above expression can be derived without using any Lagrangians at all.
I often see such complicated identities in texts about PDE theory, stated and proven without any clues about where they come from.
My question is: how do people come up with them in the first place? It would be very helpful if there were an explanation for at least one or two identities like this so that I can see what type of reasoning is involved when we discover them.
 A: First a comment: in the context of nonlinear wave and Klein-Gordon equations, the venerable "ABC method" of Cathleen Morawetz is literally "mucking around until you see something". (The A, B, and C refer to the three free function coefficients you can choose for your argument and judicious choices give you good signs for the things you want.)
But most of the time nowadays you do this by only mucking around after you see a reason why something you want is likely to be true.
For your example of the Virial identity. First: what you wrote down is what I consider an intermediate step of the Virial argument, which would state that a Virial potential is convex/concave.
Linear Schrodinger
First, think about the case for the linear Schrodinger equation. This models quantum particles without external forces. In the classical limit you have the particles travel on straight lines. In the QM picture the wave packets have centers travelling on straight lines but dispersing slightly. From a central point of view you see that the particles are expected to move in such a way that its radial distance from a fixed point is convex. (Basically centrifugal force.)
Based on this you expect that given a function $a(x) = a(|x|)$ that increases radially, you should see something like
$$ V_a(t) = \int_{\mathbb{R}^N} a(x) |u(t,x)|^2 ~\mathrm{d}x $$
to be convex (in time), at least for suitably chosen weights $a$ that is compatible with the amount of centrifugal force you have.
This $V_a(t)$ is the Virial potential. Its first time derivative is equal to the Morawetz action (this step holds both for the linear and nonlinear Schrodinger equations)
$$ M_a(t) = \int \nabla a \cdot (\Im u^* \nabla u) ~\mathrm{d}x $$
which, for $a(x) = \frac12 |x|^2$, is what you listed in your original question. But you should keep in mind that the expectation of the Morawetz action having a favorable time derivative is based on the expectation that the Virial potential is convex.
Notice that the convexity of the Virial potential rules out the possibility of mass concentration for the linear Schrodinger equation.
NLS
Now supposing your are looking at the nonlinear Schrodinger equation. And you understand that

*

*ruling out mass concentration can go a long way toward showing that the solution doesn't become singular

*ensuring mass concentration will be a way of showing that the solution does become singular

So you decide to check for your nonlinearity, whether you can still guarantee that the Virial potential is still convex in time (preventing mass concentration) or may it be that for strong enough nonlinearities the potential may turn concave in time (roughly: the presence of an attractive central force that over comes the centrifugal force), which may lead to mass concentration. And then you start computing...

For more similar discussions, I think Tao's Nonlinear Dispersive Equations actually gives a lot of "morals" and "motivations" of the sorts of identities and inequalities used.
A: Another construction when your PDE has a Hamiltonian structure, but the Poisson structure has a non-trivial kernel. Roughly speaking, this means that the phase space is foliated by submanifolds, and each of these varieties is equiped with a non-degenerate Poisson structure, this one varying smoothly along the foliation. Functions that are constant along each leaf are called Casimir's. These are conserved quantities along the flow of the PDE because this flow stay on the leaf associated with the initial data.
A typical example arises in the Euler equation governing the velocity field $u$ of an incompressible fluid. In $2$ space dimensions, the functional
$$\int_\Omega f(\partial_1u_2-\partial_2u_1)\,dx$$
are Casimir's ($f$ smooth but arbitrary). In $3$ space dimensions, in a torus or in ${\mathbb R}^3$, the helicity is a Casimir:
$$\int u\cdot{\rm curl}\,u\,dx.$$
Both examples have natural generalizations to higher dimensions. They also have counterparts in the case of compressible fluids.
This is quite important because despite the family of Casimir's can be quite large, it does not contribute to the complete integrability of a Hamiltonian system. In some sense, these are trivial invariants, because they depend only upon the Poisson structure, but not on the choice of the Hamiltonian.
A: In addition to the variational approach based on Noether's theorem, there are other ways to find conservation laws for nonlinear PDE's:

*

*The symmetry/adjoint symmetry pair method extracts a conservation law from a bilinear skew-symmetric identity.
It involves the following steps: (a) Linearize the given system of PDEs; (b) Find the adjoint system of the linearized system; (c) Find solutions of the linearized system, i.e., local symmetries in characteristic (evolutionary) form of the given PDE system; (d) Find solutions of the adjoint system; (e) For any pair, consisting of a solution for the adjoint system and a local symmetry, construct a conservation law.

*The multiplier approach (also known as the variational derivative method), generalizes Noether's approach so that it can be applied whether or not the linearized system is self-adjoint (no Lagrangian formulation is needed).

*Scale invariance can be used to obtain a conservation law from a simple algebraic formula.

*The GeM software
package searches for conservation laws of
ordinary and partial differential equations without human
intervention.

So yes, there are alternatives to just "mucking around until you see something".
