Sorry, but I still can’t get it right.
So main part of my function initializing boundries looks like this:
lattice.defineDynamics(0,nx-1, 0,ny-1, &bulkDynamics);
boundaryCondition.addVelocityBoundary1P(1,nx-2,ny-1,ny-1, omega);
boundaryCondition.addVelocityBoundary1N(1,nx-2, 0, 0, omega);
boundaryCondition.addPressureBoundary0N(0,0, 1, ny-2, omega);
boundaryCondition.addPressureBoundary0P(nx-1,nx-1, 1, ny-2, omega);
boundaryCondition.addExternalVelocityCornerNN(0,0, omega);
boundaryCondition.addExternalVelocityCornerNP(0,ny-1, omega);
boundaryCondition.addExternalVelocityCornerPN(nx-1,0, omega);
boundaryCondition.addExternalVelocityCornerPP(nx-1,ny-1, omega);
//density for inlet pressure BC
T rho1 = 1.00001;
//density for outlet pressure BC
T rho2 = 1.0;
T delta_rho = (rho1 - rho2)/nx;
for (int iX=0; iX<nx; ++iX) {
for (int iY=0; iY<ny; ++iY) {
//linear decrease of density from inlet to outlet
T rho = rho1 - iX*delta_rho;
T u[2] = {0. ,0.};
lattice.get(iX,iY).defineRhoU(rho, u);
lattice.get(iX,iY).iniEquilibrium(rho,u);
}
}
for (int iY=1; iY<ny-1; ++iY) {
lattice.get(0,iY).defineRho(rho1);
}
for (int iY=1; iY<ny-1; ++iY) {
lattice.get(nx-1,iY).defineRho(rho2);
}
lattice.initialize();
Results are still very strange, computed u[sub]max[/sub] is different whenever i change the densities on the inlet/outletand the differences are really big. Where I’m doing it wrong?