minimizing the norm of a curl over a domain According to my computations:

The function which minimizes $$\int_\Omega \|\operatorname{curl} f\|^2\,dx$$ should satisfy $$\operatorname{curl}(\operatorname{curl}f) = 0$$ everywhere on $\Omega$, provided $\operatorname{curl} f = 0$ on $\partial \Omega$.

I followed the same kind of computation that the one demonstrating the the argmin of $\int_\Omega \|\nabla f\|^2~dx$ should satisfy $\Delta f = 0$. However, I am not sure whether my computations are right... May anyone check that please ?
1) We first start with a functional $$G(f) = \int_\Omega \|\operatorname{curl} f\|^2\,dx.$$
2) We compute 
$$V(f,h) = \lim_{\epsilon\rightarrow 0} \frac{G(f+\epsilon h)-G(f)}{\epsilon} = 2\int_\Omega \operatorname{curl} f\cdot\operatorname{curl} h\,dx.$$
3) We use the identity : 
$$\operatorname{div}(A\times B) = -A\cdot\operatorname{curl} B + B\cdot\operatorname{curl} A,$$ with $A=\operatorname{curl} f$ and $B=h$.
4) We obtain $$\int_\Omega \operatorname{curl} f\cdot \operatorname{curl} h\:dx = -\int_\Omega \operatorname{div}(\operatorname{curl} f\times h)\,dx + \int_\Omega h\cdot \operatorname{curl}(\operatorname{curl}f)\,dx.$$
5) We use the divergence theorem to obtain : 
$$\int_\Omega \operatorname{curl} f\cdot \operatorname{curl} h\,dx = -\int_{\partial\Omega} \operatorname{curl} f\times h\,ds + \int_\Omega h\cdot\operatorname{curl}(\operatorname{curl}f)\,dx$$  
6) We assumed $\operatorname{curl} f = 0$ on $\partial\Omega$, so the first term is zero.
7) $V(f,h)$ should equal zero for all $h$ for the function to be minimized, so $$\int_\Omega h\cdot\operatorname{curl}(\operatorname{curl}f) dx = 0\quad\forall h,$$ which implies $\operatorname{curl}(\operatorname{curl}f) = 0$ locally.  
I guess this reasonning may be wrong in several places..... or is it right??
Thanks!
 A: OP is mostly perfect until some later parts.
For the curl operator we have a similar integration by parts formula to the divergence theorem:
$$
\int_{\Omega}\nabla \cdot (u\nabla v) = \int_{\Omega}(u\Delta v + \nabla u\cdot \nabla v) = \int_{\partial \Omega} u\nabla v\cdot \nu \,dS,
$$
where $\nu$ is the outward unit normal to the boundary. The curl integration by parts formula is:
$$
\int_{\Omega}\nabla \cdot (\phi\times \psi) = \int_{\Omega}(\psi\cdot\nabla \times  \phi - \phi\cdot \nabla\times \psi) = \int_{\partial \Omega} \phi\times \psi\cdot \nu \,dS = \int_{\partial \Omega} \nu\times \phi\cdot \psi \,dS.\tag{1}
$$
Say now you wanna minimize (here I use $u$ and $v$ instead of $f$ and $h$):
$$
\mathcal{G}(v) = \int_{\Omega}|\nabla\times v|^2\,dx,
$$
if the minimizer is $u$ and the variational limit is also no problem:
$$
0= \frac{d}{d\epsilon}\mathcal{G}(u+\epsilon v)\Bigg|_{\epsilon= 0} = 2\int_{\Omega} \nabla \times u\cdot \nabla \times v.
$$
Now we use formula (1), letting $\phi = \nabla \times u$, and $\psi = v$:
$$
\int_{\Omega}(v\cdot\nabla \times (\nabla \times u)- \nabla \times u\cdot \nabla\times v) =\left\{\begin{aligned} \int_{\partial \Omega} \big(\nu\times (\nabla \times u)\big)\cdot v\,dS 
\\
\\
 \int_{\partial \Omega} (v\times \nu) \cdot (\nabla \times u)\,dS
\end{aligned}\right.
$$
There are two choices of way of writing boundary terms to be zero:


*

*You can set for the minimizer $\color{blue}{\nu\times (\nabla \times u)|_{\partial \Omega} = 0}$, and only tangential part suffices. $\nabla \times u|_{\partial \Omega = 0}$ is too strong.

*You can set for the test function spaces $\color{red}{\nu\times v = 0}$, then $\nu \times u$ can be prescribed as any permissible boundary data $g$ (those who have 0 surface divergence). 
Choosing blue, you have to modular a gradient in a proper function space $H$ to set up a well-defined problem:
$$
\left\{\begin{aligned} 
\nabla\times (\nabla \times u) &=0 \quad \text{ in } \Omega,
\\
\nu \times (\nabla \times u) &= 0\quad \text{ on } \partial \Omega. 
\end{aligned}\right.\tag{2}
$$
For $u \in H/\nabla p$ the quotient space, which means we don't tell the difference between $u $ and $u+\nabla p$, above problem has a unique solution. The only solution for (2) is zero, a.k.a. $u = 0$ or say $u = \nabla p$. Once we add a gauge condition $\nabla \cdot u = f$, then (2) is equivalent to the Neumann problem for $p$:
$$
\left\{\begin{aligned} 
\Delta p &= f \quad \text{ in } \Omega,
\\
\nabla p\cdot \nu &= 0\quad \text{ on } \partial \Omega. 
\end{aligned}\right. 
$$
Choosing red, the problem is:
$$
\left\{\begin{aligned} 
\nabla\times (\nabla \times u) &=0 \quad \text{ in } \Omega,
\\
\nu \times u &= g\quad \text{ on } \partial \Omega. 
\end{aligned}\right.\tag{3}
$$
Again this problem has a unique solution in $H/\nabla p$, except this time $p$ is constant on the boundary which implies $\nabla p\times \nu =0$. If we set $g$ to be 0, then above problem again has a zero solution, which means $u = \nabla p$. Now a gauge condition $\nabla \cdot u = f$, then (3) can be transformed to a Dirichlet boundary problem for $p$:
$$
\left\{\begin{aligned} 
\Delta p &= f \quad \text{ in } \Omega,
\\
p &= \mathrm{Constant}\quad \text{ on } \partial \Omega. 
\end{aligned}\right. 
$$

Summary: the minimizer $u = \mathrm{arg}\min\mathcal{G}(v)$ is a gradient field $\nabla p$, the boundary condition of $p$ relies on the boundary condition of $u$. Both problem (2) and (3) don't require the normal component of $\nabla \times u$ or $u$ to be imposed. If you prescribe $\nabla\times u = 0$ on the boundary, which implies $\nabla\times u\cdot \nu = 0$, the problem may be over-determined.
A: (This is supposed to be a shorter comment but I find myself powerless).
I haven't checked you reasoning, but I wanted to offer a simple (standard) proof. Some authors call this Dirichlet's principle.
Define $E(f) := \int_{\Omega} \| \nabla f \|^2 dx$. 
It's clear that $E(f) \geq 0$. 
Assume $f, g$ are equal on $\partial \Omega$
Let's see that, if $f$ is harmonic then $E(f) \leq E(g)$. 
For that, let $u := f - g$. Now calculate $E(g) = E(f - u)$ using Green's first identity (here you'll use that $u = 0$ on $\partial \Omega$ and that $\Delta f = 0$).
You'll get immediately that $E(g) = E(f) + E(u)$ , and using that $E(u) \geq 0$ that $E(f) \leq E(g)$. 
