I'm self studying some variational methods for PDEs but I'm really lost on the process of looking to a PDE and saying "this is the energy functional which Euler-Lagrange equation is the PDE". For example, almost every textbook I've read says that the functional
$$ I[u] = \int_\Omega {1 \over 2}|\nabla u|^2 - F(x , u(x)) dx, $$
where
$$ F(x, s) = \int_0^t f(x, s) ds, $$
is the functional associated with the nonlinear Poisson equation
$$ -\Delta u = f(x, u). $$
I don't get where this comes from. Like, I see that the Fréchet derivative of $I[u]$ is basically the weak formulation of the nonlinear Poisson equation, what I don't see is the process of looking to such PDE and saying that $I[u]$ is the functional we want. I thought that it'd be something like "just take $v = u$ in the weak formulation" but it's not quite clicking. I reckon it's probably something trivial that I'm not seeing, but if you guys could give some clarification or point to some references It'd be great. Thanks in advance!