It's Dirichlet boundary condition. The quantities at domain boundaries will take either the same value as its inner neighbor or the negated value, depending on the condition $\mathbf{b}$. Take velocity field for instance, velocity of fluid will either gets reflected($\mathbf{b}==1||\mathbf{b}==2$)or or not change ($\mathbf{b}!=1\&\&\mathbf{b}!=2$) at domain boundary. The condition $\mathbf{b}$ is a user option, $\mathbf{b}==1$ is used to set reflected values at the horizonal boundaries, and $\mathbf{b}==2$ is to set reflected values at vertical boundaries, and $\mathbf{b}$ of other values are used. To be more clear:
- $\mathbf{b}==1$: field values at horizonal boundaries get reflected, field values at vertical boundaries do not change.
- $\mathbf{b}==2$: field values at vertical boundaries get reflected, field values at horizonal boundaries do not change.
- $\mathbf{b}== other\ value$: field values at neither vertical nor horizonal boundaries do not change.
set_bnd could be called multiple times to indicate fieldset desired boundary values won't change for both horizonal and vertical boundaries.