I wanted to solve a periodic elliptic equation of the form $$-\nabla\cdot(A\nabla u)=-\nabla\cdot F$$ on $Y=[0,2\pi)^d$ using FreeFem++, where $A$ and $F$ are $Y$-periodic. The space of solutions is $H^1_{per}(Y)/\mathbb{R}$, which can also be seen as the space of periodic $H^1$ functions with zero mean. How does one typically impose the zero mean condition in FEM?


1 Answer 1


There are two approaches to solve this.

The first approach is given by Lagrange multipliers and is well explained here. You have to solve an extended linear system where you impose the solution to be zero-mean.

The second approach, which may be easier, is to modify the system so that one nodal value inside the domain is clamped to zero, i.e., you impose $u_{i^*} = 0$ for some index $i^*$, where $\mathbf{u} = (u_1, \ldots, u_N)^\top$ is the vector of nodal values of your discrete solution $u_h$. This is obtained by replacing an equation $u_{i^*} = 0$ on the $i^*$-th line of your FEM linear system. Then, your final solution $u_h$ is obtained as $$ u_h \leftarrow u_h - \frac{1}{|Y|}\int_{Y} u_h, $$ where $|Y| = (2\pi)^d$, which is trivially zero-mean.

  • $\begingroup$ I do not get why the second method leads to zero mean solution? is this enforced in the strong sense? $\endgroup$
    – kstn
    Commented Feb 5 at 22:52
  • $\begingroup$ $\int_{Y} \left(u_h - \frac{1}{|Y|}\int_{Y} u_h \right) = \int_Y u_h - \int_Y u_h = 0$ $\endgroup$
    – G. Gare
    Commented Feb 6 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.