# Questions on the steay stokes equation with Dirchlet boundary conditions

**URL:** <https://community.freefem.org/t/questions-on-the-steay-stokes-equation-with-dirchlet-boundary-conditions/2105>\
**Category:** General Discussion\
**Created:** [November 5, 2022, 1:23pm UTC](https://community.freefem.org/t/questions-on-the-steay-stokes-equation-with-dirchlet-boundary-conditions/2105 "2022-11-05T13:23:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhugp123](https://avatars.discourse-cdn.com/v4/letter/z/71e660/32.png) [@zhugp123](https://community.freefem.org/u/zhugp123)\
**Post date:** [November 5, 2022, 1:23pm UTC](https://community.freefem.org/t/questions-on-the-steay-stokes-equation-with-dirchlet-boundary-conditions/2105/1 "2022-11-05T13:23:22Z")

</div>

![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/0/062e928c998a93acfffcba699de379789443adf5.png)

Hi, I try to solve the above steady stokes equation with Dirichlet boundary conditions in the matrix form (Ax = b).

The vector b is implemented as

> fespace Xh(Th, [P2, P2, P1]);  
> fespace Vh(Th, P2), Qh(Th, P1);  
> Vh u, v, c;  
> Qh p;  
> real delta = 0.8;  
> func rad = sqrt(x^2+y^2);  
> c = 1/rad - delta\*y/rad^2;  
> macro usx() dx(c)-( dx(c)\*N.x+dy(c)\*N.y )\*N.x //  
> macro usy() dy(c)-( dx(c)\*N.x+dy(c)\*N.y )\*N.y //  
> varf bcl( [u, v, p], [uu, vv, pp] ) = on(C1, u=usx, v=usy) + on(C2, u=0, v=0);  
> real[int] b = bcl(0, Xh);

I can not obtain correct results using the above codes. I also try the following codes:  
(1)

> macro usx(c) dx(c)-( dx(c)\*N.x+dy(c)\*N.y )\*N.x //  
> macro usy(c) dy(c)-( dx(c)\*N.x+dy(c)\*N.y )\*N.y //

(2)

> func usx = dx(c)-( dx(c)\*N.x+dy(c)\*N.y )\*N.x;  
> func usy = dy(c)-( dx(c)\*N.x+dy(c)\*N.y )\*N.y;

but none of them can give the desired results.

I would appreciate it if anyone could give me some suggestions on how to implement the Dirichlet boundary conditions. thanks in advance.
