# Homogeneous neumann boundary condition in hydrodynamic stability

**URL:** https://community.freefem.org/t/homogeneous-neumann-boundary-condition-in-hydrodynamic-stability/2927
**Category:** General Discussion
**Created:** [February 2, 2024, 3:58pm UTC](https://community.freefem.org/t/homogeneous-neumann-boundary-condition-in-hydrodynamic-stability/2927 "2024-02-02T15:58:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Amitkaush](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/amitkaush/32/1978_2.png) [@Amitkaush](https://community.freefem.org/u/Amitkaush)
#### Post date: [February 2, 2024, 3:58pm UTC](https://community.freefem.org/t/homogeneous-neumann-boundary-condition-in-hydrodynamic-stability/2927/1 "2024-02-02T15:58:48Z")

</div>

I am new to FreeFem++. I am trying to solve for temporal hydodynamic stability of viscous incompressible navier stokes equation for Couette flow.  
I have homogeneous neumann boundary condition on pressure on the wall.  
here is the code:

complex I = 1i;

real Re;  
cout\<\<“Enter Reynold’s number”\<\<endl;  
cin\>\>Re;  
real om,alp,bet;  
// defining the type of stability problem

int a,b;  
cout\<\<“Enter 1 for spatial stability and 2 for temporal stability\n”\<\<endl;  
cin\>\> a;

if(a==1)  
{  
cout\<\<“Enter wave frequency\n”\<\<endl;  
cin\>\>om;}  
else{  
cout\<\<“Enter streamwise wave number\n”\<\<endl;  
cin\>\>alp;  
cout\<\<“Enter spanwise wave number\n”\<\<endl;  
cin\>\>bet;}  
mesh Th;  
int m=500;  
Th=square(1,m);  
plot(Th,wait=1);

fespace Vh(Th,P2,periodic=[[2,y],[4,y]]);  
fespace Mh(Th,P1,periodic=[[2,y],[4,y]]);  
fespace Gh(Th,[P2,P2,P2,P1]);  
Vh W,u,v,w,a2,a3,Wy,a1;  
Mh a4,p;  
W=y;

Wy=1;

matrixA1;  
matrix B1;

```
              varf A([u,v,w,p],[a1,a2,a3,a4])=int2d(Th)(a1*(I*bet*W+(alp^2+bet^2)/(Re))*u-(1/Re)*dy(a1)*dy(u)+a1*(I*alp)*p+
                                                         a2*(I*bet*W+(alp^2+bet^2)/(Re))*v-(1/Re)*dy(a2)*dy(v)+a2*dy(p)+
                                                         a3*v*Wy+a3*(I*bet*W+(alp^2+bet^2)/(Re))*w-(1/Re)*dy(a3)*dy(w)+a3*I*bet*p
                                                         +a4*I*alp*u+a4*dy(v)+a4*I*bet*w
                                                         )+on(1,2,3,4,u=0,v=0,w=0);
                                                         
                                                         
              varf B([u,v,w,p],[a1,a2,a3,a4])=int2d(Th)(a1*I*u+a2*I*v+a3*I*w); 
              
              
              
                A1=A(Gh,Gh);
               B1=B(Gh,Gh);
              ofstream file("A1.csv");

```

for (int i = 0; i \< A1.m; i++) {  
for (int j = 0; j \< A1.n; j++) {  
if(imag(A1(i,j))\>0){file\<\<real(A1(i,j))\<\<“+”\<\<imag(A1(i,j))\<\<“i”;}  
else{file\<\<real(A1(i,j))\<\<imag(A1(i,j))\<\<“i”;}  
if (j \< A1.m - 1) {  
file\<\< “,”;  
}  
}  
file \<\< endl;  
}

```
       ofstream file1("B1.csv");

```

for (int i = 0; i \< B1.n; ++i) {  
for (int j = 0; j \< B1.m; ++j) {  
if(imag(B1(i,j))\>0){file1\<\<real(B1(i,j))\<\<“+”\<\<imag(B1(i,j))\<\<“i”;}  
else{file1\<\<real(B1(i,j))\<\<imag(B1(i,j))\<\<“i”;}  
if (j \< B1.m - 1) {  
file1\<\< “,”;  
}  
}  
file1\<\< endl;  
}  
While importing the matrices in MATLAB to solve for eigen values i am not getting the result.  
Can you help me to find where I have gone wrong?
