I am looking at demo_neumann-poisson.py (#13 from the Documented DOLFIN demos), which solves a Neumann boundary-value problem for the Laplace operator over the unit square. I would like to ask the following two questions:
1) After reading the verbal description of the demo and carefully studying the variational formulation over $V \times \mathbb{R}$, I am left with the impression that the function $u$ which is plotted by demo_neumann-poisson.py is the unique member of $V$ which solves
\begin{eqnarray}
-\Delta u = f - c \text{ in } \Omega, \
\partial_n u = g \text{ on } \partial \Omega, \
\int_\Omega u \, dx \, dy = 0,
\end{eqnarray}
where $\Omega := [0,1]\times [0,1]$ and
\begin{equation}
c := \underbrace{\frac{1}{|\Omega|}}_{=1} \left[ \int_\Omega f\, dx + \int_{\partial \Omega} g \, ds \right].
\end{equation}
Could you confirm if my understanding is correct?
2) How can I impose a Neumann boundary condition $g = g(x,y)$ such as
\begin{equation}
g(0, y) := 1,\ g(1,y) := -1 \text{ for all } |y| \leq 1,
\end{equation}
\begin{equation}
g(x, 0) := 0,\ g(x, 1) := 0 \text{ for all } |x| \leq 1,
\end{equation}
in a FEniCS program?