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.
problem PHI(phi,q)=
int2d(Th)(dt*(dx(phi)*dx(q)+dy(phi)*dy(q)))
+intalledges(Th)(dt*(nTonEdge-1)*(dx(phi)*N.x+dy(phi)*N.y)*jump(q)/nTonEdge)
+intalledges(Th)(dt*(nTonEdge-1)*(dx(q)*N.x+dy(q)*N.y)*jump(phi)/nTonEdge)
+intalledges(Th)(dt*(nTonEdge-1)*(pena1/lenEdge)*jump(phi)*jump(q))
-int2d(Th) (eps*phi*q)
This is a portion of the code I am working on. Here phi and q belong to M_h0 space; I have added that term I mentioned earlier but didn’t get the part where you said to subtract it’s average value. And I also think we need to do it for q also, right?
I thought that you were dealing with a Stokes like problem, but it is not the case.
For your problem, you simply put
+int2d(Th) (eps*phi*q)
with a “+” sign, it gives directly your solution phi with vanishing integral.
There is nothing to modify for q, because adding a constant to q encodes the property that \int\phi=0.