void prepareLattice(LBconverter<T> const* converter, BlockStructure2D<T,DESCRIPTOR>& lattice, Dynamics<T, DESCRIPTOR>& bulkDynamics, OnLatticeBoundaryCondition2D<T,DESCRIPTOR>& bc ){ const int nx = lattice.getNx(); const int ny = lattice.getNy(); const T omega = converter->getOmega(); // link lattice with dynamics for collision step lattice.defineDynamics(0,nx-1, 0,ny-1, &bulkDynamics); // left boundary bc.addVelocityBoundary0N( 0, 0, 1,ny-2, omega); // right boundary bc.addVelocityBoundary0P(nx-1,nx-1, 1,ny-2, omega); // bottom boundary bc.addVelocityBoundary1N( 1,nx-2, 0, 0, omega); // top boundary bc.addVelocityBoundary1P( 1,nx-2,ny-1,ny-1, omega); // corners bc.addExternalVelocityCornerNN( 0, 0, omega); bc.addExternalVelocityCornerNP( 0,ny-1, omega); bc.addExternalVelocityCornerPN(nx-1, 0, omega); bc.addExternalVelocityCornerPP(nx-1,ny-1, omega); }
void iniGeometry( BlockStructure2D<T, DESCRIPTOR>& lattice, LBunits<T> const& converter, Dynamics<T, DESCRIPTOR>& bulkDynamics, OnLatticeBoundaryCondition2D<T,DESCRIPTOR>& boundaryCondition, BoundaryType boundaryType ) { int nx = converter.getNx(); int ny = converter.getNy(); T omega = converter.getOmega(); 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); if (boundaryType==velocity) { boundaryCondition.addVelocityBoundary0N(0,0, 1, ny-2, omega); boundaryCondition.addVelocityBoundary0P(nx-1,nx-1, 1, ny-2, omega); } else { 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); for (int iX=0; iX<nx; ++iX) { for (int iY=0; iY<ny; ++iY) { T u[2] = {poiseuilleVelocity(iY, converter),0.}; T rho = (T)1 + poiseuillePressure(iX, converter) * DESCRIPTOR<T>::invCs2; lattice.get(iX,iY).defineRhoU(rho, u); lattice.get(iX,iY).iniEquilibrium(rho, u); } } lattice.initialize(); }
void prepareLattice(LBconverter<T> const& converter, BlockStructure2D<T, DESCRIPTOR>& lattice, Dynamics<T, DESCRIPTOR>& bulkDynamics, OnLatticeBoundaryCondition2D<T,DESCRIPTOR>& boundaryCondition ) { int nx = lattice.getNx(); int ny = lattice.getNy(); T omega = converter.getOmega(); /// define lattice Dynamics lattice.defineDynamics(0,nx-1, 0,ny-1, &bulkDynamics); /// sets boundary boundaryCondition.addVelocityBoundary1P(1,nx-2,ny-1,ny-1, omega); boundaryCondition.addVelocityBoundary1N(1,nx-2, 0, 0, omega); /// set Velocity boundaryCondition.addExternalVelocityCornerNN(0,0, omega); boundaryCondition.addExternalVelocityCornerNP(0,ny-1, omega); boundaryCondition.addExternalVelocityCornerPN(nx-1,0, omega); boundaryCondition.addExternalVelocityCornerPP(nx-1,ny-1, omega); }