# Non-zero dirichlet BC on Stokes Eigenvalue problem

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,

``````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]);
}
``````

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.