# Non-zero dirichlet BC on Stokes Eigenvalue problem

**URL:** <https://community.freefem.org/t/non-zero-dirichlet-bc-on-stokes-eigenvalue-problem/3209>\
**Category:** General Discussion\
**Created:** [May 3, 2024, 10:10am UTC](https://community.freefem.org/t/non-zero-dirichlet-bc-on-stokes-eigenvalue-problem/3209 "2024-05-03T10:10:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![djahid](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@djahid](https://community.freefem.org/u/djahid)\
**Post date:** [May 3, 2024, 10:10am UTC](https://community.freefem.org/t/non-zero-dirichlet-bc-on-stokes-eigenvalue-problem/3209/1 "2024-05-03T10:10:57Z")

</div>

Hello,  
I’m having trouble trying to impose non-zero boundary conditions on the Stokes Eigenvalue problem using the **on()** function.  
The solution is always the same no matter what values I set the **Ux** and **Uy** variables in the **on()** function.

Is there a different way I should approach this if i want to have non-zero values?

Thank you very much for your help,

```auto
mesh Th = square(10, 10);
fespace Xh(Th, P2);
fespace Mh(Th, P1);
fespace XhxXhxMh(Th, [P2, P2, P1]);

Xh Ux, Uy;
Xh Uhx, Uhy;

Mh p;
Mh ph;

real pEps = 0.000001;
real nu = 1;

varf Stokes ([Ux, Uy, p], [Uhx, Uhy, ph])
    = int2d(Th)(
          nu * (dx(Ux)*dx(Uhx) + dy(Ux)*dy(Uhx)
                + dx(Uy)*dx(Uhy) + dy(Uy)*dy(Uhy))
          + p*ph * pEps
          - p*dx(Uhx) - p*dy(Uhy)
          - dx(Ux)*ph - dy(Uy)*ph
    )
    + on(1, 2, 3, 4, Ux=0, Uy=0); // Solution doesn't change when the Ux and Uy values change to non-zero

varf b([Ux, Uy, p], [Uhx, Uhy, q]) = int2d(Th)(Ux * Uhx + Uy * Uhy);

real sigma = 0;
int nev = 1;
real[int] ev(nev);
XhxXhxMh[int] [eUx, eUy, ep](nev);

matrix A = Stokes(XhxXhxMh, XhxXhxMh);
matrix B = b(XhxXhxMh, XhxXhxMh);

int k = EigenValue(A, B, sym=true, sigma=sigma, value=ev, vector=eUx);
k = min(k, nev);

for (int i = 0; i < k; i++) {
    cout << "Eigen Value" << i << " : " << ev[i] << endl;
    Ux = eUx[i];
    Uy = eUy[i];
    p = ep[i];

    // Plot
    plot([Ux, Uy], p, dim=3, fill=1, cmm="Eigen Vector " + i + " Value =" + ev[i]);
}

```

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [May 4, 2024, 6:59am UTC](https://community.freefem.org/t/non-zero-dirichlet-bc-on-stokes-eigenvalue-problem/3209/2 "2024-05-04T06:59:09Z")

</div>

Yes, but remember what is a eigenvalue and eigenvector : it is a element of vector space so the boundary condition must be zero otherwise it is not a vector space.
