def driven_cavity_boundaries(grid, velocity): """ top - slip boundary (x-direction velocity) bottom, left, right - zero velocity """ boundaries = [] v0 = gd.LatticeVelocity(0, 0) v_top = gd.LatticeVelocity(velocity, 0) for i in range(0, grid.width): boundaries.append( gd.Boundary(grid.bottom_faces[i], 'zoe_he_velocity', value=v0)) boundaries.append( gd.Boundary(grid.top_faces[i], 'zoe_he_velocity', value=v_top)) for i in range(0, grid.height): boundaries.append( gd.Boundary(grid.left_faces[i], 'zoe_he_velocity', value=v0)) boundaries.append( gd.Boundary(grid.right_faces[i], 'zoe_he_velocity', value=v0)) # ======================================================================= # # for i in range(0, grid.width): # boundaries.append(bd.Boundary(bottom_faces[i], 'bounceback')) # boundaries.append(bd.Boundary(top_faces[i], 'zoe_he_velocity', value=v_top)) # for i in range(0, grid.height): # boundaries.append(bd.Boundary(left_faces[i], 'bounceback')) # boundaries.append(bd.Boundary(right_faces[i], 'bounceback')) return boundaries
def horizontal_poiseuille_boundaries3(grid): boundaries = [] for i in range(0, grid.width): boundaries.append(gd.Boundary(grid.bottom_faces[i], 'bounceback')) boundaries.append(gd.Boundary(grid.top_faces[i], 'bounceback')) for i in range(0, grid.height): boundaries.append(gd.Boundary(grid.left_faces[i], 'periodic')) boundaries.append(gd.Boundary(grid.right_faces[i], 'periodic')) return boundaries
def pipe_pp_bc(grid, p_right, p_left): boundaries = [] u = gd.LatticeVelocity(0, 0) # zero velocity assert isinstance(p_right, float), "Incorrect type" assert isinstance(p_left, float), "Incorrect type" for i in range(0, grid.width): boundaries.append(gd.Boundary(grid.top_faces[i], 'zoe_he_velocity', value=u)) boundaries.append(gd.Boundary(grid.bottom_faces[i], 'zoe_he_velocity', value=u)) for i in range(0, grid.height): boundaries.append(gd.Boundary(grid.left_faces[i], 'zoe_he_pressure', value=p_left)) boundaries.append(gd.Boundary(grid.right_faces[i], 'zoe_he_pressure', value=p_right)) return boundaries
def horizontal_poiseuille_boundaries2(grid): boundaries = [] v0 = gd.LatticeVelocity(0, 0) v1 = gd.LatticeVelocity(1e-6, 0) for i in range(0, grid.width): boundaries.append( gd.Boundary(grid.bottom_faces[i], 'zoe_he_velocity', value=v0)) boundaries.append( gd.Boundary(grid.top_faces[i], 'zoe_he_velocity', value=v1)) for i in range(0, grid.height): boundaries.append(gd.Boundary(grid.left_faces[i], 'periodic')) boundaries.append(gd.Boundary(grid.right_faces[i], 'periodic')) return boundaries
def driven_cavity_boundaries(self, grid, value): boundaries = [] v0 = gd.LatticeVelocity(0, 0) for i in range(0, grid.width): boundaries.append( gd.Boundary(grid.bottom_faces[i], 'zoe_he_velocity', value=v0)) boundaries.append( gd.Boundary(grid.top_faces[i], 'zoe_he_velocity', value=value)) for i in range(0, grid.height): boundaries.append( gd.Boundary(grid.left_faces[i], 'zoe_he_velocity', value=v0)) boundaries.append( gd.Boundary(grid.right_faces[i], 'zoe_he_velocity', value=v0)) return boundaries
def flow_past_cylinder(grid, velocity, pressure): boundaries = [] u_hor = gd.LatticeVelocity(velocity, 0) u_0 = gd.LatticeVelocity(0, 0) for i in range(0, grid.width): boundaries.append( gd.Boundary(grid.top_faces[i], 'zoe_he_velocity', value=u_0)) boundaries.append( gd.Boundary(grid.bottom_faces[i], 'zoe_he_velocity', value=u_0)) for i in range(0, grid.height): boundaries.append( gd.Boundary(grid.left_faces[i], 'zoe_he_velocity', value=u_hor)) boundaries.append( gd.Boundary(grid.right_faces[i], 'zoe_he_pressure', value=pressure)) return boundaries