# How do we implement the symmetry condition?

**URL:** <https://community.freefem.org/t/how-do-we-implement-the-symmetry-condition/2910>\
**Category:** General Discussion\
**Created:** [January 26, 2024, 3:50am UTC](https://community.freefem.org/t/how-do-we-implement-the-symmetry-condition/2910 "2024-01-26T03:50:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@Jack](https://community.freefem.org/u/Jack)\
**Post date:** [January 26, 2024, 3:50am UTC](https://community.freefem.org/t/how-do-we-implement-the-symmetry-condition/2910/1 "2024-01-26T03:50:47Z")

</div>

Hello, everyone, I would like to ask a question. I solve the Stokes equation in a channel, the boundary conditions are as follows

 ![1706241434006](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/b/bb319e008d445834171da5d5e816d32f6c24852b.png)

There is a symmetry condition on the bottom boundary, how to implement this boundary condition? The symmetry condition looks like a combination of Dirichlet and Neumann boundary conditions.

This problem confuses me a lot, can anyone give me some suggestions on implementing the symmetry condition? I would appreciate any help you give me.

The minimum code

```auto
mesh Th=square(50,10,[5*x,y]); 
plot(Th); 
fespace Vh(Th,P2); 
fespace Ph(Th,P1); 

Vh u1,u2,v1,v2;
Ph p,q;
 
macro Eps(u,v) [dx(u),dy(v), (dx(v)+dy(u))*0.5, (dx(v)+dy(u))*0.5] // 
macro div(u1,u2) (dx(u1)+dy(u2) ) // 

func pin=10000.0;
func pout=0.0;

solve Stokes( [u1,u2,p],[v1,v2,q] ) =
int2d(Th) ( 2*Eps(u1,u2)'*Eps(v1,v2) - div(v1,v2)*p -div(u1,u2)*q)
+int1d(Th,4)(pin*(v1*N.x+v2*N.y))+int1d(Th,2)(pout*(v1*N.x+v2*N.y))
+ on(3,u1=0,u2=0)
+ on(1,u2=0, dy(u1)=0;); //How to implement the symmetry condition ???

plot(p,fill=1);

```

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [January 26, 2024, 12:41pm UTC](https://community.freefem.org/t/how-do-we-implement-the-symmetry-condition/2910/2 "2024-01-26T12:41:08Z")

</div>

It should be enforced naturally due to the neglect of the boundary term arising  
via integration by parts.

`on(1,u2=0);`

---

<div class="post-metadata">

**Author:** ![Mr.Good](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mr.good/32/382_2.png) [@Mr.Good](https://community.freefem.org/u/Mr.Good)\
**Post date:** [February 2, 2024, 1:59pm UTC](https://community.freefem.org/t/how-do-we-implement-the-symmetry-condition/2910/3 "2024-02-02T13:59:33Z")

</div>

Continuing the discussion from [How do we implement the symmetry condition?](https://community.freefem.org/t/how-do-we-implement-the-symmetry-condition/2910/2):

> [@Jack](#):
>
> `+ on(1,u2=0); // no need to mention the dy(u1)=0, because at \*\*(1,u2=0)\*\*this means that at 1 your dy(u1)=0.
