How to solve $\nabla\cdot F= 0$ with boundary condition? I want to find the solution to $\nabla\cdot\vec{F} = 0$ on a domain $\Omega \subset \mathbb{R}^n$. I know the value of $\vec{F}$ at the boundary $\partial \Omega$. I am looking for a way to find an explicit expression for $\vec{F}$ in terms of its boundary values. I think of a formula like:
$$\vec{F}(\vec{x}) = \int_{\partial \Omega} d\vec{\sigma} G(\vec{x},\vec{\sigma}) \vec{F}(\vec{\sigma})$$,
Where $G$ is some function (possibly matrix valued). Is such an expression known?
 A: An ill-posed problem ...
At least in three dimensions, an $F$ satisfying
$\operatorname{div} F = 0$ in $\Omega$ and with specified values
on $\partial\Omega$ isn't necessarily unique. If $F$ is any solution, then
$F + \operatorname{curl}A$ is also a solution whenever
$\operatorname{curl}A = 0$ on $\partial\Omega$.
To see that such $A$s exist, take the simple case of $\Omega$ being
the unit ball, and $A$ having the form in spherical coordinates
\begin{equation}
 A(r,\theta,\phi) := A_r(r){e}_r(r, \theta, \phi) +  A_\theta(r){e}_\theta(r, \theta, \phi) + A_\phi(r){e}_\phi(r, \theta, \phi).
\end{equation}
Then
\begin{equation}
 \operatorname{curl}A(r, \theta, \phi) =
 - {e}_\theta(r,\theta,\phi) (r A_\phi(r))'/r
 + {e}_\phi(r,\theta,\phi)(r A_\theta(r))'/r
\end{equation}
where primes denote differentiation with respect to $r$.
Leaving $A_r(r)$ arbitrary, take $A_\theta(r) = \alpha - \alpha r/2$ and $A_\phi(r) = \beta - \beta r/2$
to get $A$ whose $\operatorname{curl}$ vanishes on the boundary $r = 1$.
Think how you might add additional constraints, for example the solution minimizing $\int_\Omega\,\vert F\vert^2\, dx$?
A: If ${\rm div} F=0$ the divergence theorem gives  $$\int F\cdot n ds=0$$
on the boundary.
For example in the square $[0,1]^2$ with $F(x,y)=(x,y)$ on the boundary, there is no solution, while the problem with $F(x,y)=(y,x)$ on the boundary has solution $(y,x)$.
When the necessary condition holds, I don't know what the answer is.
