Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
void setupInletAndBulk( MultiBlockLattice2D<T,DESCRIPTOR>& lattice,
                        IncomprFlowParam<T> const& parameters,
                        OnLatticeBoundaryCondition2D<T,DESCRIPTOR>& boundaryCondition )
{
    const plint ny = parameters.getNy();

    // Create Velocity boundary conditions on inlet
    boundaryCondition.addVelocityBoundary0N(Box2D(   0,   0,   0,ny-1), lattice);

    setBoundaryVelocity (
            lattice, Box2D(   0,   0,   0,ny-1),
            PoiseuilleVelocity<T>(parameters) );
    initializeAtEquilibrium (
            lattice, lattice.getBoundingBox(),
            PoiseuilleVelocityAndDensity<T,DESCRIPTOR>(parameters) );
}
Ejemplo n.º 3
0
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();
}