I’m trying to simulate -lapl(u)=0 over a square, with a zero dirichlet condition on the sides of the square.

However, I would also like to force the value of the integral over the whole domain of u to be equal to Q, but I couldn’t find anything to do this kind of thing.

Do you have any pointers on how to do this?

I thought about using another test function q and write the weak formulation as int2d(Th) (dx(u)*dx(v)+dy(u) dy(v) + uq) - Q*q but it doesn’t seem like freefem can let me do that (although, from theory alone, I assumed you could have a linear functional that doesn’t require an integral inside).