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); }
void channelSetup( MultiBlockLattice2D<T,NSDESCRIPTOR>& lattice, IncomprFlowParam<T> const& parameters, OnLatticeBoundaryCondition2D<T,NSDESCRIPTOR>& boundaryCondition, T alpha, T frequency, T amplitude) { const plint nx = parameters.getNx(); const plint ny = parameters.getNy(); Box2D bottom( 0,nx-1, 0, 0); Box2D top( 0,nx-1, ny-1, ny-1); boundaryCondition.addVelocityBoundary1N(bottom, lattice); boundaryCondition.addPressureBoundary1P(top, lattice); Array<T,2> u((T)0.,(T)0.); setBoundaryVelocity( lattice, lattice.getBoundingBox(), u ); initializeAtEquilibrium(lattice,lattice.getBoundingBox(),(T)1.0,u); Array<T,NSDESCRIPTOR<T>::d> force(womersleyForce((T)0, amplitude, frequency, parameters),0.); setExternalVector(lattice,lattice.getBoundingBox(),NSDESCRIPTOR<T>::ExternalField::forceBeginsAt,force); lattice.initialize(); }