Consider a Neumann-Poisson problem. \begin{align*} -\Delta u & = f \ \mathrm{in}\ \Omega\\ \frac{\partial u}{\partial\nu} & = g \ \mathrm{on}\ \partial\Omega \end{align*} Then $u$ is uniquely defined only up to an additive constant, i.e. if $u$ is a solution, $\tilde u = u+c$, $c\in\mathbb R$ is a solution, too.
To get a unique solution we introduce the constraint $\int_\Omega u dx =0$. Now I want to do a Finite Element discretization for this problem and I have problems introducing the constraint.
The variational formulation of the PDE reads:
Find $u\in H^1(\Omega)$ such that $$\int\nabla u\nabla\varphi d x = \int_\Omega f\varphi dx + \int_{\partial\Omega} g\varphi d\sigma\qquad \forall \varphi\in H^1(\Omega)$$
I read that using Lagrange multipliers I can introduce the constraint by
Find $\lambda\in\mathbb R$ such that $$c\int_\Omega udx = \lambda\int_\Omega \varphi dx \qquad\forall \varphi\in H^1(\Omega), c\in\mathbb R$$
but I am completely clueless as to why this is a variational formulation of the constraint.
Can anyone help me with this? Or point me in another direction on how to introduce the constraint? Thanks!
The standard way to impose the mean-value zero condition is to modify the weak formulation as follows: $$(\nabla u, \nabla v) + \epsilon (u,v) = (f,v) + \langle g,v \rangle,$$ where $\epsilon$ is a small positive number, $$(a,b):= \int_\Omega a \cdot b \,\mathrm{d}x,$$ and $$\langle a,b \rangle:= \int_{\partial \Omega} a \cdot b \,\mathrm{d}s.$$ To see that this gives mean-value zero, substitute $v=1$ to get $$\epsilon (u,1) = (f,1) + \langle g,1 \rangle = 0,$$ where the right-hand side is zero due to the combatibility condition of $f$ and $g$ (i.e., Newton's second law in every physically-interpretable problem). Thus, you get $$(u,1)=0,$$ which is exactly what you want. In practice, you want to try out different values for $\epsilon$. In theory, it should be chosen such that $\epsilon = Ch$ where $C$ is some positive constant.