Minimizing energy functional Let $ \Omega $ be an open subset with compact closure and smooth boundary of a non compact riemannian manifold $ M $. Let $ f \in C^{\infty}(\partial \Omega) $ and $ q \in C^{\infty}(M) $, $ q \geq 0 $. Consider the following Dirichlet problem
$$ - \Delta u + q u =0 \; \; \textrm{on}\; \Omega $$
$$ u|_{\partial \Omega} = f $$
Since $ q \geq 0 $ there exists a unique solution $ u \in C^{\infty}(\overline{\Omega}) $ of the problem above.
Now my question: is it true that
$$ \int_{\Omega} (|\nabla u|^2 + qu^2)dV = \min \{ \int_{\Omega} (|\nabla v|^2 + qv^2)dV : v \in C^{\infty}(\overline{\Omega}), v|_{\partial \Omega}= f \} ?$$
Thanks
 A: Actually we don't have go into the Sobolev space so that we don't have to bother with the norm topology.
We can perturb the functional by a test function $w\in C^{\infty}_0(\Omega)$ so that we don't change its boundary value $f$:
$$F(v+\epsilon w)=  \int_{\Omega} \left(|\nabla (v+\epsilon w)|^2 + q(v+\epsilon w)^2\right)\,dV .\tag{1} $$
For the function $g(\epsilon) := F(u+\epsilon w) $, it achieves the minimum at $\epsilon =0$ for any $w$, because the $u$ is the minimizer:
$$
\lim_{\epsilon \to 0}\frac{d}{d\epsilon}F(u+\epsilon w) = 0
$$
If everything is smooth, we can interchange the limit and the derivative for (1):
$$
\lim_{\epsilon \to 0}\int_{\Omega} \left(\frac{d}{d\epsilon}|\nabla (u+\epsilon w)|^2 + \frac{d}{d\epsilon}q(u+\epsilon w)^2\right)\,dV = 0,
$$
this is 
$$
\lim_{\epsilon \to 0}\int_{\Omega} \left( 2\nabla (u+\epsilon w)\cdot  \nabla w +  2q(u+\epsilon w) w\right)\,dV = 0,
$$
which is
$$
 \int_{\Omega} \left( \nabla u\cdot  \nabla w +  qu w\right)\,dV = 0.
$$
Integration by parts for the first term use the fact that the perturbation term does not change the boundary value: $w = 0$ on boundary 
$$
\int_{\Omega} ( -\Delta u +  qu )w\,dV = 0.
$$
By fundamental theorem of calculus of variations, you have the result.
A: Let $\mathcal{K}=\{u\in H^1(\Omega):\ \operatorname{trace}u=f\}$ and $F:\mathcal{K}\to\mathbb{R}$ defined by $$F(v)=\int_\Omega|\nabla v|^2+qv^2dV$$
We know that, if $u$ is the unique solution of your problem, then $$F(u)=\min\{F(v):\ v\in\mathcal{K}\}$$
On the other hand, the set $\mathcal{K}_\infty=\{u\in C^\infty(\overline{\Omega}):\ \operatorname{trace}u=f\}$, is dense in $\mathcal{K}$, hence, we can conclude that your question has a affirmative answer..
