How to use mean-zero pressure space in FreeFem


It will be very helpful if anyone can explain how to use mean-zero pressure space in Free Fem. I am talking about the space M_h0 in the attached file.

You have to use a constraint and a Lagrange multiplier,
as in Error convergence on Stokes problem
The Lagrange multiplier \lambda is a constant in space, and \mu is the associated test constant, that sets the constraint. To do it correctly you have to define a block matrix as in the FreeFem doc p.671 “Lagrange Multipliers”.

Is there any other way of doing it, without defining a block matrix?, like adding -int2d(Th)(eps p q) where eps=1e-6.

Yes, this determines a unique pressure, in a stable way. But it is not equivalent to setting \int p=0. The two methods give two pressures p_1 and p_2, such that p_2-p_1=cst\not=0.
If you like you can then subtract to the pressure its average value, so that you get a pressure with vanishing integral at the end.