# Forcing the value of the integral of the solution

**URL:** https://community.freefem.org/t/forcing-the-value-of-the-integral-of-the-solution/794
**Category:** General Discussion
**Created:** [February 10, 2021, 10:12pm UTC](https://community.freefem.org/t/forcing-the-value-of-the-integral-of-the-solution/794 "2021-02-10T22:12:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![LeonardoDipilato](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/leonardodipilato/32/361_2.png) [@LeonardoDipilato](https://community.freefem.org/u/LeonardoDipilato)
#### Post date: [February 10, 2021, 10:12pm UTC](https://community.freefem.org/t/forcing-the-value-of-the-integral-of-the-solution/794/1 "2021-02-10T22:12:20Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [February 11, 2021, 6:55am UTC](https://community.freefem.org/t/forcing-the-value-of-the-integral-of-the-solution/794/2 "2021-02-11T06:55:46Z")

</div>

Use [this](https://github.com/FreeFem/FreeFem-sources/blob/master/examples/tutorial/Laplace-lagrange-mult.edp) script, replace `b1` by `Q`, and put your Dirichlet BC in `va` and `vL`.
