# Boundary conditions

Hi Dear All,
I post here some boundary conditions like (periodic boundary, symmetry boundary and bounceback boundary conditions). I writte these boundary condtions for the flow past a circular cylinder. I need some suggestions from any one that the way that i write these boundary conditions it’s correct or not (i mean can i do some mistake in such a coding). Thanks in advance

// symmetric bc: j=1 and NY-2 is the symmetry lines.
void bc_symmetry()
{
int i;
for(i=0;i<=NX-1;i++){
f_1[i][0][2] = f_1[i][2][4];
f_1[i][0][5] = f_1[i][2][8];
f_1[i][0][6] = f_1[i][2][7];
// f_1[i][0][0] = f_1[i][2][0];
// f_1[i][0][1] = f_1[i][2][1];
// f_1[i][0][3] = f_1[i][2][3];
// f_1[i][0][4] = f_1[i][2][2];
// f_1[i][0][7] = f_1[i][2][6];
// f_1[i][0][8] = f_1[i][2][5];

``````    f_1[i][NY-1][4] = f_1[i][NY-3][2];
f_1[i][NY-1][7] = f_1[i][NY-3][6];
f_1[i][NY-1][8] = f_1[i][NY-3][5];
``````

// f_1[i][NY-1][0] = f_1[i][NY-3][0];
// f_1[i][NY-1][1] = f_1[i][NY-3][1];
// f_1[i][NY-1][2] = f_1[i][NY-3][4];
// f_1[i][NY-1][3] = f_1[i][NY-3][3];
// f_1[i][NY-1][5] = f_1[i][NY-3][8];
// f_1[i][NY-1][6] = f_1[i][NY-3][7];
}
}

//periodic boundary condition
void bc_periodic()
{
int i;
for(i=0;i<=NX-1;i++){

``````	f_1[i][0][2] = f_1[i][NY-2][2];
f_1[i][0][5] = f_1[i][NY-2][5];
f_1[i][0][6] = f_1[i][NY-2][6];

f_1[i][NY-1][4] = f_1[i][1][4];
f_1[i][NY-1][7] = f_1[i][1][7];
f_1[i][NY-1][8] = f_1[i][1][8];
}
``````

}

//bounce-back boundary condition for wall(channel) between 0 and 1 or between NY-2 and NY-1
void bc_bounceback()
{
int i;
for(i=0;i<=NX-2;i++){
f_1[i][0][5] = f_1[i+1][1][7];
f_1[i][NY-1][8] = f_1[i+1][NY-2][6];
}
for(i=1;i<=NX-2;i++){
f_1[i][0][2] = f_1[i][1][4];
f_1[i][NY-1][4] = f_1[i][NY-2][2];
}
for(i=2;i<=NX-1;i++){
f_1[i][0][6] = f_1[i-1][1][8];
f_1[i][NY-1][7] = f_1[i-1][NY-2][5];
}
}