📄 bcs.c
字号:
//##############################################################################//// bcs.c//// - Boundary conditions.//void bcs( lattice_ptr lattice){ int n; int *bc; double *ftemp; double u_x, u_y, rho; bc = &( lattice->bc[0].bc_type); ftemp = lattice->pdf[0].ftemp; for( n=0; n<lattice->NumNodes; n++) { if( *bc != 0 && *bc != BC_SOLID_NODE) { if( *bc & BC_PRESSURE_N_IN ) { // North, Inflow//printf("bcs() -- North, Inflow at n = %d, ( %d, %d)\n", // n, lattice->node[n].i, lattice->node[n].j);//printf(" Before>> %f %f %f %f [%f] %f %f [%f] [%f]\n",// ftemp[0], ftemp[1], ftemp[2],// ftemp[3], ftemp[4], ftemp[5],// ftemp[6], ftemp[7], ftemp[8] ); u_y = -1. + ( ftemp[0] + ftemp[1] + ftemp[3] + 2.*( ftemp[2] + ftemp[5] + ftemp[6])) / lattice->param.rho_in; ftemp[4] = ftemp[2] - (2./3.)*lattice->param.rho_in*u_y; ftemp[7] = ftemp[5] + (1./2.)*( ftemp[1] - ftemp[3]) - (1./6.)*lattice->param.rho_in*u_y; ftemp[8] = ftemp[6] + (1./2.)*( ftemp[3] - ftemp[1]) - (1./6.)*lattice->param.rho_in*u_y; //printf(" Before>> %f %f %f %f [%f] %f %f [%f] [%f]\n",// ftemp[0], ftemp[1], ftemp[2],// ftemp[3], ftemp[4], ftemp[5],// ftemp[6], ftemp[7], ftemp[8] ); } /* if( *bc & BC_PRESSURE_N_IN ) */ if( *bc & BC_PRESSURE_S_IN ) { printf("bcs() -- ERROR: Support for South, Inflow pressure " "boundaries is pending. (Exiting!)"); exit(1); } if( *bc & BC_PRESSURE_E_IN ) { printf("bcs() -- ERROR: Support for East, Inflow pressure " "boundaries is pending. (Exiting!)"); exit(1); } if( *bc & BC_PRESSURE_W_IN ) { printf("bcs() -- ERROR: Support for West, Inflow pressure " "boundaries is pending. (Exiting!)"); exit(1); } if( *bc & BC_PRESSURE_N_OUT) { printf("bcs() -- ERROR: Support for North, Outflow pressure " "boundaries is pending. (Exiting!)"); exit(1); } if( *bc & BC_PRESSURE_S_OUT) { // South, Outflow//printf("bcs() -- South, Outflow at n = %d, ( %d, %d)\n",// n, lattice->node[n].i, lattice->node[n].j);//printf(" Before>> %f %f [%f] %f %f [%f] [%f] %f %f\n",// ftemp[0], ftemp[1], ftemp[2],// ftemp[3], ftemp[4], ftemp[5],// ftemp[6], ftemp[7], ftemp[8] ); u_y = 1. - ( ftemp[0] + ftemp[1] + ftemp[3] + 2.*( ftemp[4] + ftemp[7] + ftemp[8])) / lattice->param.rho_out; ftemp[2] = ftemp[4] + (2./3.)*lattice->param.rho_out*u_y; ftemp[5] = ftemp[7] + (1./2.)*( ftemp[3] - ftemp[1]) + (1./6.)*lattice->param.rho_out*u_y; ftemp[6] = ftemp[8] + (1./2.)*( ftemp[1] - ftemp[3]) + (1./6.)*lattice->param.rho_out*u_y; //printf(" Before>> %f %f [%f] %f %f [%f] [%f] %f %f\n",// ftemp[0], ftemp[1], ftemp[2],// ftemp[3], ftemp[4], ftemp[5],// ftemp[6], ftemp[7], ftemp[8] ); } /* if( *bc & BC_PRESSURE_S_OUT) */ if( *bc & BC_PRESSURE_E_OUT) { printf("bcs() -- ERROR: Support for East, Outflow pressure " "boundaries is pending. (Exiting!)"); exit(1); } if( *bc & BC_PRESSURE_W_OUT) { printf("bcs() -- ERROR: Support for West, Outflow pressure " "boundaries is pending. (Exiting!)"); exit(1); } } /* if( *bc != 0 && *bc != BC_SOLID_NODE) */ ftemp+=27; bc++; } /* for( n=0; n<lattice->NumNodes; n++) */} /* void bcs( lattice_ptr lattice) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -