# boundary conditions

Hi,

I thought that for bounce back boundary conditions yo simply assign the opposite distribution function at that boundary. But in this code i have looked at, it assigns the opposite forcing function rather than the distribution function as shown below? Can somebody explain to me why this is so?

f4(M,1:N)=F2(M,1:N);
f7(M,1:N)=F5(M,1:N);
f8(M,1:N)=F6(M,1:N);
% bottom: bounce back, no-slip
f2(1,1:N)=F4(1,1:N);
f5(1,1:N)=F7(1,1:N);
f6(1,1:N)=F8(1,1:N);

I am also having similar confusion with neumann boundary condition…

% right: Neumann
f3(1:M,N)=F1(1:M,N)-2fstar(4)/cs2(cx(4)u(1:M,N-1)+cy(4)v(1:M,N-1));
f7(1:M,N)=F5(1:M,N)-2
fstar(8)/cs2
(cx(8)u(1:M,N-1)+cy(8)v(1:M,N-1));
f6(1:M,N)=F8(1:M,N)-2
fstar(7)/cs2
(cx(7)*u(1:M,N-1)+cy(7)*v(1:M,N-1));

Thanks. James.

Hi,
I don’t know the code you are mentioning, but are you sure that “F” stands for “forcing function”? I’d say that a compelling interpretation of the code would be something akin to f=“outgoing populations”, and F=“incoming populations”.

The Neumann boundary is pretty hard to understand without further explanations. Actually, the code rather resembles a bounce-back algorithm with momentum correction, which leads to a Dirichlet boundary condition (not Neumann).

Thanks for your help. That now makes more sense.

Isnt the Dirichlet condition used to try and create a Neumann boundary condition?