zero gradient /open boundary condition

Hi everyone,

I have been trying to create on open exit boundary in my matlab code. I have looked at the paper on Neumann/Dirchlet boundary conditions and tried all kinds but have had no success so far.

My mesh velocity directions are…

% 8 4 7
% \ | /
% \ | /
% \ | /
% 1 <-------o-------> 3
% / |
% / |
% / |
% 5 2 6

f3(:,N)=f3(:,N-1);
f6(:,N)=f6(:,N-1);
f7(:,N)=f7(:,N-1);

and so i have been trying boundary conditions such as those just above based on what i have read on the Neumann boundary condition about creating a ghost and having the same velocities at these nodes (N-1) and the boundary nodes (N). If anbody has any help or ideas then i would really appreciate it.

Thanks. James.

Hello,

what do you mean by “no success so far”? What is the numerical setup? What are you trying to simulate?

One thing I can say for sure is that this boundary condition is not correct for von Neumann BC.

f3(:,N)=f3(:,N-1);
f6(:,N)=f6(:,N-1);
f7(:,N)=f7(:,N-1);

What you have to you a “normal” BC (Zou/He, Inamuro, Regularized, …) but with a velocity that will give you the zero gradient desired. One possibility is just to copy your last nodes velocity from the preceding cell. The accuracy of this is first order in space, but it is easier to implement.

I am trying to simulate fluid flow for a dam break situation. At the moment, as the fluid propagates from left to right, when it hits the right hand boundary, it always reflects back into the domainand this is what im trying to change. That is why i am trying to create an open right hand exit boundary, so once the simulation runs, the fluid will flow completey out. To make the last nodes velocity the same as that at the preceding cell i was trying to use code as above like f3(:,N)=f3(:,N-1);.

My initial setup is…

cx=[0,1,0,-1,0,1,-1,-1,1]; % Velocity components
cy=[0,0,1,0,-1,1,1,-1,-1];
cc=cx.*cx+cy.*cy;
fstar=[4/9,1/9,1/9,1/9,1/9,1/36,1/36,1/36,1/36]; % weights

e=15.0; % lattice link velocity
dt=dx/e; % LBM time step
rho_l=+2.0/dx; % height left
rho_r=+2.0/dx; height right
g=9.81dt^2/dx; % gravitational acceleration
eta=0.012
dx^(1/3)/dt; % Manning’s coefficient [s/m^(1/3)]
qx_l=dx10dt/dx^2; % discharge in x and y
qy_l=0;

M=50; % Mesh size
N=125*gridscale+1; %
dx=25/(N-1); %length of link

and this is what i have for the fluid initial conditions… (rho is fluid height)

rho=(rho_l+rho_r)/2ones(M,N)-z; % z is height of the durface fluid flows over
rho= 10
ones(M,N);
rho(find(x>10))=5;

Thanks very much for your help. James.

Ok but if you just copy f3(:,N)=f3(:,N-1); (and f6 and f7) what about the missing f’s (1,8,5) on the N-th cell?

What I mean by that is what kind of BC are you using on this last cell?

The usual way of doing a von neumann BC is to us a no slip BC and to impose a well chosen velocity on the cell. Do you understand what I mean?

So would a Neumann boundary condition be something like this…

f3(;,N)=f1(:,N-1)
f6(;,N)=f8(;,N-1)
f7(:,N)=f5(:,N-1)

???

I thought that as it only these 3 velocities that are unknown at the right hand boundary, i do not need to include conditions for f’s(1,8 and 5) at this boundary? What do you mean by a well chosen velocity? I have got Zhou’s literature and i have been trying to implement what he discusses about inflow and outflow boundary conditions.

When i run my code and do not include any right hand boundary conditions, i still get behaviour of the fluid as if there was a closed boundary the right hand side, which makes me think there may be something ‘hidden’ within the code outside the boundary conditions having some effect.

Thanks for youe help.

No, you should not do soemthing like

f3(;,N)=f1(:,N-1)
f6(;,N)=f8(;,N-1)
f7(:,N)=f5(:,N-1)

You should use a standard BC (Zou/He’s for example, see here for example) and then impose the VELOCITY of the N-1-th cell on the N-th.

The difference between the Neumann and Dirichlet BC is the velocity you will impose on the wall. In the second case the velocity is known a priori, but in the second one you have to impose the velocity depending on the preceding cells in order to get the zero gradient velocity. Is that clear?

Maybe you can have a look here for more detailed informations.