  We describe a `discretize-then-relax' strategy to globally minimize integral
functionals over functions $u$ in a Sobolev space subject to Dirichlet boundary
conditions. The strategy applies whenever the integral functional depends
polynomially on $u$ and its derivatives, even if it is nonconvex. The
`discretize' step uses a bounded finite element scheme to approximate the
integral minimization problem with a convergent hierarchy of polynomial
optimization problems over a compact feasible set, indexed by the decreasing
size $h$ of the finite element mesh. The `relax' step employs sparse
moment-sum-of-squares relaxations to approximate each polynomial optimization
problem with a hierarchy of convex semidefinite programs, indexed by an
increasing relaxation order $\omega$. We prove that, as $\omega\to\infty$ and
$h\to 0$, solutions of such semidefinite programs provide approximate
minimizers that converge in a suitable sense (including in certain $L^p$ norms)
to the global minimizer of the original integral functional if it is unique. We
also report computational experiments showing that our numerical strategy works
well even when technical conditions required by our theoretical analysis are
not satisfied.
